summaryrefslogtreecommitdiff
blob: d2e2492c679e0c99542a5d0e007000c77825c341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 50c24c7d6e01e424fa2b60b1b0b16fb952fef5b6 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 13 Feb 2010 03:09:23 -0500
Subject: [PATCH 9/9] 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@gentoo.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 aece486..d8ac541 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 40fc7e6..16016ce 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -62,7 +62,8 @@ struct rlimit {
  * 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.6.6.1