Skip to contentSkip to conversation

sys_personality: Streamline code in sys_personality()

PATCH In review Wang ShaoBo 3 participants 3 messages Nov 26, 2019 – Nov 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sys_personality: Streamline code in sys_personality()

SYSCALL_DEFINE1 in kernel/exec_domain.c looks like verbose, ksys_personality() can make it more concise.

---
 kernel/exec_domain.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/exec_domain.c +1 -6
index 33f07c5f2515..f7a0512ddc23 100644
@@ -37,10 +37,5 @@ module_init(proc_execdomains_init);
 
 SYSCALL_DEFINE1(personality, unsigned int, personality)
 {
-	unsigned int old = current->personality;
-
-	if (personality != 0xffffffff)
-		set_personality(personality);
-
-	return old;
+	return ksys_personality(personality);
 }
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Wang ShaoBo

SYSCALL_DEFINE1 in kernel/exec_domain.c looks like verbose, ksys_personality() can make it more concise.

FWIW, this looks fine to me:

I'm not sure why I didn't do this initially; adding Christoph in case he has any comments.

Mark.

Quoted 23 lines
---
 kernel/exec_domain.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/exec_domain.c +1 -6
index 33f07c5f2515..f7a0512ddc23 100644
@@ -37,10 +37,5 @@ module_init(proc_execdomains_init);
 
 SYSCALL_DEFINE1(personality, unsigned int, personality)
 {
-	unsigned int old = current->personality;
-
-	if (personality != 0xffffffff)
-		set_personality(personality);
-
-	return old;
+	return ksys_personality(personality);
 }
Signature · 1 line
2.20.1
#2 lore raw
In reply to Wang ShaoBo
Quoted 2 lines · Wang ShaoBo

SYSCALL_DEFINE1 in kernel/exec_domain.c looks like verbose, ksys_personality() can make it more concise.

What do you try to say with this sentence? I can't really parse it.

kernel/exec_domain.c module_init(proc_execdomains_init); · line 40

Quoted 13 lines
kernel/exec_domain.c +1 -6
@@ -37,10 +37,5 @@ module_init(proc_execdomains_init);
 
 SYSCALL_DEFINE1(personality, unsigned int, personality)
 {
-	unsigned int old = current->personality;
-
-	if (personality != 0xffffffff)
-		set_personality(personality);
-
-	return old;
+	return ksys_personality(personality);

This looks ok, but I'd much rather just kill ksys_personality and add an optional arch hook to reject personality settings for the arm64 special case.