Skip to content

Commit efc8e7f

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: Keys: KEYCTL_SESSION_TO_PARENT needs TIF_NOTIFY_RESUME architecture support NOMMU: Optimise away the {dac_,}mmap_min_addr tests security/min_addr.c: make init_mmap_min_addr() static keys: PTR_ERR return of wrong pointer in keyctl_get_security()
2 parents b5c96f8 + a00ae4d commit efc8e7f

6 files changed

Lines changed: 24 additions & 3 deletions

File tree

‎include/linux/security.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ struct seq_file;
9595
extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
9696
extern int cap_netlink_recv(struct sk_buff *skb, int cap);
9797

98+
#ifdef CONFIG_MMU
9899
extern unsigned long mmap_min_addr;
99100
extern unsigned long dac_mmap_min_addr;
101+
#else
102+
#define dac_mmap_min_addr 0UL
103+
#endif
104+
100105
/*
101106
* Values used in the task_security_ops calls
102107
*/
@@ -121,6 +126,7 @@ struct request_sock;
121126
#define LSM_UNSAFE_PTRACE 2
122127
#define LSM_UNSAFE_PTRACE_CAP 4
123128

129+
#ifdef CONFIG_MMU
124130
/*
125131
* If a hint addr is less than mmap_min_addr change hint to be as
126132
* low as possible but still greater than mmap_min_addr
@@ -135,6 +141,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
135141
}
136142
extern int mmap_min_addr_handler(struct ctl_table *table, int write,
137143
void __user *buffer, size_t *lenp, loff_t *ppos);
144+
#endif
138145

139146
#ifdef CONFIG_SECURITY
140147

‎kernel/sysctl.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,13 +1214,15 @@ static struct ctl_table vm_table[] = {
12141214
.proc_handler = proc_dointvec_jiffies,
12151215
},
12161216
#endif
1217+
#ifdef CONFIG_MMU
12171218
{
12181219
.procname = "mmap_min_addr",
12191220
.data = &dac_mmap_min_addr,
12201221
.maxlen = sizeof(unsigned long),
12211222
.mode = 0644,
12221223
.proc_handler = mmap_min_addr_handler,
12231224
},
1225+
#endif
12241226
#ifdef CONFIG_NUMA
12251227
{
12261228
.procname = "numa_zonelist_order",

‎mm/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ config KSM
221221

222222
config DEFAULT_MMAP_MIN_ADDR
223223
int "Low address space to protect from user allocation"
224+
depends on MMU
224225
default 4096
225226
help
226227
This is the portion of low virtual memory which should be protected

‎security/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ subdir-$(CONFIG_SECURITY_SMACK) += smack
88
subdir-$(CONFIG_SECURITY_TOMOYO) += tomoyo
99

1010
# always enable default capabilities
11-
obj-y += commoncap.o min_addr.o
11+
obj-y += commoncap.o
12+
obj-$(CONFIG_MMU) += min_addr.o
1213

1314
# Object file lists
1415
obj-$(CONFIG_SECURITY) += security.o capability.o

‎security/keys/keyctl.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ long keyctl_get_security(key_serial_t keyid,
11941194
* have the authorisation token handy */
11951195
instkey = key_get_instantiation_authkey(keyid);
11961196
if (IS_ERR(instkey))
1197-
return PTR_ERR(key_ref);
1197+
return PTR_ERR(instkey);
11981198
key_put(instkey);
11991199

12001200
key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, 0);
@@ -1236,6 +1236,7 @@ long keyctl_get_security(key_serial_t keyid,
12361236
*/
12371237
long keyctl_session_to_parent(void)
12381238
{
1239+
#ifdef TIF_NOTIFY_RESUME
12391240
struct task_struct *me, *parent;
12401241
const struct cred *mycred, *pcred;
12411242
struct cred *cred, *oldcred;
@@ -1326,6 +1327,15 @@ long keyctl_session_to_parent(void)
13261327
error_keyring:
13271328
key_ref_put(keyring_r);
13281329
return ret;
1330+
1331+
#else /* !TIF_NOTIFY_RESUME */
1332+
/*
1333+
* To be removed when TIF_NOTIFY_RESUME has been implemented on
1334+
* m68k/xtensa
1335+
*/
1336+
#warning TIF_NOTIFY_RESUME not implemented
1337+
return -EOPNOTSUPP;
1338+
#endif /* !TIF_NOTIFY_RESUME */
13291339
}
13301340

13311341
/*****************************************************************************/

‎security/min_addr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int mmap_min_addr_handler(struct ctl_table *table, int write,
4343
return ret;
4444
}
4545

46-
int __init init_mmap_min_addr(void)
46+
static int __init init_mmap_min_addr(void)
4747
{
4848
update_mmap_min_addr();
4949

0 commit comments

Comments
 (0)