diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 17:47:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 17:47:24 -0500 |
commit | 832d30ca72c0a59058e66e097f5ea11f99640819 (patch) | |
tree | ab71581c4ad66b2a151298ed13c0eb2506fc8068 /kernel | |
parent | 3a5b27bf6f29574d667230c7e76e4b83fe3014e0 (diff) | |
parent | b4ccebdd37ff70d349321a198f416ba737a5e833 (diff) |
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: (38 commits)
SELinux: Make selinux_kernel_create_files_as() shouldn't just always return 0
TOMOYO: Protect find_task_by_vpid() with RCU.
Security: add static to security_ops and default_security_ops variable
selinux: libsepol: remove dead code in check_avtab_hierarchy_callback()
TOMOYO: Remove __func__ from tomoyo_is_correct_path/domain
security: fix a couple of sparse warnings
TOMOYO: Remove unneeded parameter.
TOMOYO: Use shorter names.
TOMOYO: Use enum for index numbers.
TOMOYO: Add garbage collector.
TOMOYO: Add refcounter on domain structure.
TOMOYO: Merge headers.
TOMOYO: Add refcounter on string data.
TOMOYO: Reduce lines by using common path for addition and deletion.
selinux: fix memory leak in sel_make_bools
TOMOYO: Extract bitfield
syslog: clean up needless comment
syslog: use defined constants instead of raw numbers
syslog: distinguish between /proc/kmsg and syscalls
selinux: allow MLS->non-MLS and vice versa upon policy reload
...
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/capability.c | 4 | ||||
-rw-r--r-- | kernel/printk.c | 52 |
2 files changed, 25 insertions, 31 deletions
diff --git a/kernel/capability.c b/kernel/capability.c index 7f876e60521f..9e4697e9b276 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
@@ -135,7 +135,7 @@ static inline int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp, | |||
135 | if (pid && (pid != task_pid_vnr(current))) { | 135 | if (pid && (pid != task_pid_vnr(current))) { |
136 | struct task_struct *target; | 136 | struct task_struct *target; |
137 | 137 | ||
138 | read_lock(&tasklist_lock); | 138 | rcu_read_lock(); |
139 | 139 | ||
140 | target = find_task_by_vpid(pid); | 140 | target = find_task_by_vpid(pid); |
141 | if (!target) | 141 | if (!target) |
@@ -143,7 +143,7 @@ static inline int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp, | |||
143 | else | 143 | else |
144 | ret = security_capget(target, pEp, pIp, pPp); | 144 | ret = security_capget(target, pEp, pIp, pPp); |
145 | 145 | ||
146 | read_unlock(&tasklist_lock); | 146 | rcu_read_unlock(); |
147 | } else | 147 | } else |
148 | ret = security_capget(current, pEp, pIp, pPp); | 148 | ret = security_capget(current, pEp, pIp, pPp); |
149 | 149 | ||
diff --git a/kernel/printk.c b/kernel/printk.c index 1751c456b71f..40674122ecf2 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/kexec.h> | 35 | #include <linux/kexec.h> |
36 | #include <linux/ratelimit.h> | 36 | #include <linux/ratelimit.h> |
37 | #include <linux/kmsg_dump.h> | 37 | #include <linux/kmsg_dump.h> |
38 | #include <linux/syslog.h> | ||
38 | 39 | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | 41 | ||
@@ -258,38 +259,23 @@ static inline void boot_delay_msec(void) | |||
258 | } | 259 | } |
259 | #endif | 260 | #endif |
260 | 261 | ||
261 | /* | 262 | int do_syslog(int type, char __user *buf, int len, bool from_file) |
262 | * Commands to do_syslog: | ||
263 | * | ||
264 | * 0 -- Close the log. Currently a NOP. | ||
265 | * 1 -- Open the log. Currently a NOP. | ||
266 | * 2 -- Read from the log. | ||
267 | * 3 -- Read all messages remaining in the ring buffer. | ||
268 | * 4 -- Read and clear all messages remaining in the ring buffer | ||
269 | * 5 -- Clear ring buffer. | ||
270 | * 6 -- Disable printk's to console | ||
271 | * 7 -- Enable printk's to console | ||
272 | * 8 -- Set level of messages printed to console | ||
273 | * 9 -- Return number of unread characters in the log buffer | ||
274 | * 10 -- Return size of the log buffer | ||
275 | */ | ||
276 | int do_syslog(int type, char __user *buf, int len) | ||
277 | { | 263 | { |
278 | unsigned i, j, limit, count; | 264 | unsigned i, j, limit, count; |
279 | int do_clear = 0; | 265 | int do_clear = 0; |
280 | char c; | 266 | char c; |
281 | int error = 0; | 267 | int error = 0; |
282 | 268 | ||
283 | error = security_syslog(type); | 269 | error = security_syslog(type, from_file); |
284 | if (error) | 270 | if (error) |
285 | return error; | 271 | return error; |
286 | 272 | ||
287 | switch (type) { | 273 | switch (type) { |
288 | case 0: /* Close log */ | 274 | case SYSLOG_ACTION_CLOSE: /* Close log */ |
289 | break; | 275 | break; |
290 | case 1: /* Open log */ | 276 | case SYSLOG_ACTION_OPEN: /* Open log */ |
291 | break; | 277 | break; |
292 | case 2: /* Read from log */ | 278 | case SYSLOG_ACTION_READ: /* Read from log */ |
293 | error = -EINVAL; | 279 | error = -EINVAL; |
294 | if (!buf || len < 0) | 280 | if (!buf || len < 0) |
295 | goto out; | 281 | goto out; |
@@ -320,10 +306,12 @@ int do_syslog(int type, char __user *buf, int len) | |||
320 | if (!error) | 306 | if (!error) |
321 | error = i; | 307 | error = i; |
322 | break; | 308 | break; |
323 | case 4: /* Read/clear last kernel messages */ | 309 | /* Read/clear last kernel messages */ |
310 | case SYSLOG_ACTION_READ_CLEAR: | ||
324 | do_clear = 1; | 311 | do_clear = 1; |
325 | /* FALL THRU */ | 312 | /* FALL THRU */ |
326 | case 3: /* Read last kernel messages */ | 313 | /* Read last kernel messages */ |
314 | case SYSLOG_ACTION_READ_ALL: | ||
327 | error = -EINVAL; | 315 | error = -EINVAL; |
328 | if (!buf || len < 0) | 316 | if (!buf || len < 0) |
329 | goto out; | 317 | goto out; |
@@ -376,21 +364,25 @@ int do_syslog(int type, char __user *buf, int len) | |||
376 | } | 364 | } |
377 | } | 365 | } |
378 | break; | 366 | break; |
379 | case 5: /* Clear ring buffer */ | 367 | /* Clear ring buffer */ |
368 | case SYSLOG_ACTION_CLEAR: | ||
380 | logged_chars = 0; | 369 | logged_chars = 0; |
381 | break; | 370 | break; |
382 | case 6: /* Disable logging to console */ | 371 | /* Disable logging to console */ |
372 | case SYSLOG_ACTION_CONSOLE_OFF: | ||
383 | if (saved_console_loglevel == -1) | 373 | if (saved_console_loglevel == -1) |
384 | saved_console_loglevel = console_loglevel; | 374 | saved_console_loglevel = console_loglevel; |
385 | console_loglevel = minimum_console_loglevel; | 375 | console_loglevel = minimum_console_loglevel; |
386 | break; | 376 | break; |
387 | case 7: /* Enable logging to console */ | 377 | /* Enable logging to console */ |
378 | case SYSLOG_ACTION_CONSOLE_ON: | ||
388 | if (saved_console_loglevel != -1) { | 379 | if (saved_console_loglevel != -1) { |
389 | console_loglevel = saved_console_loglevel; | 380 | console_loglevel = saved_console_loglevel; |
390 | saved_console_loglevel = -1; | 381 | saved_console_loglevel = -1; |
391 | } | 382 | } |
392 | break; | 383 | break; |
393 | case 8: /* Set level of messages printed to console */ | 384 | /* Set level of messages printed to console */ |
385 | case SYSLOG_ACTION_CONSOLE_LEVEL: | ||
394 | error = -EINVAL; | 386 | error = -EINVAL; |
395 | if (len < 1 || len > 8) | 387 | if (len < 1 || len > 8) |
396 | goto out; | 388 | goto out; |
@@ -401,10 +393,12 @@ int do_syslog(int type, char __user *buf, int len) | |||
401 | saved_console_loglevel = -1; | 393 | saved_console_loglevel = -1; |
402 | error = 0; | 394 | error = 0; |
403 | break; | 395 | break; |
404 | case 9: /* Number of chars in the log buffer */ | 396 | /* Number of chars in the log buffer */ |
397 | case SYSLOG_ACTION_SIZE_UNREAD: | ||
405 | error = log_end - log_start; | 398 | error = log_end - log_start; |
406 | break; | 399 | break; |
407 | case 10: /* Size of the log buffer */ | 400 | /* Size of the log buffer */ |
401 | case SYSLOG_ACTION_SIZE_BUFFER: | ||
408 | error = log_buf_len; | 402 | error = log_buf_len; |
409 | break; | 403 | break; |
410 | default: | 404 | default: |
@@ -417,7 +411,7 @@ out: | |||
417 | 411 | ||
418 | SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) | 412 | SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) |
419 | { | 413 | { |
420 | return do_syslog(type, buf, len); | 414 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); |
421 | } | 415 | } |
422 | 416 | ||
423 | /* | 417 | /* |