Merge pull request #31230 from mrc0mmand/test-seccomp
process-util: use only the least significant byte from personality()
This commit is contained in:
@@ -1303,7 +1303,7 @@ int opinionated_personality(unsigned long *ret) {
|
||||
if (current < 0)
|
||||
return current;
|
||||
|
||||
if (((unsigned long) current & 0xffff) == PER_LINUX32)
|
||||
if (((unsigned long) current & OPINIONATED_PERSONALITY_MASK) == PER_LINUX32)
|
||||
*ret = PER_LINUX32;
|
||||
else
|
||||
*ret = PER_LINUX;
|
||||
|
||||
@@ -101,12 +101,17 @@ bool is_main_thread(void);
|
||||
bool oom_score_adjust_is_valid(int oa);
|
||||
|
||||
#ifndef PERSONALITY_INVALID
|
||||
/* personality(7) documents that 0xffffffffUL is used for querying the
|
||||
/* personality(2) documents that 0xFFFFFFFFUL is used for querying the
|
||||
* current personality, hence let's use that here as error
|
||||
* indicator. */
|
||||
#define PERSONALITY_INVALID 0xffffffffLU
|
||||
#define PERSONALITY_INVALID 0xFFFFFFFFUL
|
||||
#endif
|
||||
|
||||
/* The personality() syscall returns a 32-bit value where the top three bytes are reserved for flags that
|
||||
* emulate historical or architectural quirks, and only the least significant byte reflects the actual
|
||||
* personality we're interested in. */
|
||||
#define OPINIONATED_PERSONALITY_MASK 0xFFUL
|
||||
|
||||
unsigned long personality_from_string(const char *p);
|
||||
const char *personality_to_string(unsigned long);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user