diff options
author | Johannes Berg <johannes.berg@intel.com> | 2021-01-13 22:09:42 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2021-02-12 21:34:33 +0100 |
commit | 84b2789d61156db0224724806b20110c0d34b07c (patch) | |
tree | 2af3dfceb3fb3fc0271c0cc742db74b9c10afffe /arch/um/kernel/skas/clone.c | |
parent | a7d48886cacf8b426e0079bca9639d2657cf2d38 (diff) | |
download | linux-84b2789d61156db0224724806b20110c0d34b07c.tar.gz linux-84b2789d61156db0224724806b20110c0d34b07c.tar.bz2 linux-84b2789d61156db0224724806b20110c0d34b07c.zip |
um: separate child and parent errors in clone stub
If the two are mixed up, then it looks as though the parent
returned an error if the child failed (before) the mmap(),
and then the resulting process never gets killed. Fix this
by splitting the child and parent errors, reporting and
using them appropriately.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/kernel/skas/clone.c')
-rw-r--r-- | arch/um/kernel/skas/clone.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c index bfb70c456b30..7c592c788cbf 100644 --- a/arch/um/kernel/skas/clone.c +++ b/arch/um/kernel/skas/clone.c @@ -24,29 +24,26 @@ void __attribute__ ((__section__ (".__syscall_stub"))) stub_clone_handler(void) { - struct stub_data *data = (struct stub_data *) STUB_DATA; + int stack; + struct stub_data *data = (void *) ((unsigned long)&stack & ~(UM_KERN_PAGE_SIZE - 1)); long err; err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, - STUB_DATA + UM_KERN_PAGE_SIZE / 2 - sizeof(void *)); - if (err != 0) - goto out; + (unsigned long)data + UM_KERN_PAGE_SIZE / 2 - sizeof(void *)); + if (err) { + data->parent_err = err; + goto done; + } err = stub_syscall4(__NR_ptrace, PTRACE_TRACEME, 0, 0, 0); - if (err) - goto out; + if (err) { + data->child_err = err; + goto done; + } remap_stack(data->fd, data->offset); goto done; - out: - /* - * save current result. - * Parent: pid; - * child: retcode of mmap already saved and it jumps around this - * assignment - */ - data->err = err; done: trap_myself(); } |