Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 19 Jun 2012 16:50:07 +0200
From: Daniel Cegiełka <daniel.cegielka@...il.com>
To: owl-dev@...ts.openwall.com
Subject: Re: procps-3.2.8

Hi,

Owl currently uses a static PAGE_SIZE (procps-3.2.5-owl-PAGE_SIZE.diff)


diff -ur procps-3.2.5.orig/ps/common.h procps-3.2.5/ps/common.h
--- procps-3.2.5.orig/ps/common.h	2004-10-09 03:55:50 +0000
+++ procps-3.2.5/ps/common.h	2009-11-23 07:27:39 +0000
@@ -14,7 +14,9 @@

 #include "../proc/procps.h"
 #include "../proc/readproc.h"
+#define __KERNEL__
 #include <asm/page.h>  /* looks safe for glibc, we need PAGE_SIZE */
+#undef __KERNEL__

 #if 0
 #define trace(args...) printf(## args)

----------------------------------------------------------------------------------

but it might be a problem:

https://bugs.gentoo.org/show_bug.cgi?id=301431

patches:

LINUX-HEADERS:

>From 530edf1dc47685df58de2fc15fc2029bbb0619ca Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@...too.org>
Date: Sat, 13 Feb 2010 03:09:23 -0500
Subject: [PATCH] convert PAGE_SIZE usage

The size of a page may change at runtime or based on kernel settings, so
a static value at compile time doesn't work.  More importantly, no one
exports PAGE_SIZE to user space anymore.

URL: http://bugs.gentoo.org/301431
Signed-off-by: Mike Frysinger <vapier@...too.org>
---
 include/linux/binfmts.h  |    3 ++-
 include/linux/resource.h |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index fd88a39..dbe6719 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_BINFMTS_H
 #define _LINUX_BINFMTS_H

+#include <unistd.h>
 #include <linux/capability.h>

 struct pt_regs;
@@ -11,7 +12,7 @@ struct pt_regs;
  * prevent the kernel from being unduly impacted by misaddressed pointers.
  * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
  */
-#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
+#define MAX_ARG_STRLEN (sysconf(_SC_PAGESIZE) * 32)
 #define MAX_ARG_STRINGS 0x7FFFFFFF

 /* sizeof(linux_binprm->buf) */
diff --git a/include/linux/resource.h b/include/linux/resource.h
index d01c96c..5a0559d 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -68,7 +68,8 @@ struct rlimit64 {
  * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
  * and other sensitive information are never written to disk.
  */
-#define MLOCK_LIMIT    ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
+/* No one currently defines PAGE_SIZE bigger than 64kB */
+#define MLOCK_LIMIT    (64 * 1024)

 /*
  * Due to binary compatibility, the actual resource numbers
--
1.7.6.1

----------------------------------------------------------------------------------

procps:


diff -Naurp procps-3.2.3.orig/minimal.c procps-3.2.3/minimal.c
--- procps-3.2.3.orig/minimal.c 2004-05-04 20:26:14.000000000 -0400
+++ procps-3.2.3/minimal.c      2004-08-20 02:01:35.868100752 -0400
@@ -68,8 +68,8 @@
 ///////////////////////////////////////////////////////////

 #ifndef PAGE_SIZE
-#warning PAGE_SIZE not defined, assuming it is 4096
-#define PAGE_SIZE 4096
+#warning PAGE_SIZE not defined, using sysconf() to determine correct value
+#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
 #endif


diff -Naurp procps-3.2.3.orig/ps/common.h procps-3.2.3/ps/common.h
--- procps-3.2.3.orig/ps/common.h       2004-04-25 17:03:18.000000000 -0400
+++ procps-3.2.3/ps/common.h    2004-08-20 02:00:59.228670792 -0400
@@ -16,6 +16,11 @@
 #include "../proc/readproc.h"
 #include <asm/page.h>  /* looks safe for glibc, we need PAGE_SIZE */

+#ifndef PAGE_SIZE
+#warning PAGE_SIZE not defined, using sysconf() to determine correct value
+#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
+#endif
+
 #if 0
 #define trace(args...) printf(## args)
 #else

----------------------------------------------------------------------------------

This all means that you must also modify the kernel (headers) patch.

Should I apply the solution from gentoo or keep the old solution?

Daniel

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ