Skip to content

Commit 7938381

Browse files
committed
prctl: Disable prctl(PR_SET_MDWE) on parisc
systemd-254 tries to use prctl(PR_SET_MDWE) for it's MemoryDenyWriteExecute functionality, but fails on parisc which still needs executable stacks in certain combinations of gcc/glibc/kernel. Disable prctl(PR_SET_MDWE) by returning -EINVAL for now on parisc, until userspace has catched up. Signed-off-by: Helge Deller <deller@gmx.de> Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org> Reported-by: Sam James <sam@gentoo.org> Closes: systemd/systemd#29775 Tested-by: Sam James <sam@gentoo.org> Link: https://lore.kernel.org/all/875y2jro9a.fsf@gentoo.org/ Cc: <stable@vger.kernel.org> # v6.3+
1 parent 6ad6e15 commit 7938381

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/sys.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,6 +2394,10 @@ static inline int prctl_set_mdwe(unsigned long bits, unsigned long arg3,
23942394
if (bits & PR_MDWE_NO_INHERIT && !(bits & PR_MDWE_REFUSE_EXEC_GAIN))
23952395
return -EINVAL;
23962396

2397+
/* PARISC cannot allow mdwe as it needs writable stacks */
2398+
if (IS_ENABLED(CONFIG_PARISC))
2399+
return -EINVAL;
2400+
23972401
current_bits = get_current_mdwe();
23982402
if (current_bits && current_bits != bits)
23992403
return -EPERM; /* Cannot unset the flags */

0 commit comments

Comments
 (0)