From: Oleg Nesterov <oleg@redhat.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Borislav Petkov <bp@alien8.de>, Pedro Alves <palves@redhat.com>,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH v3 3/3] x86/ptrace, x86/signal: Remove TS_I386_REGS_POKED
Date: Thu, 23 Jun 2016 23:26:06 +0200 [thread overview]
Message-ID: <20160623212606.GB14180@redhat.com> (raw)
In-Reply-To: <9c5c3fd519dcc2e4596ecb074e1f8967f83080ef.1466464928.git.luto@kernel.org>
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.
> + /*
> + * 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".
Oleg.
next prev parent reply other threads:[~2016-06-23 21:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 23:39 [PATCH v3 0/3] ptrace-vs-syscall-restart fixes, v3 Andy Lutomirski
2016-06-20 23:39 ` [PATCH v3 1/3] x86/ptrace: Stop setting TS_COMPAT in ptrace code Andy Lutomirski
2016-06-22 22:13 ` Oleg Nesterov
2016-07-24 18:47 ` Andy Lutomirski
2016-07-25 6:38 ` Ingo Molnar
2016-07-25 16:38 ` Oleg Nesterov
2016-07-25 16:57 ` Andy Lutomirski
2016-07-26 0:21 ` Andy Lutomirski
2016-06-20 23:39 ` [PATCH v3 2/3] x86/signal: Rewire the restart_block() syscall to have a constant nr Andy Lutomirski
2016-06-21 12:39 ` Pedro Alves
2016-06-21 16:32 ` Andy Lutomirski
2016-06-22 12:00 ` Pedro Alves
2016-06-22 15:20 ` Andy Lutomirski
2016-06-23 21:21 ` Oleg Nesterov
2016-06-20 23:39 ` [PATCH v3 3/3] x86/ptrace, x86/signal: Remove TS_I386_REGS_POKED Andy Lutomirski
2016-06-23 21:26 ` Oleg Nesterov [this message]
2016-06-23 21:53 ` Andy Lutomirski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160623212606.GB14180@redhat.com \
--to=oleg@redhat.com \
--cc=bp@alien8.de \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=palves@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).