Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486553

Re: [PATCH 1/7] Apply transparent_union attribute to union semun

From Stafford Horne <shorne@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/7] Apply transparent_union attribute to union semun
Date 2016-09-19 16:50 +0200
Message-ID <sj83o-6ES-13@gated-at.bofh.it> (permalink)
References <si2CJ-608-3@gated-at.bofh.it> <si2CK-608-31@gated-at.bofh.it> <sj83o-6ES-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Mon, 19 Sep 2016, Jonas Bonn wrote:

> NAK... this breaks other architectures.
>
> The OpenRISC toolchain is broken with regard to this issue.  Five years ago 
> (last I looked) nobody seemed interesting in fixing it. Has anything changed 
> here?

Hi Jonas,

This was also pointed out by the automated kbuild system and I replied on 
it. I am currently looking at a possible fix of adding an abi compat layer 
similar to what arm does with 'arch/arm/kernel/sys_oabi-compat.c'.

By toolchain being broken do you mean the openrisc abi spec is broken as 
well?  Last I checked gcc does compile as per the spec.  But it is not a 
very good spec.  There have been discussions to change this as well but no 
progress.

-Stafford

> On 09/16/2016 04:42 PM, Stafford Horne wrote:
>>  ..From: Jonas Bonn <jonas@southpole.se>
>>
>>  The syscall handler for semctl is written under the assumption that the
>>  toolchain will pass "small" unions as function parameters directly instead
>>  of by reference.  The union semun is "small" and thus fits this
>>  description.
>>
>>  Since it is assumed that the union will be passed directly and not by
>>  reference, it is safe to access the union members without going via
>>  get_user.
>>
>>  The OpenRISC architecture, however, passes all unions by reference, thus
>>  breaking the above assumption.
>>
>>  The technically correct fix here is to mark the union as being transparent
>>  so that the ABI of the union's first element determines the parameter
>>  passing method and thus make explicit what's already implied in the
>>  function
>>  definition.
>>
>>  Signed-off-by: Jonas Bonn <jonas@southpole.se>
>>  Signed-off-by: Stafford Horne <shorne@gmail.com>
>>  ---
>>    include/uapi/linux/sem.h | 2 +-
>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>  diff --git a/include/uapi/linux/sem.h b/include/uapi/linux/sem.h
>>  index dd73b90..aabe50f 100644
>>  --- a/include/uapi/linux/sem.h
>>  +++ b/include/uapi/linux/sem.h
>>  @@ -48,7 +48,7 @@ union semun {
>>     unsigned short __user *array;	/* array for GETALL & SETALL */
>>     struct seminfo __user *__buf;	/* buffer for IPC_INFO */
>>     void __user *__pad;
>>  -};
>>  +} __attribute__ ((transparent_union));
>>
>>    struct  seminfo {
>>     int semmap;
>
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] openrisc: Misc fixes from backlog Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
  [PATCH 6/7] openrisc: add SMP and NR_CPUS Kconfig options Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
    Re: [PATCH 6/7] openrisc: add SMP and NR_CPUS Kconfig options Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:40 +0200
      Re: [PATCH 6/7] openrisc: add SMP and NR_CPUS Kconfig options Stafford Horne <shorne@gmail.com> - 2016-09-19 17:00 +0200
  [PATCH 3/7] openrisc: restore call-saved regs on sigreturn Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
    Re: [PATCH 3/7] openrisc: restore call-saved regs on sigreturn Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:50 +0200
      Re: [PATCH 3/7] openrisc: restore call-saved regs on sigreturn Stafford Horne <shorne@gmail.com> - 2016-09-19 17:00 +0200
  [PATCH 7/7] openrisc: remove the redundant of_platform_populate Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
    Re: [PATCH 7/7] openrisc: remove the redundant of_platform_populate Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:40 +0200
      Re: [PATCH 7/7] openrisc: remove the redundant  of_platform_populate Stafford Horne <shorne@gmail.com> - 2016-09-19 17:00 +0200
      Re: [PATCH 7/7] openrisc: remove the redundant of_platform_populate Rob Herring <robh@kernel.org> - 2016-09-19 18:20 +0200
  [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
    Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-18 17:30 +0200
      Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 08:10 +0200
        Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 09:20 +0200
          Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 11:20 +0200
            Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 15:20 +0200
              Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 16:10 +0200
                Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:40 +0200
                Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 17:00 +0200
                Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 17:20 +0200
                Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 16:50 +0200
                Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k)  toolchain Stafford Horne <shorne@gmail.com> - 2016-09-20 12:10 +0200
  [PATCH 1/7] Apply transparent_union attribute to union semun Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
    Re: [PATCH 1/7] Apply transparent_union attribute to union semun kbuild test robot <lkp@intel.com> - 2016-09-16 18:00 +0200
    Re: [PATCH 1/7] Apply transparent_union attribute to union semun kbuild test robot <lkp@intel.com> - 2016-09-17 01:40 +0200
      Re: [PATCH 1/7] Apply transparent_union attribute to union semun Stafford Horne <shorne@gmail.com> - 2016-09-17 02:10 +0200
    Re: [PATCH 1/7] Apply transparent_union attribute to union semun Stafford Horne <shorne@gmail.com> - 2016-09-19 16:50 +0200
    Re: [PATCH 1/7] Apply transparent_union attribute to union semun Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:50 +0200
  Re: [PATCH 0/7] openrisc: Misc fixes from backlog Stafford Horne <shorne@gmail.com> - 2016-09-16 17:00 +0200

csiph-web