linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Will Drewry <wad@chromium.org>,
	strosake@linux.vnet.ibm.com, bogdan.purcareata@freescale.com
Subject: Re: [PATCH 08/11] powerpc/kernel: Add SIG_SYS support for compat tasks
Date: Mon, 27 Jul 2015 11:54:24 -0700	[thread overview]
Message-ID: <CAGXu5jJemqAOS1QS=tGFqaxTDN48f45C-O-Ca-AF83N0pFU9Vg@mail.gmail.com> (raw)
In-Reply-To: <1437646871-3195-8-git-send-email-mpe@ellerman.id.au>

On Thu, Jul 23, 2015 at 3:21 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> SIG_SYS was added in commit a0727e8ce513 "signal, x86: add SIGSYS info
> and make it synchronous."
>
> Because we use the asm-generic struct siginfo, we got support for
> SIG_SYS for free as part of that commit.
>
> However there was no compat handling added for powerpc. That means we've
> been advertising the existence of signfo._sifields._sigsys to compat
> tasks, but not actually filling in the fields correctly.
>
> Luckily it looks like no one has noticed, presumably because the only
> user of SIGSYS in the kernel is seccomp filter, which we don't support
> yet.
>
> So before we enable seccomp filter, add compat handling for SIGSYS.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  arch/powerpc/include/asm/compat.h | 7 +++++++
>  arch/powerpc/kernel/signal_32.c   | 5 +++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
> index b142b8e0ed9e..4f2df589ec1d 100644
> --- a/arch/powerpc/include/asm/compat.h
> +++ b/arch/powerpc/include/asm/compat.h
> @@ -174,6 +174,13 @@ typedef struct compat_siginfo {
>                         int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
>                         int _fd;
>                 } _sigpoll;
> +
> +               /* SIGSYS */
> +               struct {
> +                       unsigned int _call_addr; /* calling insn */
> +                       int _syscall;            /* triggering system call number */
> +                       unsigned int _arch;      /* AUDIT_ARCH_* of syscall */
> +               } _sigsys;
>         } _sifields;
>  } compat_siginfo_t;
>
> diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
> index d3a831ac0f92..77f97284124e 100644
> --- a/arch/powerpc/kernel/signal_32.c
> +++ b/arch/powerpc/kernel/signal_32.c
> @@ -949,6 +949,11 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s)
>                 err |= __put_user(s->si_overrun, &d->si_overrun);
>                 err |= __put_user(s->si_int, &d->si_int);
>                 break;
> +       case __SI_SYS >> 16:
> +               err |= __put_user(ptr_to_compat(s->si_call_addr), &d->si_call_addr);
> +               err |= __put_user(s->si_syscall, &d->si_syscall);
> +               err |= __put_user(s->si_arch, &d->si_arch);
> +               break;
>         case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
>         case __SI_MESGQ >> 16:
>                 err |= __put_user(s->si_int, &d->si_int);
> --
> 2.1.0
>



-- 
Kees Cook
Chrome OS Security

  reply	other threads:[~2015-07-27 18:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 10:21 [PATCH 01/11] powerpc/kernel: Switch to using MAX_ERRNO Michael Ellerman
2015-07-23 10:21 ` [PATCH 02/11] powerpc/kernel: Change the do_syscall_trace_enter() API Michael Ellerman
2015-07-27 18:48   ` Kees Cook
2015-07-23 10:21 ` [PATCH 03/11] powerpc: Drop unused syscall_get_error() Michael Ellerman
2015-07-27 18:48   ` Kees Cook
2015-07-23 10:21 ` [PATCH 04/11] powerpc: Don't negate error in syscall_set_return_value() Michael Ellerman
2015-07-27 18:49   ` Kees Cook
2015-07-23 10:21 ` [PATCH 05/11] powerpc: Rework syscall_get_arguments() so there is only one loop Michael Ellerman
2015-07-27 18:50   ` Kees Cook
2015-07-23 10:21 ` [PATCH 06/11] powerpc: Use orig_gpr3 in syscall_get_arguments() Michael Ellerman
2015-07-27 18:52   ` Kees Cook
2015-07-23 10:21 ` [PATCH 07/11] powerpc: Change syscall_get_nr() to return int Michael Ellerman
2015-07-27 18:53   ` Kees Cook
2015-07-23 10:21 ` [PATCH 08/11] powerpc/kernel: Add SIG_SYS support for compat tasks Michael Ellerman
2015-07-27 18:54   ` Kees Cook [this message]
2015-07-23 10:21 ` [PATCH 09/11] powerpc/kernel: Enable seccomp filter Michael Ellerman
2015-07-27 18:56   ` Kees Cook
2015-07-30  5:56   ` [PATCH v2] " Michael Ellerman
2015-07-30 16:39     ` Kees Cook
2015-07-23 10:21 ` [PATCH 10/11] selftests/seccomp: Make seccomp tests work on big endian Michael Ellerman
2015-07-27 18:57   ` Kees Cook
2015-07-23 10:21 ` [PATCH 11/11] selftests/seccomp: Add powerpc support Michael Ellerman
2015-07-27 18:59   ` Kees Cook
2015-07-28 12:18     ` Michael Ellerman
2015-07-27 18:45 ` [PATCH 01/11] powerpc/kernel: Switch to using MAX_ERRNO Kees Cook

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='CAGXu5jJemqAOS1QS=tGFqaxTDN48f45C-O-Ca-AF83N0pFU9Vg@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=bogdan.purcareata@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=luto@amacapital.net \
    --cc=mpe@ellerman.id.au \
    --cc=strosake@linux.vnet.ibm.com \
    --cc=wad@chromium.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).