From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R5QA4-00010T-1g for garchives@archives.gentoo.org; Sun, 18 Sep 2011 22:48:32 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1BC0B21C165; Sun, 18 Sep 2011 22:48:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D2D9421C165 for ; Sun, 18 Sep 2011 22:48:24 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5A76D1B400B for ; Sun, 18 Sep 2011 22:48:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B23BF80042 for ; Sun, 18 Sep 2011 22:48:23 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: Subject: [gentoo-commits] proj/elfix:master commit in: src/ X-VCS-Repository: proj/elfix X-VCS-Files: src/fix-gnustack.c src/paxctl-ng.c X-VCS-Directories: src/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: de1da3fd4db48fe47b81be2bbdc7ad66ac609105 Date: Sun, 18 Sep 2011 22:48:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 4d6c44ce3eed680d52d7054c5683db9d commit: de1da3fd4db48fe47b81be2bbdc7ad66ac609105 Author: Anthony G. Basile gentoo org> AuthorDate: Sun Sep 18 22:48:10 2011 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Sun Sep 18 22:48:10 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/elfix.git;a=3D= commit;h=3Dde1da3fd src/paxctl-ng.c: fix EI_PAX when -Pp etc is given --- src/fix-gnustack.c | 2 +- src/paxctl-ng.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/fix-gnustack.c b/src/fix-gnustack.c index 6ca7d5b..93aab1c 100644 --- a/src/fix-gnustack.c +++ b/src/fix-gnustack.c @@ -40,7 +40,7 @@ print_help(char *v) "Bug Reports : " PACKAGE_BUGREPORT "\n" "Program Name : %s\n" "Description : Check for, or conditionally remove, executable flag fr= om PT_GNU_STACK\n\n" - "Usage : %s {[-f] ELF | [-h]}\n" + "Usage : %s [-f] ELF | [-h]\n" "options : Print out protection flags on PT_GNU_STACK\n" " : -f Remove X if WX flags are set on PT_GNU_STACK\n" " : -h Print out this help\n", diff --git a/src/paxctl-ng.c b/src/paxctl-ng.c index 9d6a76e..fd04dec 100644 --- a/src/paxctl-ng.c +++ b/src/paxctl-ng.c @@ -137,7 +137,9 @@ parse_cmd_args(int c, char *v[], int *pax_flags, int = *view_flags) compat +=3D 1; break ; case 'z': - *pax_flags =3D -1; + *pax_flags =3D PF_PAGEEXEC | PF_NOPAGEEXEC | PF_SEGMEXEC | PF_NOSEGM= EXEC | + PF_MPROTECT | PF_NOMPROTECT | PF_EMUTRAMP | PF_NOEMUTRAMP | + PF_RANDMMAP | PF_NORANDMMAP | PF_RANDEXEC | PF_NORANDEXEC; compat +=3D 1; break; case 'v': @@ -256,31 +258,43 @@ set_flags(Elf *elf, int *pax_flags) ei_flags &=3D ~HF_PAX_PAGEEXEC; if(*pax_flags & PF_NOPAGEEXEC) ei_flags |=3D HF_PAX_PAGEEXEC; + if((*pax_flags & PF_PAGEEXEC) && (*pax_flags & PF_NOPAGEEXEC)) + ei_flags &=3D ~HF_PAX_PAGEEXEC; =20 if(*pax_flags & PF_SEGMEXEC) ei_flags &=3D ~HF_PAX_SEGMEXEC; if(*pax_flags & PF_NOSEGMEXEC) ei_flags |=3D HF_PAX_SEGMEXEC; + if((*pax_flags & PF_SEGMEXEC) && (*pax_flags & PF_NOSEGMEXEC)) + ei_flags &=3D ~HF_PAX_SEGMEXEC; =20 if(*pax_flags & PF_MPROTECT) ei_flags &=3D ~HF_PAX_MPROTECT; if(*pax_flags & PF_NOMPROTECT) ei_flags |=3D HF_PAX_MPROTECT; + if((*pax_flags & PF_MPROTECT) && (*pax_flags & PF_NOMPROTECT)) + ei_flags &=3D ~HF_PAX_MPROTECT; =20 if(*pax_flags & PF_EMUTRAMP) ei_flags |=3D HF_PAX_EMUTRAMP; if(*pax_flags & PF_NOEMUTRAMP) ei_flags &=3D ~HF_PAX_EMUTRAMP; + if((*pax_flags & PF_EMUTRAMP) && (*pax_flags & PF_NOEMUTRAMP)) + ei_flags &=3D ~HF_PAX_EMUTRAMP; =20 if(*pax_flags & PF_RANDMMAP) ei_flags &=3D ~HF_PAX_RANDMMAP; if(*pax_flags & PF_NORANDMMAP) ei_flags |=3D HF_PAX_RANDMMAP; + if((*pax_flags & PF_RANDMMAP) && (*pax_flags & PF_NORANDMMAP)) + ei_flags &=3D ~HF_PAX_RANDMMAP; =20 if(*pax_flags & PF_RANDEXEC) ei_flags |=3D HF_PAX_RANDEXEC; if(*pax_flags & PF_NORANDEXEC) ei_flags &=3D ~HF_PAX_RANDEXEC; + if((*pax_flags & PF_RANDEXEC) && (*pax_flags & PF_NORANDEXEC)) + ei_flags |=3D HF_PAX_RANDEXEC; =20 =20 if(gelf_getehdr(elf, &ehdr) !=3D &ehdr)