core: add Personality= option for units to set the personality for spawned processes
This commit is contained in:
@@ -133,6 +133,9 @@ const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) {
|
||||
|
||||
case EXIT_SELINUX_CONTEXT:
|
||||
return "SELINUX_CONTEXT";
|
||||
|
||||
case EXIT_PERSONALITY:
|
||||
return "PERSONALITY";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,8 @@ typedef enum ExitStatus {
|
||||
EXIT_NAMESPACE,
|
||||
EXIT_NO_NEW_PRIVILEGES,
|
||||
EXIT_SECCOMP,
|
||||
EXIT_SELINUX_CONTEXT
|
||||
EXIT_SELINUX_CONTEXT,
|
||||
EXIT_PERSONALITY /* 230 */
|
||||
} ExitStatus;
|
||||
|
||||
typedef enum ExitStatusLevel {
|
||||
|
||||
+20
-1
@@ -6194,7 +6194,7 @@ int fd_warn_permissions(const char *path, int fd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long parse_personality(const char *p) {
|
||||
unsigned long personality_from_string(const char *p) {
|
||||
|
||||
/* Parse a personality specifier. We introduce our own
|
||||
* identifiers that indicate specific ABIs, rather than just
|
||||
@@ -6222,3 +6222,22 @@ unsigned long parse_personality(const char *p) {
|
||||
* as error indicator. */
|
||||
return 0xffffffffUL;
|
||||
}
|
||||
|
||||
const char* personality_to_string(unsigned long p) {
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
||||
if (p == PER_LINUX32)
|
||||
return "x86";
|
||||
|
||||
if (p == PER_LINUX)
|
||||
return "x86-64";
|
||||
|
||||
#elif defined(__i386__)
|
||||
|
||||
if (p == PER_LINUX)
|
||||
return "x86";
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+2
-1
@@ -871,4 +871,5 @@ int open_tmpfile(const char *path, int flags);
|
||||
|
||||
int fd_warn_permissions(const char *path, int fd);
|
||||
|
||||
unsigned long parse_personality(const char *p);
|
||||
unsigned long personality_from_string(const char *p);
|
||||
const char *personality_to_string(unsigned long);
|
||||
|
||||
Reference in New Issue
Block a user