properly support exec and wait with kernel pointers v2

2020-06-18 Thread Christoph Hellwig
Hi all,

this series first cleans up the exec code and then adds proper
kernel_execveat and kernel_wait callers instead of relying on the fact
that the early init code and kernel threads implicitly run with
the address limit set to KERNEL_DS.

Note that the cleanup removes the compat execve(at) handlers entirely, as
we can handle the compat difference very nicely in a unified codebase.
x32 needs two hacky #defines for that for now, although those can go
away if the x32 syscall rework from Brian gets merged.

Changes since v1:
 - remove a pointless ifdef from get_user_arg_ptr
 - remove the need for a compat syscall handler for x32


Diffstat:
 arch/arm64/include/asm/unistd32.h  |4 
 arch/mips/kernel/syscalls/syscall_n32.tbl  |4 
 arch/mips/kernel/syscalls/syscall_o32.tbl  |4 
 arch/parisc/kernel/syscalls/syscall.tbl|4 
 arch/powerpc/kernel/syscalls/syscall.tbl   |4 
 arch/s390/kernel/syscalls/syscall.tbl  |4 
 arch/sparc/kernel/syscalls.S   |4 
 arch/x86/entry/syscall_x32.c   |7 
 arch/x86/entry/syscalls/syscall_32.tbl |4 
 arch/x86/entry/syscalls/syscall_64.tbl |4 
 fs/exec.c  |  248 -
 include/linux/binfmts.h|   10 
 include/linux/compat.h |7 
 include/linux/sched/task.h |1 
 include/uapi/asm-generic/unistd.h  |4 
 init/main.c|5 
 kernel/exit.c  |   16 +
 kernel/umh.c   |   43 ---
 tools/include/uapi/asm-generic/unistd.h|4 
 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl |4 
 tools/perf/arch/s390/entry/syscalls/syscall.tbl|4 
 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl  |4 
 22 files changed, 170 insertions(+), 223 deletions(-)


Re: properly support exec and wait with kernel pointers

2020-06-15 Thread Arnd Bergmann
On Mon, Jun 15, 2020 at 3:00 PM Christoph Hellwig  wrote:
>
> Hi all,
>
> this series first cleans up the exec code and then adds proper
> kernel_execveat and kernel_wait callers instead of relying on the fact
> that the early init code and kernel threads implicitly run with
> the address limit set to KERNEL_DS.
>
> Note that the cleanup removes the compat execve(at) handlers (almost)
> entirely, as we can handle the compat difference very nicely in a
> unified codebase.  The only exception is x86 where this would list the
> handlers twice in the same syscall table due to the messed up x32
> design.  I had to add an extra compat handler just for that case, but
> maybe someone has a better idea.

I looked at all the patches and I like it a lot. I replied with some suggestions
for x32, but maybe I misunderstood what its problem is, as I don't see
anything preventing us from having two entries in the x32 table pointing
to the same function.

   Arnd


properly support exec and wait with kernel pointers

2020-06-15 Thread Christoph Hellwig
Hi all,

this series first cleans up the exec code and then adds proper
kernel_execveat and kernel_wait callers instead of relying on the fact
that the early init code and kernel threads implicitly run with
the address limit set to KERNEL_DS.

Note that the cleanup removes the compat execve(at) handlers (almost)
entirely, as we can handle the compat difference very nicely in a
unified codebase.  The only exception is x86 where this would list the
handlers twice in the same syscall table due to the messed up x32
design.  I had to add an extra compat handler just for that case, but
maybe someone has a better idea.