From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e6.ny.us.ibm.com (e6.ny.us.ibm.com [32.97.182.146]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e6.ny.us.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id E766ADDE03 for ; Wed, 18 Jun 2008 16:07:17 +1000 (EST) Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e6.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m5I69NI6004371 for ; Wed, 18 Jun 2008 02:09:23 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m5I66sbk223976 for ; Wed, 18 Jun 2008 02:06:54 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m5I66skd000363 for ; Wed, 18 Jun 2008 02:06:54 -0400 Date: Tue, 17 Jun 2008 23:06:51 -0700 From: Eric B Munson To: linuxppc-dev@ozlabs.org Subject: [RFC PATCH] Keep 3 high personality bytes across exec Message-ID: <20080618060651.GA8251@us.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="h31gzZEtNLTqOjlF" Cc: linux-kernel@vger.kernel.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Currently when a 32 bit process is exec'd on a powerpc 64 bit host the valu= es of the top three bytes of the personality are clobbered. This patch adds a check in the SET_PERSONALITY macro that will carry all the values in the top three bytes across the exec. Signed-off-by: Eric B Munson --- Based on 2.6.26-rc6 include/asm-powerpc/elf.h | 3 ++- include/linux/personality.h | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h index 9080d85..2f11a0e 100644 --- a/include/asm-powerpc/elf.h +++ b/include/asm-powerpc/elf.h @@ -257,7 +257,8 @@ do { \ else \ clear_thread_flag(TIF_ABI_PENDING); \ if (personality(current->personality) !=3D PER_LINUX32) \ - set_personality(PER_LINUX); \ + set_personality(PER_LINUX | \ + (current->personality & PER_INHERIT)); \ } while (0) /* * An executable for which elf_read_implies_exec() returns TRUE will diff --git a/include/linux/personality.h b/include/linux/personality.h index a84e9ff..362eb90 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -36,6 +36,12 @@ enum { ADDR_LIMIT_3GB =3D 0x8000000, }; =20 +/* Mask for the above personality values */ +#define PER_INHERIT (ADDR_NO_RANDOMIZE|FDPIC_FUNCPTRS|MMAP_PAGE_ZERO| \ + ADDR_COMPAT_LAYOUT|READ_IMPLIES_EXEC|ADDR_LIMIT_32BIT| \ + SHORT_INODE|WHOLE_SECONDS|STICKY_TIMEOUTS| \ + ADDR_LIMIT_3GB) + /* * Security-relevant compatibility flags that must be * cleared upon setuid or setgid exec: --h31gzZEtNLTqOjlF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFIWKX7snv9E83jkzoRAi9lAKDZZre2ksNhC3llJrNF7vzLVJFXNwCgo2k/ NNHS5lCbE/ZKJtm3UfjS1do= =wIy8 -----END PGP SIGNATURE----- --h31gzZEtNLTqOjlF--