Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1485077
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/7] Apply transparent_union attribute to union semun |
| Date | 2016-09-16 16:50 +0200 |
| Message-ID | <si2CK-608-31@gated-at.bofh.it> (permalink) |
| References | <si2CJ-608-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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;
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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