From: Andy Lutomirski <luto@amacapital.net>
To: Philipp Kern <pkern@google.com>, hpa@linux.intel.com
Cc: linux-kernel@vger.kernel.org, "H. J. Lu" <hjl.tools@gmail.com>,
Eric Paris <eparis@redhat.com>
Subject: Re: [PATCH] x32: Mask away the x32 syscall bit in the ptrace codepath
Date: Wed, 28 May 2014 13:47:34 -0700 [thread overview]
Message-ID: <53864B66.8030100@amacapital.net> (raw)
In-Reply-To: <1401279583-1027-1-git-send-email-pkern@google.com>
On 05/28/2014 05:19 AM, Philipp Kern wrote:
> audit_filter_syscall uses the syscall number to reference into a
> bitmask (e->rule.mask[word]). Not removing the x32 bit before passing
> the number to this architecture independent codepath will fail to
> lookup the proper audit bit. Furthermore it will cause an invalid memory
> access in the kernel if the out of bound location is not mapped:
>
> BUG: unable to handle kernel paging request at ffff8800e5446630
> IP: [<ffffffff810fcdd0>] audit_filter_syscall+0x90/0xf0
>
> Together with the entrypoint in entry_64.S this change causes x32
> programs to pass in both AUDIT_ARCH_X86_64 and AUDIT_ARCH_I386 depending
> on the syscall path.
>
> Cc: linux-kernel@vger.kernel.org
> Cc: H. J. Lu <hjl.tools@gmail.com>
> Cc: Eric Paris <eparis@redhat.com>
> Signed-off-by: Philipp Kern <pkern@google.com>
> ---
> arch/x86/kernel/ptrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
> index 678c0ad..166a3c7 100644
> --- a/arch/x86/kernel/ptrace.c
> +++ b/arch/x86/kernel/ptrace.c
> @@ -1489,7 +1489,7 @@ long syscall_trace_enter(struct pt_regs *regs)
>
> if (IS_IA32)
> audit_syscall_entry(AUDIT_ARCH_I386,
> - regs->orig_ax,
> + regs->orig_ax & __SYSCALL_MASK,
This is weird. Three questions:
1. How can this happen? I thought that x32 syscalls always came in
through the syscall path, which doesn't set is_compat_task. (Can
someone rename is_compat_task to in_compat_syscall? Pretty please?)
2. Now audit can't tell whether a syscall is x32 or i386. And audit is
inconsistent with seccomp. This seems wrong.
3. The OOPS you're fixing doesn't seem like it's fixed. What if some
other random high bits are set?
--Andy
next prev parent reply other threads:[~2014-05-28 20:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-28 12:19 [PATCH] x32: Mask away the x32 syscall bit in the ptrace codepath Philipp Kern
2014-05-28 20:47 ` Andy Lutomirski [this message]
2014-05-28 20:58 ` Philipp Kern
2014-05-28 21:01 ` H. Peter Anvin
2014-05-28 21:15 ` Andy Lutomirski
2014-05-28 21:19 ` H. Peter Anvin
2014-05-28 21:43 ` Andy Lutomirski
2014-05-28 21:53 ` Philipp Kern
2014-05-28 21:55 ` Andy Lutomirski
2014-05-28 22:37 ` H. Peter Anvin
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=53864B66.8030100@amacapital.net \
--to=luto@amacapital.net \
--cc=eparis@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=hpa@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pkern@google.com \
/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