Skip to contentSkip to conversation

c/r: prctl: fix build error for no-MMU case

PATCH In review Mark Salter 2 participants 2 messages Sep 24, 2012 Security (LSM)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 c/r: prctl: fix build error for no-MMU case

Commit 1ad75b9e1 added some address checking to prctl_set_mm() used by checkpoint-restore. This causes a build error for no-MMU systems:

kernel/sys.c: In function 'prctl_set_mm':
kernel/sys.c:1868:34: error: 'mmap_min_addr' undeclared (first use in this function)

The test for mmap_min_addr doesn't make a lot of sense for no-MMU code as noted in commit 6e1415467. This patch defines mmap_min_addr as 0UL in the no-MMU case so that the compiler will optimize away tests for "addr < mmap_min_addr".

---
 include/linux/security.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/security.h +1 -0
index 3dea6a9..d143b8e 100644
@@ -118,6 +118,7 @@ void reset_security_ops(void);
 extern unsigned long mmap_min_addr;
 extern unsigned long dac_mmap_min_addr;
 #else
+#define mmap_min_addr		0UL
 #define dac_mmap_min_addr	0UL
 #endif
 
Signature · 1 line
1.7.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mark Salter

Commit 1ad75b9e1 added some address checking to prctl_set_mm() used by checkpoint-restore. This causes a build error for no-MMU systems:

kernel/sys.c: In function 'prctl_set_mm':
kernel/sys.c:1868:34: error: 'mmap_min_addr' undeclared (first use in this function)

Quoted 6 lines

The test for mmap_min_addr doesn't make a lot of sense for no-MMU code as noted in commit 6e1415467. This patch defines mmap_min_addr as 0UL in the no-MMU case so that the compiler will optimize away tests for "addr < mmap_min_addr".

Thanks, Mark! I should add that this mmap_min_addr currently referenced in other parts of code only under CONFIG_MMU so this definition in header should not break anything.