aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/capability.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 19:39:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 19:39:15 -0400
commiteea3a00264cf243a28e4331566ce67b86059339d (patch)
tree487f16389e0dfa32e9caa7604d1274a7dcda8f04 /kernel/capability.c
parente7c82412433a8039616c7314533a0a1c025d99bf (diff)
parente693d73c20ffdb06840c9378f367bad849ac0d5d (diff)
Merge branch 'akpm' (patches from Andrew)
Merge second patchbomb from Andrew Morton: - the rest of MM - various misc bits - add ability to run /sbin/reboot at reboot time - printk/vsprintf changes - fiddle with seq_printf() return value * akpm: (114 commits) parisc: remove use of seq_printf return value lru_cache: remove use of seq_printf return value tracing: remove use of seq_printf return value cgroup: remove use of seq_printf return value proc: remove use of seq_printf return value s390: remove use of seq_printf return value cris fasttimer: remove use of seq_printf return value cris: remove use of seq_printf return value openrisc: remove use of seq_printf return value ARM: plat-pxa: remove use of seq_printf return value nios2: cpuinfo: remove use of seq_printf return value microblaze: mb: remove use of seq_printf return value ipc: remove use of seq_printf return value rtc: remove use of seq_printf return value power: wakeup: remove use of seq_printf return value x86: mtrr: if: remove use of seq_printf return value linux/bitmap.h: improve BITMAP_{LAST,FIRST}_WORD_MASK MAINTAINERS: CREDITS: remove Stefano Brivio from B43 .mailmap: add Ricardo Ribalda CREDITS: add Ricardo Ribalda Delgado ...
Diffstat (limited to 'kernel/capability.c')
-rw-r--r--kernel/capability.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/kernel/capability.c b/kernel/capability.c
index 989f5bfc57dc..45432b54d5c6 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -35,6 +35,7 @@ static int __init file_caps_disable(char *str)
35} 35}
36__setup("no_file_caps", file_caps_disable); 36__setup("no_file_caps", file_caps_disable);
37 37
38#ifdef CONFIG_MULTIUSER
38/* 39/*
39 * More recent versions of libcap are available from: 40 * More recent versions of libcap are available from:
40 * 41 *
@@ -386,6 +387,24 @@ bool ns_capable(struct user_namespace *ns, int cap)
386} 387}
387EXPORT_SYMBOL(ns_capable); 388EXPORT_SYMBOL(ns_capable);
388 389
390
391/**
392 * capable - Determine if the current task has a superior capability in effect
393 * @cap: The capability to be tested for
394 *
395 * Return true if the current task has the given superior capability currently
396 * available for use, false if not.
397 *
398 * This sets PF_SUPERPRIV on the task if the capability is available on the
399 * assumption that it's about to be used.
400 */
401bool capable(int cap)
402{
403 return ns_capable(&init_user_ns, cap);
404}
405EXPORT_SYMBOL(capable);
406#endif /* CONFIG_MULTIUSER */
407
389/** 408/**
390 * file_ns_capable - Determine if the file's opener had a capability in effect 409 * file_ns_capable - Determine if the file's opener had a capability in effect
391 * @file: The file we want to check 410 * @file: The file we want to check
@@ -412,22 +431,6 @@ bool file_ns_capable(const struct file *file, struct user_namespace *ns,
412EXPORT_SYMBOL(file_ns_capable); 431EXPORT_SYMBOL(file_ns_capable);
413 432
414/** 433/**
415 * capable - Determine if the current task has a superior capability in effect
416 * @cap: The capability to be tested for
417 *
418 * Return true if the current task has the given superior capability currently
419 * available for use, false if not.
420 *
421 * This sets PF_SUPERPRIV on the task if the capability is available on the
422 * assumption that it's about to be used.
423 */
424bool capable(int cap)
425{
426 return ns_capable(&init_user_ns, cap);
427}
428EXPORT_SYMBOL(capable);
429
430/**
431 * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped 434 * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped
432 * @inode: The inode in question 435 * @inode: The inode in question
433 * @cap: The capability in question 436 * @cap: The capability in question