syscall_trace_enter and syscall_trace_leave for m68k w/MMU
Subsystems (5)
Hello!
Michael and I have been working on SECCOMP in SuperH and successfully added the missing pieces yesterday [1].
We're now looking into what needs to be done for m68k and I have noticed that syscall_trace_enter and syscall_trace_leave - which needs to be touched for SECCOMP support - are available on ColdFire and non-MMU targets for m68k.
Is there a particular reason for that? Looking at 68000/entry.S, I can see that both functions are invoked [2] so I'm not sure why they are built for CONFIG_COLDFIRE and !CONFIG_MMM only.
Any ideas?
Adrian
Quoted 2 lines
[1] https://marc.info/?l=linux-sh&m=159546012829989&w=2
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/m68k/68000/entry.S
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Adrian,
m68k/mm only has syscall_trace() (in kernel/ptrace.c) which is called from the system call entry in kernel/entry.S (look for do_trace_* there).
syscall_trace() is called before and after syscall execution (if the syscall trace flag is set). Looking at the sparc 32 and 64 bit trace code for comparison, you might try replacing these calls by syscall_trace_enter() and syscall_trace_leave(). The current code in syscall_trace replicates the code in ptrace_report_syscall which will be called from syscall_trace_enter() and syscall_trace_leave(), so things ought to continue to function as normal.
syscall_trace() is also called from the ret_from_signal entry - no idea what should happen to that one. My guess is to treat this as syscall trace exit.
CC to Andreas - maybe there are subtleties with strace or gdb that I'm missing.
Cheers,
Michael
Quoted 19 lines · John Paul Adrian Glaubitz
Hello!
Michael and I have been working on SECCOMP in SuperH and successfully added the missing pieces yesterday [1].
We're now looking into what needs to be done for m68k and I have noticed that
syscall_trace_enterandsyscall_trace_leave- which needs to be touched for SECCOMP support - are available on ColdFire and non-MMU targets for m68k.Is there a particular reason for that? Looking at
68000/entry.S, I can see that both functions are invoked [2] so I'm not sure why they are built forCONFIG_COLDFIREand !CONFIG_MMM only.Any ideas?
Adrian
RFC PATCH 1/1 m68k/kernel - wire up syscall_trace_enter/leave for m68k
In reply to John Paul Adrian Glaubitzm68k (other than Coldfire) uses syscall_trace for both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.
Replace syscall_trace by syscall_trace_enter and syscall_trace_leave in preparation for seccomp support.
No regression seen in testing with strace on ARAnyM.
--- arch/m68k/kernel/entry.S | 6 +++--- arch/m68k/kernel/ptrace.c | 17 ----------------- 2 files changed, 3 insertions(+), 20 deletions(-)
arch/m68k/kernel/entry.S +3 -3
@@ -164,7 +164,7 @@ do_trace_entry: movel #-ENOSYS,%sp@(PT_OFF_D0)| needed for strace subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp movel %sp@(PT_OFF_ORIG_D0),%d0
@@ -177,7 +177,7 @@ badsys: do_trace_exit: subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_leave RESTORE_SWITCH_STACK addql #4,%sp jra .Lret_from_exception
@@ -186,7 +186,7 @@ ENTRY(ret_from_signal) movel %curptr@(TASK_STACK),%a1 tstb %a1@(TINFO_FLAGS+2) jge 1f - jbsr syscall_trace + jbsr syscall_trace_leave 1: RESTORE_SWITCH_STACK addql #4,%sp /* on 68040 complete pending writebacks if any */
arch/m68k/kernel/ptrace.c +0 -17
@@ -272,22 +272,6 @@ long arch_ptrace(struct task_struct *child, long request,return -EIO ; } -asmlinkage void syscall_trace(void) -{ -ptrace_notify (SIGTRAP | ((current->ptrace &PT_TRACESYSGOOD ) - ?0x80 :0 )); -/* -* this isn't the same as continuing with a signal, but it will do -* for normal use. strace only continues with a signal if the -* stopping signal is not SIGTRAP. -brl -*/ -if (current->exit_code) { -send_sig (current->exit_code, current,1 ); - current->exit_code =0 ; - } -} - -#if defined(CONFIG_COLDFIRE ) || !defined(CONFIG_MMU ) asmlinkage int syscall_trace_enter(void) {int ret =0 ;
@@ -302,4 +286,3 @@ asmlinkage void syscall_trace_leave(void)if (test_thread_flag (TIF_SYSCALL_TRACE ))tracehook_report_syscall_exit (task_pt_regs (current),0 ); } -#endif /* CONFIG_COLDFIRE */
Signature · 1 line
1.7.0.4
RFC PATCH v2 1/1 m68k/kernel - wire up syscall_trace_enter/leave for m68k
In reply to John Paul Adrian Glaubitzm68k (other than Coldfire) uses syscall_trace for both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.
Replace syscall_trace by syscall_trace_enter and syscall_trace_leave in preparation for seccomp support. Check return code of syscall_trace_enter(), and skip syscall if nonzero. Return code will be set to -EPERM in that case.
No regression seen in testing with strace on ARAnyM.
---
Changes from v1:
- add return code check in do_trace_entry branch to enable syscall filtering (will return -EPERM)
- change to use testl for return code check (suggested by Andreas Schwab)
--- arch/m68k/kernel/entry.S | 11 ++++++++--- arch/m68k/kernel/ptrace.c | 17 ----------------- 2 files changed, 8 insertions(+), 20 deletions(-)
arch/m68k/kernel/entry.S +8 -3
@@ -164,20 +164,25 @@ do_trace_entry: movel #-ENOSYS,%sp@(PT_OFF_D0)| needed for strace subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + tstl %d0 + jne denied movel %sp@(PT_OFF_ORIG_D0),%d0 cmpl #NR_syscalls,%d0 jcs syscall badsys: movel #-ENOSYS,%sp@(PT_OFF_D0) jra ret_from_syscall +denied: + movel #-EPERM,%sp@(PT_OFF_D0) + jra ret_from_syscall do_trace_exit: subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_leave RESTORE_SWITCH_STACK addql #4,%sp jra .Lret_from_exception
@@ -186,7 +191,7 @@ ENTRY(ret_from_signal) movel %curptr@(TASK_STACK),%a1 tstb %a1@(TINFO_FLAGS+2) jge 1f - jbsr syscall_trace + jbsr syscall_trace_leave 1: RESTORE_SWITCH_STACK addql #4,%sp /* on 68040 complete pending writebacks if any */
arch/m68k/kernel/ptrace.c +0 -17
@@ -272,22 +272,6 @@ long arch_ptrace(struct task_struct *child, long request,return -EIO ; } -asmlinkage void syscall_trace(void) -{ -ptrace_notify (SIGTRAP | ((current->ptrace &PT_TRACESYSGOOD ) - ?0x80 :0 )); -/* -* this isn't the same as continuing with a signal, but it will do -* for normal use. strace only continues with a signal if the -* stopping signal is not SIGTRAP. -brl -*/ -if (current->exit_code) { -send_sig (current->exit_code, current,1 ); - current->exit_code =0 ; - } -} - -#if defined(CONFIG_COLDFIRE ) || !defined(CONFIG_MMU ) asmlinkage int syscall_trace_enter(void) {int ret =0 ;
@@ -302,4 +286,3 @@ asmlinkage void syscall_trace_leave(void)if (test_thread_flag (TIF_SYSCALL_TRACE ))tracehook_report_syscall_exit (task_pt_regs (current),0 ); } -#endif /* CONFIG_COLDFIRE */
Signature · 1 line
1.7.0.4
PATCH 1/1 m68k/kernel - wire up syscall_trace_enter/leave for m68k
In reply to John Paul Adrian Glaubitzm68k (other than Coldfire) uses syscall_trace for both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.
Replace syscall_trace by syscall_trace_enter and syscall_trace_leave in preparation for seccomp support. Check return code of syscall_trace_enter(), and skip syscall if nonzero. Return code will be left at what had been set by by ptrace or seccomp.
No regression seen in testing with strace on ARAnyM.
---
Changes from RFC v1:
- add return code check in do_trace_entry branch to enable syscall filtering (will return -EPERM)
- change to use testl for return code check (suggested by Andreas Schwab)
Changes from RFC v2:
- don't set return code of filtered syscall - seccomp may want to set that for use by calling process.
--- arch/m68k/kernel/entry.S | 8 +++++--- arch/m68k/kernel/ptrace.c | 17 ----------------- 2 files changed, 5 insertions(+), 20 deletions(-)
arch/m68k/kernel/entry.S +5 -3
@@ -164,9 +164,11 @@ do_trace_entry: movel #-ENOSYS,%sp@(PT_OFF_D0)| needed for strace subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + tstl %d0 + jne ret_from_syscall movel %sp@(PT_OFF_ORIG_D0),%d0 cmpl #NR_syscalls,%d0 jcs syscall
@@ -177,7 +179,7 @@ badsys: do_trace_exit: subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_leave RESTORE_SWITCH_STACK addql #4,%sp jra .Lret_from_exception
@@ -186,7 +188,7 @@ ENTRY(ret_from_signal) movel %curptr@(TASK_STACK),%a1 tstb %a1@(TINFO_FLAGS+2) jge 1f - jbsr syscall_trace + jbsr syscall_trace_leave 1: RESTORE_SWITCH_STACK addql #4,%sp /* on 68040 complete pending writebacks if any */
arch/m68k/kernel/ptrace.c +0 -17
@@ -272,22 +272,6 @@ long arch_ptrace(struct task_struct *child, long request,return -EIO ; } -asmlinkage void syscall_trace(void) -{ -ptrace_notify (SIGTRAP | ((current->ptrace &PT_TRACESYSGOOD ) - ?0x80 :0 )); -/* -* this isn't the same as continuing with a signal, but it will do -* for normal use. strace only continues with a signal if the -* stopping signal is not SIGTRAP. -brl -*/ -if (current->exit_code) { -send_sig (current->exit_code, current,1 ); - current->exit_code =0 ; - } -} - -#if defined(CONFIG_COLDFIRE ) || !defined(CONFIG_MMU ) asmlinkage int syscall_trace_enter(void) {int ret =0 ;
@@ -302,4 +286,3 @@ asmlinkage void syscall_trace_leave(void)if (test_thread_flag (TIF_SYSCALL_TRACE ))tracehook_report_syscall_exit (task_pt_regs (current),0 ); } -#endif /* CONFIG_COLDFIRE */
Signature · 1 line
1.7.0.4
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Michael!
Quoted 8 lines · Michael Schmitz
m68k (other than Coldfire) uses
syscall_tracefor both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.Replace
syscall_tracebysyscall_trace_enterandsyscall_trace_leavein preparation for seccomp support. Check return code ofsyscall_trace_enter(), and skip syscall if nonzero. Return code will be left at what had been set by by ptrace or seccomp.
Correct me if I'm wrong, but shouldn't the skip happen when the return code is -1? At least that's what we're doing on SuperH and that seems to be what other architectures are doing as well.
Also, shouldn't that part of the change not be part of the patch that adds support for SECCOMP filter like in [1]? I don't think it makes sense to add the return code check unless the rest of SECCOMP filter has been implemented.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Adrian,
Quoted 7 lines · John Paul Adrian Glaubitz
Hi Michael!
Quoted 4 lines · Michael Schmitz
m68k (other than Coldfire) uses
syscall_tracefor both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.
Quoted 7 lines
Quoted 4 lines
Replace
syscall_tracebysyscall_trace_enterandsyscall_trace_leavein preparation for seccomp support. Check return code ofsyscall_trace_enter(), and skip syscall if nonzero. Return code will be left at what had been set by by ptrace or seccomp.Correct me if I'm wrong, but shouldn't the skip happen when the return code is -1? At least that's what we're doing on SuperH and that seems to be what other architectures are doing as well.
What other non-zero return codes do you expect syscall_trace_enter() to set, and what should the action in entry.S be?
(Note that according to my reading, your SH patch does not actually do what your description says. If syscall_trace_enter() returns a positive non-zero value, that value is _not_ used as changed syscall number. SH uses r3 for the syscall number, not r0).
As far as I can see, any non-zero return code should abort the syscall, so I just test for that (for simplicity). Our use of the tracehook_report_syscall_entry() return code (directly passed back from syscall_trace_enter()) doesn't leave much choice there, see comment in include/linux/tracehook.h.
If later on seccomp needs any specific action, it should be easy enough to change the syscall number (offset PT_OFF_ORIG_D0 on the stack) or syscall return code (offset PT_OFF_D0). There's code in kernel/ptrace.c to do that AFAICS.
Changing the behaviour of syscall_trace_enter() to match what other architectures do (return changed syscall number, not error code) is beyond the scope of this patch. I suspect the capability to change syscall numbers from ptrace code does predate the seccomp filter approach, and as m68k has never used it in the past, I don't see a point to add this now.
Quoted 4 lines
Also, shouldn't that part of the change not be part of the patch that adds support for SECCOMP filter like in [1]? I don't think it makes sense to add the return code check unless the rest of SECCOMP filter has been implemented.
After replacing syscall_trace() by syscall_trace_enter() and syscall_trace_leave(), there is a return code provided by syscall_trace_enter() which we must check, hence I added the check at the same time as replacing syscall_trace() for non-Coldfire m68k.
(I note that the same check should probably be added to coldfire/entry.S.)
I can't test any of the later seccomp related stuff, so I'd rather leave that bit to someone else who can.
Cheers,
Michael
Quoted 4 lines
Adrian
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Quoted 12 lines · Michael Schmitz
Quoted 11 lines · John Paul Adrian Glaubitz
Hi Michael!
Quoted 8 lines · Michael Schmitz
m68k (other than Coldfire) uses
syscall_tracefor both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.Replace
syscall_tracebysyscall_trace_enterandsyscall_trace_leavein preparation for seccomp support. Check return code ofsyscall_trace_enter(), and skip syscall if nonzero. Return code will be left at what had been set by by ptrace or seccomp.
Quoted 5 lines
Quoted 3 lines
Correct me if I'm wrong, but shouldn't the skip happen when the return code is -1? At least that's what we're doing on SuperH and that seems to be what other architectures are doing as well.
What other non-zero return codes do you expect
syscall_trace_enter()to set, and what should the action inentry.Sbe?
I just don't think we should do it any different than the other architectures which explicitly compare the return value against -1, i.e. RISC-V and PA-RISC.
Quoted 1 line
(Note that according to my reading, your SH patch does not actually do what your description says. If
syscall_trace_enter()returns a positive non-zero value, that value is _not_ used as changed syscall number. SH uses r3 for the syscall number, not r0).
You are right, of course. I somehow mixed that up. You're right, it checks the return value of syscall_trace_enter and it should skip the syscall if syscall_trace_enter returns -1.
Quoted 1 line
As far as I can see, any non-zero return code should abort the syscall, so I just test for that (for simplicity). Our use of the
tracehook_report_syscall_entry()return code (directly passed back fromsyscall_trace_enter()) doesn't leave much choice there, see comment ininclude/linux/tracehook.h.
My point is to stay consistent with the other architectures.
Quoted 3 lines
If later on seccomp needs any specific action, it should be easy enough to change the syscall number (offset
PT_OFF_ORIG_D0on the stack) or syscall return code (offsetPT_OFF_D0). There's code inkernel/ptrace.cto do that AFAICS.Changing the behaviour of
syscall_trace_enter()to match what other architectures do (return changed syscall number, not error code) is beyond the scope of this patch. I suspect the capability to change syscall numbers from ptrace code does predate the seccomp filter approach, and as m68k has never used it in the past, I don't see a point to add this now.
Yes, I agree and my previous comment in this regard was wrong.
Quoted 8 lines
Quoted 4 lines
Also, shouldn't that part of the change not be part of the patch that adds support for SECCOMP filter like in [1]? I don't think it makes sense to add the return code check unless the rest of SECCOMP filter has been implemented.
After replacing
syscall_trace()bysyscall_trace_enter()andsyscall_trace_leave(), there is a return code provided bysyscall_trace_enter()which we must check, hence I added the check at the same time as replacingsyscall_trace()for non-Coldfire m68k.(I note that the same check should probably be added to
coldfire/entry.S.)
Do we actually need to check the return value unless we implement SECCOMP_FILTER? (Which no doubt we will do ;-)).
Quoted 1 line
I can't test any of the later seccomp related stuff, so I'd rather leave that bit to someone else who can.
I will work on the necessary changes for libseccomp this week, so that we can test whether the libseccomp live tests pass correctly on a patched kernel.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Adrian,
Quoted 5 lines · John Paul Adrian Glaubitz
Quoted 1 line · Michael Schmitz
I can't test any of the later seccomp related stuff, so I'd rather leave that bit to someone else who can.
I will work on the necessary changes for libseccomp this week, so that we can test whether the libseccomp live tests pass correctly on a patched kernel.
Any update on this?
With the below, you can run "make kselftest-all" (does not support O=!), copy tools/testing/selftests/seccomp/seccomp_bpf and tools/testing/selftests/seccomp/seccomp_benchmark to your m68k system, and run the tests. Of course they fail, as the actual seccomp support hasn't been written yet...
From f5d325fadc43823f2a7ab2ff2e436da5ebb31565 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Wed, 26 Aug 2020 11:52:26 +0200
Subject: [PATCH] [WIP] selftests/seccomp: Add m68k support
FIXME
--- tools/testing/selftests/seccomp/seccomp_bpf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tools/testing/selftests/seccomp/seccomp_bpf.c +9 -2
@@ -135,6 +135,8 @@ struct seccomp_data {# define __NR_seccomp 337# elif defined(__sh__)# define __NR_seccomp 372 +# elif defined(__mc68000__) +# define __NR_seccomp 380# else # warning "seccomp syscall number unknown for this architecture"# define __NR_seccomp 0xffff
@@ -1725,6 +1727,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)# define ARCH_REGS struct pt_regs# define SYSCALL_NUM gpr[3]# define SYSCALL_RET gpr[0] +#elif defined(__mc68000__) +# define ARCH_REGS struct pt_regs +# define SYSCALL_NUM orig_d0 +# define SYSCALL_RET d0#else # error "Do not know how to find your architecture's registers and syscalls"#endif
@@ -1748,7 +1754,7 @@ TEST_F(TRACE_poke, getpid_runs_normally)/* Use PTRACE_GETREGS and PTRACE_SETREGS when available. This is useful for * architectures without HAVE_ARCH_TRACEHOOK (e.g. User-mode Linux). */ -#if defined(__x86_64__) || defined(__i386__) || defined(__mips__) +#if defined(__x86_64__) || defined(__i386__) || defined(__mips__) || defined(__mc68000)#define HAVE_GETREGS #endif
@@ -1797,7 +1803,8 @@ void change_syscall(struct __test_metadata *_metadata,#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \ defined(__s390__) || defined(__hppa__) || defined(__riscv) || \ - defined(__xtensa__) || defined(__csky__) || defined(__sh__) + defined(__xtensa__) || defined(__csky__) || defined(__sh__) || \ + defined(__mc68000) { regs.SYSCALL_NUM = syscall; }
Signature · 12 lines
2.17.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Geert!
Quoted 4 lines · Geert Uytterhoeven
Quoted 2 lines
I will work on the necessary changes for libseccomp this week, so that we can test whether the libseccomp live tests pass correctly on a patched kernel.
Any update on this?
Yes, I have rebased and updated the code:
Quoted 1 line
It needs another review as one test is failing on x86_64 now. But that's not difficult.
Quoted 6 lines
With the below, you can run "make kselftest-all" (does not support O=!), copy
tools/testing/selftests/seccomp/seccomp_bpfandtools/testing/selftests/seccomp/seccomp_benchmarkto your m68k system, and run the tests. Of course they fail, as the actual seccomp support hasn't been written yet...
Quoted 6 lines
From
f5d325fadc43823f2a7ab2ff2e436da5ebb31565Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Wed, 26 Aug 2020 11:52:26 +0200
Subject: [PATCH] [WIP] selftests/seccomp: Add m68k supportFIXME
Okay, thanks.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
In reply to Michael SchmitzHi Michael,
Quoted 4 lines · Michael Schmitz
m68k (other than Coldfire) uses
syscall_tracefor both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.
Quoted 8 lines
Replace
syscall_tracebysyscall_trace_enterandsyscall_trace_leavein preparation for seccomp support. Check return code ofsyscall_trace_enter(), and skip syscall if nonzero. Return code will be left at what had been set by by ptrace or seccomp.No regression seen in testing with strace on ARAnyM.
Signed-off-by Michael Schmitz <[email protected]>
Thanks for your patch!
Quoted 10 lines
Changes from RFC v1:
- add return code check in
do_trace_entrybranch to enable syscall filtering (will return-EPERM)
- change to use testl for return code check (suggested by Andreas Schwab)Changes from RFC v2:
- don't set return code of filtered syscall - seccomp may want to set that for use by calling process.
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced (msgid not present)...
The patch itself looks good to me. Does it make sense to apply it before we have real seccomp support?
[*] https://people.kernel.org/monsieuricon/introducing-b4-and-patch-attestation
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Geert!
Quoted 11 lines · Geert Uytterhoeven
Quoted 10 lines
Changes from RFC v1:
- add return code check in
do_trace_entrybranch to enable syscall filtering (will return-EPERM)
- change to use testl for return code check (suggested by Andreas Schwab)Changes from RFC v2:
- don't set return code of filtered syscall - seccomp may want to set that for use by calling process.
Quoted 6 lines
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced (msgid not present)...
The patch itself looks good to me. Does it make sense to apply it before we have real seccomp support?
Adding SECCOMP support itself doesn't take much:
Quoted 2 lines
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/sh?id=c4637d475170ca0d99973efd07df727012db6cd1
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/sh?id=0bb605c2c7f2b4b314b91510810b226de7f34fa1
Once syscall_trace_entry/leave have been made available, we just need to add some Kconfig bits and the part which checks the return code of syscall_trace_enter.
The rest is done by arch-agnostic code.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Adrian,
Quoted 21 lines · John Paul Adrian Glaubitz
Quoted 11 lines · Geert Uytterhoeven
Quoted 10 lines
Changes from RFC v1:
- add return code check in
do_trace_entrybranch to enable syscall filtering (will return-EPERM)
- change to use testl for return code check (suggested by Andreas Schwab)Changes from RFC v2:
- don't set return code of filtered syscall - seccomp may want to set that for use by calling process.
Quoted 6 lines
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced (msgid not present)...
The patch itself looks good to me. Does it make sense to apply it before we have real seccomp support?
Adding SECCOMP support itself doesn't take much:
Quoted 8 lines
Quoted 2 lines
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/sh?id=c4637d475170ca0d99973efd07df727012db6cd1
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/sh?id=0bb605c2c7f2b4b314b91510810b226de7f34fa1Once syscall_trace_entry/leave have been made available, we just need to add some
Kconfigbits and the part which checks the return code ofsyscall_trace_enter.The rest is done by arch-agnostic code.
I came up with the following (basic seccomp, no seccomp filter), but the seccomp_bpf selftest still fails all over the place...
From 231c23d07200cdd338dcf8d2adae8322ecef18f4 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Wed, 26 Aug 2020 14:24:58 +0200
Subject: [PATCH] [WIP] seccomp support
--- arch/m68k/Kconfig | 14 ++++++++++++++ arch/m68k/include/asm/Kbuild | 1 + arch/m68k/include/asm/thread_info.h | 2 ++ arch/m68k/kernel/ptrace.c | 4 ++++ 4 files changed, 21 insertions(+)
arch/m68k/Kconfig +14 -0
@@ -127,6 +127,20 @@ endmenu menu "Kernel Features" +config SECCOMP + bool + prompt "Enable seccomp to safely compute untrusted bytecode" + help + This kernel feature is useful for number crunching applications + that may need to compute untrusted bytecode during their + execution. By using pipes or other transports made available to + the process as file descriptors supporting the read/write + syscalls, it's possible to isolate those applications in + their own address space using seccomp. Once seccomp is + enabled via prctl(PR_SET_SECCOMP), it cannot be disabled + and the task is only allowed to execute a few safe syscalls + defined by each seccomp mode. + endmenu if !MMU
arch/m68k/include/asm/Kbuild +1 -0
@@ -4,4 +4,5 @@ generic-y += extable.h generic-y += kvm_para.h generic-y += local64.h generic-y += mcs_spinlock.h +generic-y += seccomp.h generic-y += spinlock.h
arch/m68k/include/asm/thread_info.h +2 -0
@@ -63,6 +63,7 @@ static inline struct thread_info *current_thread_info(void)#define TIF_NOTIFY_RESUME 5/* callback before returning to user */ #define TIF_SIGPENDING 6/* signal pending */ #define TIF_NEED_RESCHED 7/* rescheduling necessary */ +#define TIF_SECCOMP 8/* secure computing */ #define TIF_DELAYED_TRACE 14/* single step a syscall */ #define TIF_SYSCALL_TRACE 15/* syscall trace active */ #define TIF_MEMDIE 16/* is terminating due to OOM killer */
@@ -71,6 +72,7 @@ static inline struct thread_info *current_thread_info(void)#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) +#define _TIF_SECCOMP (1 << TIF_SECCOMP)#define _TIF_DELAYED_TRACE (1 << TIF_DELAYED_TRACE)#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)#define _TIF_MEMDIE (1 << TIF_MEMDIE)
arch/m68k/kernel/ptrace.c +4 -0
@@ -20,6 +20,7 @@#include <linux/user.h> #include <linux/signal.h> #include <linux/tracehook.h> +#include <linux/seccomp.h> #include <linux/uaccess.h> #include <asm/page.h>
@@ -277,6 +278,9 @@ asmlinkage int syscall_trace_enter(void)if (test_thread_flag (TIF_SYSCALL_TRACE )) ret =tracehook_report_syscall_entry (task_pt_regs (current)); + +secure_computing_strict (task_pt_regs (current)->orig_d0); +return ret; }
Signature · 12 lines
2.17.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Geert!
arch/m68k/kernel/ptrace.c asmlinkage int syscall_trace_enter(void) · line 283
Quoted 9 lines · Geert Uytterhoeven
#include <
linux/uaccess.h>
#include <asm/page.h>arch/m68k/kernel/ptrace.c +3
-0@@ -277,6 +278,9 @@ asmlinkage int syscall_trace_enter(void) if (test_thread_flag(TIF_SYSCALL_TRACE)) ret = tracehook_report_syscall_entry(task_pt_regs(current)); + + secure_computing_strict(task_pt_regs(current)->orig_d0); +
That part is outdated. It was removed in the second commit I posted, see:
Do you have the check of the return value already in syscall_trace_entry?
It should check for "-1" and jump to syscall_exit if true.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Adrian,
Quoted 5 lines · John Paul Adrian Glaubitz
Quoted 4 lines · Geert Uytterhoeven
#include <
linux/uaccess.h>
#include <asm/page.h>(quoted diff) +0
-0@@ -277,6 +278,9 @@ asmlinkage int syscall_trace_enter(void)
Quoted 9 lines
arch/m68k/kernel/ptrace.c asmlinkage int syscall_trace_enter(void) · line 283
Quoted 5 lines
arch/m68k/kernel/ptrace.c +3
-0if (test_thread_flag (TIF_SYSCALL_TRACE )) ret =tracehook_report_syscall_entry (task_pt_regs (current)); + +secure_computing_strict (task_pt_regs (current)->orig_d0); +That part is outdated. It was removed in the second commit I posted, see:
That's the part which adds seccomp filter support.
Quoted 3 lines
Do you have the check of the return value already in
syscall_trace_entry?It should check for "-1" and jump to
syscall_exitif true.
No, as that's needed only for seccomp filter support, AFAIU.
Have a look at arm, where seccomp filter support is optional, depending on ABI.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Geert!
Quoted 6 lines · Geert Uytterhoeven
Quoted 3 lines
That part is outdated. It was removed in the second commit I posted, see:
That's the part which adds seccomp filter support.
Quoted 7 lines
Quoted 3 lines
Do you have the check of the return value already in
syscall_trace_entry?It should check for "-1" and jump to
syscall_exitif true.No, as that's needed only for seccomp filter support, AFAIU.
Have a look at arm, where seccomp filter support is optional, depending on ABI.
As far as I know, filter support is mandatory these days. At least for SH, libseccomp sent me away with my PR and told me to come back until the kernel has filter support.
Maybe I'm missing something but let's put Michael Karcher in the loop, he knows better as he helped me with the kernel parts of SECCOMP on SH.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Adrian,
Quoted 9 lines · John Paul Adrian Glaubitz
Quoted 8 lines · Geert Uytterhoeven
Quoted 3 lines
That part is outdated. It was removed in the second commit I posted, see:
That's the part which adds seccomp filter support.
Quoted 2 lines
Do you have the check of the return value already in
syscall_trace_entry?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
It should check for "-1" and jump to
syscall_exitif true.No, as that's needed only for seccomp filter support, AFAIU.
Have a look at arm, where seccomp filter support is optional, depending on ABI.
As far as I know, filter support is mandatory these days. At least for SH, libseccomp sent me away with my PR and told me to come back until the kernel has filter support.
OK.
Quoted 2 lines
Maybe I'm missing something but let's put Michael Karcher in the loop, he knows better as he helped me with the kernel parts of SECCOMP on SH.
More work on top of the previous patch. It starts to look better:
-FAILED: 13 / 86 tests passed.
+FAILED: 35 / 86 tests passed.
But there are still fishy failures. Most popular one is:
Test exited normally instead of by signal (code: 0)
And things like:
Expected 0 (0) == syscall(__NR_getpid) (705)
Expected 0 (-270272472) == ptrace(PTRACE_GETREGS, tracee, 0, ®s) (0)From 1ae515061575024081af930f4e5f9283910648de Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Wed, 26 Aug 2020 16:11:35 +0200
Subject: [PATCH] [WIP] seccomp filter support
--- arch/m68k/68000/entry.S | 2 ++ arch/m68k/Kconfig | 1 + arch/m68k/coldfire/entry.S | 2 ++ arch/m68k/include/asm/syscall.h | 41 +++++++++++++++++++++++++++++++++ arch/m68k/kernel/ptrace.c | 3 ++- 5 files changed, 48 insertions(+), 1 deletion(-)
arch/m68k/68000/entry.S +2 -0
@@ -47,6 +47,8 @@ do_trace: jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + tstl %d0 + jne ret_from_exception movel %sp@(PT_OFF_ORIG_D0),%d1 movel #-ENOSYS,%d0 cmpl #NR_syscalls,%d1
arch/m68k/Kconfig +1 -0
@@ -19,6 +19,7 @@ config M68K select GENERIC_STRNCPY_FROM_USER if MMU select GENERIC_STRNLEN_USER if MMU select HAVE_AOUT if MMU + select HAVE_ARCH_SECCOMP_FILTER select HAVE_ASM_MODVERSIONS select HAVE_DEBUG_BUGVERBOSE select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
arch/m68k/coldfire/entry.S +2 -0
@@ -92,6 +92,8 @@ ENTRY(system_call) jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + tstl %d0 + jne ret_from_exception movel %d3,%a0 jbsr %a0@ movel %d0,%sp@(PT_OFF_D0) /* save the return value */
arch/m68k/include/asm/syscall.h +41 -0
47 lines not on this page · raw message
arch/m68k/kernel/ptrace.c +2 -1
@@ -279,7 +279,8 @@ asmlinkage int syscall_trace_enter(void)if (test_thread_flag (TIF_SYSCALL_TRACE )) ret =tracehook_report_syscall_entry (task_pt_regs (current)); -secure_computing_strict (task_pt_regs (current)->orig_d0); +if (secure_computing ()) +return -1 ;return ret; }
Signature · 14 lines
2.17.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
In reply to Geert UytterhoevenHi Geert,
Quoted 12 lines · Geert Uytterhoeven
Hi Michael,
Quoted 9 lines · Michael Schmitz
m68k (other than Coldfire) uses
syscall_tracefor both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.Replace
syscall_tracebysyscall_trace_enterandsyscall_trace_leavein preparation for seccomp support. Check return code ofsyscall_trace_enter(), and skip syscall if nonzero. Return code will be left at what had been set by by ptrace or seccomp.
Quoted 4 lines
Quoted 3 lines
No regression seen in testing with strace on ARAnyM.
Signed-off-by Michael Schmitz <[email protected]>Thanks for your patch!
Thanks for looking into it!
Quoted 7 lines
Quoted 7 lines
Changes from RFC v1:
- add return code check in
do_trace_entrybranch to enable syscall filtering (will return-EPERM)
- change to use testl for return code check (suggested by Andreas Schwab)
Quoted 6 lines
Quoted 4 lines
Changes from RFC v2:
- don't set return code of filtered syscall - seccomp may want to set that for use by calling process.
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced
Argh - I thought that since the first two were tagged 'RFC', I could just restart with v1.
Never heard of b4, sorry.
Quoted 4 lines
(msgid not present)...
The patch itself looks good to me. Does it make sense to apply it before we have real seccomp support?
As far as I understand Adrian, it's needed as a prerequisite (though I admit there needs to be another patch adding the actual seccomp bits as well).
With my rather limited test setup, this was all I could test. I've done enough damage with 'I think this is how it should work' patches to add untested stuff.
In my not-at-all-humble opinion, the whole issue of whether to trigger a syscall abort on any non-zero return code, or just -1, is quite academic so I'd rather keep the broader non-zero test (unless someone points to a clear-cut reason why this is a Bad Thing).
Cheers,
Michael
Quoted 7 lines
[*] https://people.kernel.org/monsieuricon/introducing-b4-and-patch-attestation
Gr{oetje,eeting}s,
Geert
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Michael,
Quoted 8 lines · Michael Schmitz
Quoted 2 lines · Geert Uytterhoeven
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced
Argh - I thought that since the first two were tagged 'RFC', I could just restart with v1.
Never heard of b4, sorry.
It's the new tool to download patches and patch series, adding automatically any received *-by tags, and the Link: tag. Makes my life easier ;-)
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Geert,
Quoted 6 lines · Geert Uytterhoeven
Hi Michael,
Quoted 3 lines · Michael Schmitz
Quoted 2 lines · Geert Uytterhoeven
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced
Quoted 7 lines
Quoted 4 lines
Argh - I thought that since the first two were tagged 'RFC', I could just restart with v1.
Never heard of b4, sorry.
It's the new tool to download patches and patch series, adding automatically any received *-by tags, and the Link: tag. Makes my life easier ;-)
I take that as read. Rather you than me :-)
Do you want me to resend this as v3? And any preference on the branch test (non-zero, or -1)?
Cheers,
Michael
Quoted 5 lines
Gr{oetje,eeting}s,
Geert
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Michael,
Quoted 9 lines · Michael Schmitz
Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Michael Schmitz
Quoted 2 lines · Geert Uytterhoeven
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced
Argh - I thought that since the first two were tagged 'RFC', I could just restart with v1.
Never heard of b4, sorry.
Quoted 8 lines
Quoted 3 lines
It's the new tool to download patches and patch series, adding automatically any received *-by tags, and the Link: tag. Makes my life easier ;-)
I take that as read. Rather you than me :-)
Do you want me to resend this as v3? And any preference on the branch test (non-zero, or -1)?
No need to resend, unless there will be a v4 ;-)
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Geert,
working on entry.S recently, I was reminded of this one. It's never been applied, and I can't find a trace of it in my tree.
Not sure how far Adrian got with seccomp support testing, so I'm uncertain this is still of interest ...
Cheers,
Michael
Quoted 25 lines · Geert Uytterhoeven
Hi Michael,
Quoted 8 lines · Michael Schmitz
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · Michael Schmitz
Quoted 2 lines · Geert Uytterhoeven
As your email subject didn't contain "v3", b4[*] insists on picking up RFC v2, and refuses to pick up the latest version, even when forced
Argh - I thought that since the first two were tagged 'RFC', I could just restart with v1.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Never heard of b4, sorry.
It's the new tool to download patches and patch series, adding automatically any received *-by tags, and the Link: tag. Makes my life easier ;-)
I take that as read. Rather you than me :-)
Do you want me to resend this as v3? And any preference on the branch test (non-zero, or -1)?
No need to resend, unless there will be a v4 ;-)
Gr{oetje,eeting}s,
Geert
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Quoted 3 lines · Michael Schmitz
working on
entry.Srecently, I was reminded of this one. It's never been applied, and I can't find a trace of it in my tree.Not sure how far Adrian got with seccomp support testing, so I'm uncertain this is still of interest ...
I still have a fork of libseccomp with m68k support and my SH support patch was merged upstream.
So, if you guys can get the kernel bits in place, I can take care of libseccomp.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Adrian,
Quoted 8 lines · John Paul Adrian Glaubitz
Quoted 3 lines · Michael Schmitz
working on
entry.Srecently, I was reminded of this one. It's never been applied, and I can't find a trace of it in my tree.Not sure how far Adrian got with seccomp support testing, so I'm uncertain this is still of interest ...
I still have a fork of libseccomp with m68k support and my SH support patch was merged upstream.
So, if you guys can get the kernel bits in place, I can take care of libseccomp.
Thanks - what (aside from my old patch) is still missing on the kernel side?
Cheers,
Michael
Quoted 3 lines
Adrian
Geert Uytterhoeven
maintainerRe: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Michael,
Quoted 4 lines · Michael Schmitz
Quoted 3 lines · John Paul Adrian Glaubitz
Quoted 2 lines · Michael Schmitz
working on
entry.Srecently, I was reminded of this one. It's never been applied, and I can't find a trace of it in my tree.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Not sure how far Adrian got with seccomp support testing, so I'm uncertain this is still of interest ...
I still have a fork of libseccomp with m68k support and my SH support patch was merged upstream.
So, if you guys can get the kernel bits in place, I can take care of libseccomp.
Thanks - what (aside from my old patch) is still missing on the kernel side?
IIRC, it wasn't working well yet. Reading the archives, due to some incorrect return value somewhere?
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
Hi Geert,
Quoted 8 lines · Geert Uytterhoeven
Hi Michael,
Quoted 5 lines · Michael Schmitz
Quoted 4 lines · John Paul Adrian Glaubitz
Quoted 3 lines · Michael Schmitz
working on
entry.Srecently, I was reminded of this one. It's never been applied, and I can't find a trace of it in my tree.Not sure how far Adrian got with seccomp support testing, so I'm uncertain this is still of interest ...
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
I still have a fork of libseccomp with m68k support and my SH support patch was merged upstream.
So, if you guys can get the kernel bits in place, I can take care of libseccomp.
Thanks - what (aside from my old patch) is still missing on the kernel side?
IIRC, it wasn't working well yet. Reading the archives, due to some incorrect return value somewhere?
As I recall it, it wasn't clear what the correct return value should be. Seccomp uses -1 to signal syscall abort, but there is considerable variation among architectures about what signals a syscall abort. I've seen tests for return code > NR_syscalls, != 0, or == -1. Some architectures allow the return code to be used as the new syscall number (no idea how that works, with the argument list unchanged?).
But no matter - I'll change the test and resubmit.
Cheers,
Michael
Quoted 5 lines
Gr{oetje,eeting}s,
Geert
Re: [PATCH] m68k/kernel - wire up syscall_trace_enter/leave for m68k
In reply to John Paul Adrian GlaubitzHi Adrian,
the deeper I dig into kernel support for seccomp, the nastier it gets. Skipping a syscall after checks in syscall_trace_enter was just the easy part.
I now have something that compiles and survives a boot test on ARAnyM, but it's been entirely untested otherwise.
Will send v4 of the entry.S patch, and send the remaining seccomp stuff as a separate patch.
Cheers,
Michael
Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 3 lines · Michael Schmitz
working on
entry.Srecently, I was reminded of this one. It's never been applied, and I can't find a trace of it in my tree.Not sure how far Adrian got with seccomp support testing, so I'm uncertain this is still of interest ...
I still have a fork of libseccomp with m68k support and my SH support patch was merged upstream.
So, if you guys can get the kernel bits in place, I can take care of libseccomp.
Adrian
Greg Ungerer
maintainerHi Adrian,
Quoted 9 lines · John Paul Adrian Glaubitz
Hello!
Michael and I have been working on SECCOMP in SuperH and successfully added the missing pieces yesterday [1].
We're now looking into what needs to be done for m68k and I have noticed that
syscall_trace_enterandsyscall_trace_leave- which needs to be touched for SECCOMP support - are available on ColdFire and non-MMU targets for m68k.
Quoted 5 lines
Is there a particular reason for that? Looking at
68000/entry.S, I can see that both functions are invoked [2] so I'm not sure why they are built forCONFIG_COLDFIREand !CONFIG_MMM only.Any ideas?
I am late to the party on this.
But the reason is historical more than anything else.
The time that m68knommu, which included ColdFire, spent as its own architecture directory (arch/m68knommu) led to a few things like this diverging. There is not technical reason.
Regards
Greg
Quoted 5 lines
Adrian
Hi Greg!
Quoted 4 lines · Greg Ungerer
But the reason is historical more than anything else.
The time that m68knommu, which included ColdFire, spent as its own architecture directory (arch/m68knommu) led to a few things like this diverging. There is not technical reason.
That's what I was already suspecting after finding the commit that merged both into one directory :-).
Thanks for the confirmation.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913