Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1430216
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 3/3] x86/ptrace, x86/signal: Remove TS_I386_REGS_POKED |
| Date | 2016-06-24 00:00 +0200 |
| Message-ID | <rNkPf-7CD-17@gated-at.bofh.it> (permalink) |
| References | <rMhqp-6JS-3@gated-at.bofh.it> <rMhqp-6JS-5@gated-at.bofh.it> <rNkmf-7qp-49@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jun 23, 2016 at 2:26 PM, Oleg Nesterov <oleg@redhat.com> wrote: > Again, I think the patch is fine, just a question > > On 06/20, Andy Lutomirski wrote: >> >> System call restart has some oddities wrt ptrace: >> >> 1. For whatever reason, the kernel delivers signals and triggers >> ptrace before handling syscall restart. This means that >> -ERESTART_RESTARTBLOCK, etc is visible to userspace. We could >> plausibly get away with changing that, but it seems quite risky. > > How we can change this? > > The kernel simply can't know how it should react to (say) -ERESTARTSYS > until debugger acks/nacks/changes the signal reported by tracee. Hmm, good point. I don't know whether our current behavior is fully correct or whether we could change it. > >> + /* >> + * A 32-bit ptracer has the following expectations: >> + * >> + * - Storing -1 (i.e. 0xffffffff) to orig_eax will prevent >> + * syscall restart handling. >> + * >> + * - Restoring regs saved on exit from an interrupted >> + * restartable syscall will trigger syscall restart. Such >> + * regs will have non-negative orig_eax and negative eax. >> + * >> + * The kernel's syscall restart code treats regs->orig_ax and >> + * regs->ax as 64-bit signed quantities. 32-bit user code >> + * doesn't care about the high bits. Keep it simple and just >> + * sign-extend both values. >> + */ >> + R32_SIGNED(orig_eax, orig_ax); >> + R32_SIGNED(eax, ax); > > OK. but do we really need R32_SIGNED(orig_eax) ? syscall_get_nr() > returns "int", not "long". Fair enough, maybe we don't. I'll drop that part and just keep R32_SIGNED(eax, ax). --Andy
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/3] ptrace-vs-syscall-restart fixes, v3 Andy Lutomirski <luto@kernel.org> - 2016-06-21 02:10 +0200
[PATCH v3 3/3] x86/ptrace, x86/signal: Remove TS_I386_REGS_POKED Andy Lutomirski <luto@kernel.org> - 2016-06-21 02:10 +0200
Re: [PATCH v3 3/3] x86/ptrace, x86/signal: Remove TS_I386_REGS_POKED Oleg Nesterov <oleg@redhat.com> - 2016-06-23 23:30 +0200
Re: [PATCH v3 3/3] x86/ptrace, x86/signal: Remove TS_I386_REGS_POKED Andy Lutomirski <luto@amacapital.net> - 2016-06-24 00:00 +0200
[PATCH v3 1/3] x86/ptrace: Stop setting TS_COMPAT in ptrace code Andy Lutomirski <luto@kernel.org> - 2016-06-21 02:10 +0200
Re: [PATCH v3 1/3] x86/ptrace: Stop setting TS_COMPAT in ptrace code Oleg Nesterov <oleg@redhat.com> - 2016-06-23 00:20 +0200
csiph-web