mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: Richard Henderson <richard.henderson@linaro.org>,
	Matt Turner <mattst88@gmail.com>,
	Eric Biederman <ebiederm@xmission.com>,
	Kees Cook <kees@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	linux-alpha@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Cc: Michael Cree <mcree@orcon.net.nz>, Sam James <sam@gentoo.org>,
	"Maciej W . Rozycki" <macro@orcam.me.uk>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>,
	Chris Hofstaedtler <zeha@debian.org>,
	util-linux@vger.kernel.org
Subject: [PATCH] alpha: Fix personality flag propagation across an exec
Date: Fri,  3 Jan 2025 15:01:46 +0100	[thread overview]
Message-ID: <20250103140148.370368-1-glaubitz@physik.fu-berlin.de> (raw)

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@physik.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


             reply	other threads:[~2025-01-03 14:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03 14:01 John Paul Adrian Glaubitz [this message]
2025-01-08 22:49 ` Kees Cook
2025-01-09  0:52   ` Jeff Xu
2025-01-09  8:01 ` Arnd Bergmann
2025-01-09  8:43   ` Arnd Bergmann
2025-01-09  8:46     ` John Paul Adrian Glaubitz
2025-01-09  8:56       ` Arnd Bergmann
2025-01-09  9:12         ` John Paul Adrian Glaubitz
2025-01-09 16:18           ` Eric W. Biederman
2025-01-09 16:52             ` Arnd Bergmann
2025-01-09 17:17               ` Eric W. Biederman
2025-01-09 20:10             ` Maciej W. Rozycki
2025-01-09 20:53               ` Arnd Bergmann
2025-01-12 14:40                 ` Maciej W. Rozycki
2025-01-11  0:16           ` [PATCH] alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support Eric W. Biederman
2025-01-11  1:17             ` Richard Henderson
2025-01-11 10:37             ` John Paul Adrian Glaubitz
2025-01-12 14:40               ` Maciej W. Rozycki
2025-01-12 14:56                 ` John Paul Adrian Glaubitz
2025-01-13  5:39                   ` [PATCH v2] " Eric W. Biederman
2025-01-18 10:35                     ` Ivan Kokshaysky
2025-01-26 17:15                       ` John Paul Adrian Glaubitz
2025-01-27 13:27                         ` Ivan Kokshaysky
2025-02-03 11:55                     ` John Paul Adrian Glaubitz
2025-02-06 15:42                     ` Kees Cook
2025-01-11 11:26             ` [PATCH] " Arnd Bergmann
2025-01-11 15:27             ` Ivan Kokshaysky
2025-01-13  5:32               ` Eric W. Biederman
2025-01-11 21:26             ` John Paul Adrian Glaubitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250103140148.370368-1-glaubitz@physik.fu-berlin.de \
    --to=glaubitz@physik.fu-berlin.de \
    --cc=arnd@arndb.de \
    --cc=ebiederm@xmission.com \
    --cc=geert@linux-m68k.org \
    --cc=kees@kernel.org \
    --cc=kernel@mkarcher.dialup.fu-berlin.de \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=macro@orcam.me.uk \
    --cc=mattst88@gmail.com \
    --cc=mcree@orcon.net.nz \
    --cc=paulmck@kernel.org \
    --cc=richard.henderson@linaro.org \
    --cc=sam@gentoo.org \
    --cc=util-linux@vger.kernel.org \
    --cc=zeha@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®