diff options
author | Patrick McHardy <kaber@trash.net> | 2011-04-13 13:32:28 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-04-13 13:32:28 +0200 |
commit | b32e3dc7860d00124fa432dba09667e647cb9bcc (patch) | |
tree | 2fa6e56f389431dfb84609d3d7572cad76e88e71 /kernel/futex.c | |
parent | netfilter: ipset: References are protected by rwlock instead of mutex (diff) | |
parent | netfilter: xt_conntrack: fix inverted conntrack direction test (diff) | |
download | linux-b32e3dc7860d00124fa432dba09667e647cb9bcc.tar.xz linux-b32e3dc7860d00124fa432dba09667e647cb9bcc.zip |
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6
Diffstat (limited to 'kernel/futex.c')
-rw-r--r-- | kernel/futex.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index bda415715382..dfb924ffe65b 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -782,8 +782,8 @@ static void __unqueue_futex(struct futex_q *q) { struct futex_hash_bucket *hb; - if (WARN_ON(!q->lock_ptr || !spin_is_locked(q->lock_ptr) - || plist_node_empty(&q->list))) + if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr)) + || WARN_ON(plist_node_empty(&q->list))) return; hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock); @@ -2418,10 +2418,19 @@ SYSCALL_DEFINE3(get_robust_list, int, pid, goto err_unlock; ret = -EPERM; pcred = __task_cred(p); + /* If victim is in different user_ns, then uids are not + comparable, so we must have CAP_SYS_PTRACE */ + if (cred->user->user_ns != pcred->user->user_ns) { + if (!ns_capable(pcred->user->user_ns, CAP_SYS_PTRACE)) + goto err_unlock; + goto ok; + } + /* If victim is in same user_ns, then uids are comparable */ if (cred->euid != pcred->euid && cred->euid != pcred->uid && - !capable(CAP_SYS_PTRACE)) + !ns_capable(pcred->user->user_ns, CAP_SYS_PTRACE)) goto err_unlock; +ok: head = p->robust_list; rcu_read_unlock(); } |