summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '4.16/00_all_0003-convert-PAGE_SIZE-usage.patch')
-rw-r--r--4.16/00_all_0003-convert-PAGE_SIZE-usage.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/4.16/00_all_0003-convert-PAGE_SIZE-usage.patch b/4.16/00_all_0003-convert-PAGE_SIZE-usage.patch
new file mode 100644
index 0000000..6a68fbf
--- /dev/null
+++ b/4.16/00_all_0003-convert-PAGE_SIZE-usage.patch
@@ -0,0 +1,54 @@
+From e685bbb40026037d5bbd223f22305497d7363eb5 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.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@gentoo.org>
+---
+ include/uapi/linux/binfmts.h | 3 ++-
+ include/uapi/linux/resource.h | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h
+index 4abad03a8853..3e98cfc84d1c 100644
+--- a/include/uapi/linux/binfmts.h
++++ b/include/uapi/linux/binfmts.h
+@@ -2,6 +2,7 @@
+ #ifndef _UAPI_LINUX_BINFMTS_H
+ #define _UAPI_LINUX_BINFMTS_H
+
++#include <unistd.h>
+ #include <linux/capability.h>
+
+ struct pt_regs;
+@@ -12,7 +13,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/uapi/linux/resource.h b/include/uapi/linux/resource.h
+index cc00fd079631..6f9e76f513b5 100644
+--- a/include/uapi/linux/resource.h
++++ b/include/uapi/linux/resource.h
+@@ -69,7 +69,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
+--
+2.16.1
+