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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 28 Aug 2012 11:49:52 -0700 (PDT)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Chris Metcalf <cmetcalf@...era.com>
Cc:	Arnd Bergmann <arnd@...db.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Haavard Skinnemoen <hskinnemoen@...il.com>,
	Hans-Christian Egtvedt <egtvedt@...fundet.no>,
	Mike Frysinger <vapier@...too.org>,
	Mark Salter <msalter@...hat.com>,
	Mikael Starvik <starvik@...s.com>,
	Jesper Nilsson <jesper.nilsson@...s.com>,
	David Howells <dhowells@...hat.com>,
	Yoshinori Sato <ysato@...rs.sourceforge.jp>,
	Richard Kuo <rkuo@...eaurora.org>,
	Hirokazu Takata <takata@...ux-m32r.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Michal Simek <monstr@...str.eu>,
	Koichi Yasutake <yasutake.koichi@...panasonic.com>,
	Jonas Bonn <jonas@...thpole.se>,
	Chen Liqin <liqin.chen@...plusct.com>,
	Lennox Wu <lennox.wu@...il.com>,
	Paul Mundt <lethal@...ux-sh.org>,
	"David S. Miller" <davem@...emloft.net>,
	Chris Zankel <chris@...kel.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [RFC] cross-arch: don't corrupt personality flags upon
 exec()

On Tue, 28 Aug 2012, Chris Metcalf wrote:

> > On tile, the PER_LINUX_32BIT is always set for 32 bit compat tasks in a
> > 64 bit kernel, which is harmless but wrong anyway. Also this, tile never
> > calls set_personality, which is also harmless because it just means that
> > exec_domain switching on tile is broken, but the only non-bogus
> > exec_domain besides the default one is an experimental support for Acorn
> > RISC OS binaries that was last updated in 2002 for for linux-2.5.49.
> 
> Arnd, thanks for the drive-by code review.  Is this change the correct fix
> for your observation?
> 
> diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
> index d16d006..fd31920 100644
> --- a/arch/tile/include/asm/elf.h
> +++ b/arch/tile/include/asm/elf.h
> @@ -156,12 +156,12 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
>  #undef SET_PERSONALITY
>  #define SET_PERSONALITY(ex) \
>  do { \
> -       current->personality = PER_LINUX; \
> +       set_personality(PER_LINUX);                  \
>         current_thread_info()->status &= ~TS_COMPAT; \
>  } while (0)
>  #define COMPAT_SET_PERSONALITY(ex) \
>  do { \
> -       current->personality = PER_LINUX_32BIT; \
> +       set_personality(PER_LINUX);                 \
>         current_thread_info()->status |= TS_COMPAT; \
>  } while (0)

Actually this is also wrong. You should be rather doing

	set_personality(PER_LINUX | (current->personality & (~PER_MASK)))

otherwise you clobber the upper personality bits upon exec().

Something like the patch below. Either you can take it for tile, or I can 
ask Andrew to fold it into my tree-wide fix currently waiting in -mm. Just 
let me know.


From: Jiri Kosina <jkosina@...e.cz>
Subject: [PATCH] tile: Don't corrupt personality flags upon exec()

Historically, the top three bytes of personality have been used for things
such as ADDR_NO_RANDOMIZE, which made sense only for specific
architectures.

We now however have a flag there that is general no matter the
architecture (UNAME26); generally we have to be careful to preserve the
personality flags across exec().

This patch fixes tile architecture not to forcefully overwrite
personality flags during exec().

Plus it fixes exec_domain switching -- set_personality() should always be 
used instead of directly assigning to current->personality.

Signed-off-by: Jiri Kosina <jkosina@...e.cz>
---
 arch/tile/include/asm/elf.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index d16d006..cf7f3bd 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -156,12 +156,12 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 #undef SET_PERSONALITY
 #define SET_PERSONALITY(ex) \
 do { \
-	current->personality = PER_LINUX; \
+	set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \
 	current_thread_info()->status &= ~TS_COMPAT; \
 } while (0)
 #define COMPAT_SET_PERSONALITY(ex) \
 do { \
-	current->personality = PER_LINUX_32BIT; \
+	set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))); \
 	current_thread_info()->status |= TS_COMPAT; \
 } while (0)
 

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ