Skip to contentSkip to conversation

Make <linux/personality.h> userspace proof

PATCH In review Ralf Baechle 2 participants 3 messages Oct 17, 2006 – Oct 18, 2006 Personality handling

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make <linux/personality.h> userspace proof

<linux/personality.h> contains the constants for personality(2) but also some defintions that are useless or even harmful in userspace such as the personality() macro.

---
 include/linux/personality.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/personality.h +7 -0
index 80d780e..bf4cf20 100644
@@ -1,6 +1,8 @@
 #ifndef _LINUX_PERSONALITY_H
 #define _LINUX_PERSONALITY_H
 
+#ifdef __KERNEL__
+
 /*
  * Handling of different ABIs (personalities).
  */
@@ -12,6 +14,8 @@ extern int		register_exec_domain(struct 
 extern int		unregister_exec_domain(struct exec_domain *);
 extern int		__set_personality(unsigned long);
 
+#endif /* __KERNEL__ */
+
 /*
  * Flags for bug emulation.
  *
@@ -71,6 +75,7 @@ enum {
 	PER_MASK =		0x00ff,
 };
 
+#ifdef __KERNEL__
 
 /*
  * Description of an execution domain.
@@ -111,4 +116,6 @@ #define get_personality		(current->perso
 #define set_personality(pers) \
 	((current->personality == pers) ? 0 : __set_personality(pers))
 
+#endif /* __KERNEL__ */
+
 #endif /* _LINUX_PERSONALITY_H */
#1 lore raw
Quoted 3 lines · Ralf Baechle

<linux/personality.h> contains the constants for personality(2) but also some defintions that are useless or even harmful in userspace such as the personality() macro.

NACK. glibc has a <sys/personality.h> for that. It's been there since at least glibc 2.3.

#2 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Ralf Baechle

<linux/personality.h> contains the constants for personality(2) but also some defintions that are useless or even harmful in userspace such as the personality() macro.

NACK. glibc has a <sys/personality.h> for that. It's been there since at least glibc 2.3.

And I ran over this on a glibc 2.2 system ...

Ralf