Skip to content

Commit 1ecff5e

Browse files
arndbMartin Schwidefsky
authored andcommitted
s390: open-code s390_personality syscall
Patch series "s390: rework compat wrapper generation". As promised, I gave this a go and changed the SYSCALL_DEFINEx() infrastructure to always include the wrappers for doing the 31-bit argument conversion on s390 compat mode. This does three main things: - The UID16 rework saved a lot of duplicated code, and would probably make sense by itself, but is also required as we can no longer call sys_*() functions directly after the last step. - Removing the compat_wrapper.c file is of course the main goal here, in order to remove the need to maintain the compat_wrapper.c file when new system calls get added. Unfortunately, this requires adding some complexity in syscall_wrapper.h, and trades a small reduction in source code lines for a small increase in binary size for unused wrappers. - As an added benefit, the use of syscall_wrapper.h now makes it easy to change the syscall wrappers so they no longer see all user space register contents, similar to changes done in commits fa69714 ("syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls") and 4378a7d ("arm64: implement syscall wrappers"). I leave the actual implementation of this for you, if you want to do it later. I did not test the changes at runtime, but I looked at the generated object code, which seems fine here and includes the same conversions as before. This patch(of 5): The sys_personality function is not meant to be called from other system calls. We could introduce an intermediate ksys_personality function, but it does almost nothing, so this just moves the implementation into the caller. Link: https://lore.kernel.org/lkml/20190116131527.2071570-1-arnd@arndb.de Link: https://lore.kernel.org/lkml/20190116131527.2071570-2-arnd@arndb.de Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 1c7fc5c commit 1ecff5e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/s390/kernel/sys_s390.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
7979

8080
SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
8181
{
82-
unsigned int ret;
82+
unsigned int ret = current->personality;
8383

8484
if (personality(current->personality) == PER_LINUX32 &&
8585
personality(personality) == PER_LINUX)
8686
personality |= PER_LINUX32;
87-
ret = sys_personality(personality);
87+
88+
if (personality != 0xffffffff)
89+
set_personality(personality);
90+
8891
if (personality(ret) == PER_LINUX32)
8992
ret &= ~PER_LINUX32;
9093

0 commit comments

Comments
 (0)