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, 23 Aug 2011 07:00:01 +0100
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
	util-linux@...r.kernel.org
Subject: [PATCH] setarch: Add --uname-2.6 option for personality flag UNAME26

Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
On Fri, 2011-08-19 at 16:15 -0700, Andi Kleen wrote:
[...]
> To use:
> 
> wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c
> gcc -o uname26 uname26.c
> ./uname26 program
[...]

I would suggest adding this to setarch, as that handles all the other
personality flags.  The following patch to util-linux seems to do the
trick.

Ben.

 configure.ac        |    1 +
 sys-utils/setarch.8 |    3 +++
 sys-utils/setarch.c |   12 +++++++++++-
 3 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0d3b889..51d06fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -792,6 +792,7 @@ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
 	[#include <sys/stat.h>])
 
 AC_CHECK_DECLS([
+ UNAME26,
  ADDR_NO_RANDOMIZE,
  FDPIC_FUNCPTRS,
  MMAP_PAGE_ZERO,
diff --git a/sys-utils/setarch.8 b/sys-utils/setarch.8
index 0764a45..b6f5b77 100644
--- a/sys-utils/setarch.8
+++ b/sys-utils/setarch.8
@@ -29,6 +29,9 @@ Be verbose.
 .I "\-h," "\-\-help"
 Display help (it is also displayed when setarch takes no arguments).
 .TP
+.I "\-\-uname\-2.6"
+Causes the program to see a kernel version number beginning with 2.6.
+.TP
 .I "\-3," "\-\-3gb"
 Specifies that processes should use a maximum of 3GB of address space on systems where it is supported (ADDR_LIMIT_3GB).
 .TP
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 35efca4..b53bf36 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -41,6 +41,8 @@
 /* Option --4gb has no equivalent short option, use a non-character as a
    pseudo short option. */
 #define OPT_4GB (CHAR_MAX+1)
+/* Similarly for --uname-2.6 */
+#define OPT_UNAME26 (OPT_4GB+1)
 
 #define turn_on(_flag, _opts) \
 	do { \
@@ -50,6 +52,9 @@
 	} while(0)
 

+#if !HAVE_DECL_UNAME26
+# define UNAME26                 0x0020000
+#endif
 #if !HAVE_DECL_ADDR_NO_RANDOMIZE
 # define ADDR_NO_RANDOMIZE       0x0040000
 #endif
@@ -98,6 +103,7 @@ static const struct option longopts[] =
     { "sticky-timeouts",    0, 0, 'T' },
     { "3gb",                0, 0, '3' },
     { "4gb",                0, 0, OPT_4GB },
+    { "uname-2.6",          0, 0, OPT_UNAME26 },
     { NULL,                 0, 0, 0 }
 };
 
@@ -125,7 +131,8 @@ show_help(void)
    " -S, --whole-seconds      turns on WHOLE_SECONDS\n"
    " -T, --sticky-timeouts    turns on STICKY_TIMEOUTS\n"
    " -3, --3gb                limits the used address space to a maximum of 3 GB\n"
-   "     --4gb                ignored (for backward compatibility only)\n"));
+   "     --4gb                ignored (for backward compatibility only)\n"
+   "     --uname-2.6          turns on UNAME26\n"));
 
   printf(_("\nFor more information see setarch(8).\n"));
   exit(EXIT_SUCCESS);
@@ -306,6 +313,9 @@ int main(int argc, char *argv[])
 	break;
     case OPT_4GB:          /* just ignore this one */
       break;
+    case OPT_UNAME26:
+	turn_on(UNAME26, options);
+	break;
     }
   }
 
-- 
1.7.5.4


--
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