lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 1 May 2021 12:31:10 +0200
From:   Marco Elver <elver@...gle.com>
To:     "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     Arnd Bergmann <arnd@...db.de>, Florian Weimer <fweimer@...hat.com>,
        "David S. Miller" <davem@...emloft.net>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Peter Collingbourne <pcc@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Alexander Potapenko <glider@...gle.com>,
        sparclinux <sparclinux@...r.kernel.org>,
        linux-arch <linux-arch@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux API <linux-api@...r.kernel.org>,
        kasan-dev <kasan-dev@...glegroups.com>
Subject: Re: [PATCH 1/3] siginfo: Move si_trapno inside the union inside _si_fault

On Sat, 1 May 2021 at 00:50, Eric W. Biederman <ebiederm@...ssion.com> wrote:
>
> It turns out that linux uses si_trapno very sparingly, and as such it
> can be considered extra information for a very narrow selection of
> signals, rather than information that is present with every fault
> reported in siginfo.
>
> As such move si_trapno inside the union inside of _si_fault.  This
> results in no change in placement, and makes it eaiser to extend
> _si_fault in the future as this reduces the number of special cases.
> In particular with si_trapno included in the union it is no longer a
> concern that the union must be pointer alligned on most architectures
> because the union followes immediately after si_addr which is a
> pointer.
>

Maybe add "Link:
https://lkml.kernel.org/r/CAK8P3a0+uKYwL1NhY6Hvtieghba2hKYGD6hcKx5n8=4Gtt+pHA@mail.gmail.com"

> Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>

Acked-by: Marco Elver <elver@...gle.com>

By no longer guarding it with __ARCH_SI_TRAPNO we run the risk that it
will be used by something else at some point. Is that intentional?

Thanks,
-- Marco

> ---
>  include/linux/compat.h             | 4 +---
>  include/uapi/asm-generic/siginfo.h | 6 +-----
>  2 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/compat.h b/include/linux/compat.h
> index f0d2dd35d408..24462ed63af4 100644
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -214,12 +214,10 @@ typedef struct compat_siginfo {
>                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
>                 struct {
>                         compat_uptr_t _addr;    /* faulting insn/memory ref. */
> -#ifdef __ARCH_SI_TRAPNO
> -                       int _trapno;    /* TRAP # which caused the signal */
> -#endif
>  #define __COMPAT_ADDR_BND_PKEY_PAD  (__alignof__(compat_uptr_t) < sizeof(short) ? \
>                                      sizeof(short) : __alignof__(compat_uptr_t))
>                         union {
> +                               int _trapno;    /* TRAP # which caused the signal */
>                                 /*
>                                  * used when si_code=BUS_MCEERR_AR or
>                                  * used when si_code=BUS_MCEERR_AO
> diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h
> index 03d6f6d2c1fe..2abdf1d19aad 100644
> --- a/include/uapi/asm-generic/siginfo.h
> +++ b/include/uapi/asm-generic/siginfo.h
> @@ -63,9 +63,6 @@ union __sifields {
>         /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
>         struct {
>                 void __user *_addr; /* faulting insn/memory ref. */
> -#ifdef __ARCH_SI_TRAPNO
> -               int _trapno;    /* TRAP # which caused the signal */
> -#endif
>  #ifdef __ia64__
>                 int _imm;               /* immediate value for "break" */
>                 unsigned int _flags;    /* see ia64 si_flags */
> @@ -75,6 +72,7 @@ union __sifields {
>  #define __ADDR_BND_PKEY_PAD  (__alignof__(void *) < sizeof(short) ? \
>                               sizeof(short) : __alignof__(void *))
>                 union {
> +                       int _trapno;    /* TRAP # which caused the signal */
>                         /*
>                          * used when si_code=BUS_MCEERR_AR or
>                          * used when si_code=BUS_MCEERR_AO
> @@ -150,9 +148,7 @@ typedef struct siginfo {
>  #define si_int         _sifields._rt._sigval.sival_int
>  #define si_ptr         _sifields._rt._sigval.sival_ptr
>  #define si_addr                _sifields._sigfault._addr
> -#ifdef __ARCH_SI_TRAPNO
>  #define si_trapno      _sifields._sigfault._trapno
> -#endif
>  #define si_addr_lsb    _sifields._sigfault._addr_lsb
>  #define si_lower       _sifields._sigfault._addr_bnd._lower
>  #define si_upper       _sifields._sigfault._addr_bnd._upper
> --
> 2.30.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ