This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 3/5] EXEC: Use define for stack to argument size limit
- From: Andi Kleen <andi at firstfloor dot org>
- To: linux-kernel at vger dot kernel dot org
- Cc: libc-alpha at sourceware dot org,Andi Kleen <ak at linux dot intel dot com>
- Date: Fri, 13 May 2011 16:24:17 -0700
- Subject: [PATCH 3/5] EXEC: Use define for stack to argument size limit
- References: <1305329059-2017-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Change the hardcoded 4 constant for the argument size limit in exec
to a exported constant.
Needed for followon patch.
Open: better place for the constant?
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
fs/exec.c | 2 +-
include/linux/fs.h | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/fs/exec.c b/fs/exec.c
index 5e62d26..1707832 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -225,7 +225,7 @@ struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
* to work from.
*/
rlim = current->signal->rlim;
- if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4) {
+ if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur) / ARG_MAX_FACTOR) {
put_page(page);
return NULL;
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dbd860a..fcd84a6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -33,6 +33,8 @@
#define SEEK_END 2 /* seek relative to end of file */
#define SEEK_MAX SEEK_END
+#define ARG_MAX_FACTOR 4
+
struct fstrim_range {
__u64 start;
__u64 len;
--
1.7.4.4