lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250103140148.370368-1-glaubitz@physik.fu-berlin.de>
Date: Fri,  3 Jan 2025 15:01:46 +0100
From: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
To: Richard Henderson <richard.henderson@...aro.org>,
	Matt Turner <mattst88@...il.com>,
	Eric Biederman <ebiederm@...ssion.com>,
	Kees Cook <kees@...nel.org>,
	Arnd Bergmann <arnd@...db.de>,
	John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
	"Paul E. McKenney" <paulmck@...nel.org>,
	linux-alpha@...r.kernel.org,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Cc: Michael Cree <mcree@...on.net.nz>,
	Sam James <sam@...too.org>,
	"Maciej W . Rozycki" <macro@...am.me.uk>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Michael Karcher <kernel@...rcher.dialup.fu-berlin.de>,
	Chris Hofstaedtler <zeha@...ian.org>,
	util-linux@...r.kernel.org
Subject: [PATCH] alpha: Fix personality flag propagation across an exec

It was observed that on alpha, the misc/setarch test of
the util-linux testsuite failed with the following error:

   misc: setarch                        ...
          : options                     ... OK
          : uname26                     ... OK
          : uname26-version             ... FAILED (misc/setarch-uname26-version)
          : show                        ... OK
     ... FAILED (1 from 4 sub-tests)

Running the setarch binary manually confirmed that setting
the kernel version with the help --uname-2.6 flag does not
work and the version remains unchanged.

It turned out that on alpha, the personality flags are not
propagated but overridden during an exec. The same issue was
previously fixed on arm in commit 5e143436d044 ("ARM: 6878/1:
fix personality flag propagation across an exec") and on powerpc
in commit a91a03ee31a5 ("powerpc: Keep 3 high personality bytes
across exec"). This patch fixes the issue on alpha.

With the patch applied, the misc/setarch test succeeds on
alpha as expected:

   misc: setarch                        ...
          : options                     ... OK
          : uname26                     ... OK
          : uname26-version             ... OK
          : show                        ... OK
     ... OK (all 4 sub-tests PASSED)

However, as a side-effect, a warning is printed on the kernel
message buffer which might indicate another unreleated bug:

[   39.964823] pid=509, couldn't seal address 0, ret=-12.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
---
 arch/alpha/include/asm/elf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/alpha/include/asm/elf.h b/arch/alpha/include/asm/elf.h
index 4d7c46f50382..81f8473bb7c0 100644
--- a/arch/alpha/include/asm/elf.h
+++ b/arch/alpha/include/asm/elf.h
@@ -138,8 +138,8 @@ extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
 })
 
 #define SET_PERSONALITY(EX)					\
-	set_personality(((EX).e_flags & EF_ALPHA_32BIT)		\
-	   ? PER_LINUX_32BIT : PER_LINUX)
+	set_personality((((EX).e_flags & EF_ALPHA_32BIT)	\
+	   ? PER_LINUX_32BIT : PER_LINUX) | (current->personality & (~PER_MASK)))
 
 extern int alpha_l1i_cacheshape;
 extern int alpha_l1d_cacheshape;
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ