[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210628171639.2488fdcc@canb.auug.org.au>
Date: Mon, 28 Jun 2021 17:16:39 +1000
From: Stephen Rothwell <sfr@...b.auug.org.au>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Alexey Gladkov <legion@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Next Mailing List <linux-next@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: linux-next: manual merge of the userns tree with Linus' tree
Hi all,
On Fri, 25 Jun 2021 18:22:19 +1000 Stephen Rothwell <sfr@...b.auug.org.au> wrote:
>
> Today's linux-next merge of the userns tree got a conflict in:
>
> kernel/signal.c
>
> between commits:
>
> 69995ebbb9d3 ("signal: Hand SIGQUEUE_PREALLOC flag to __sigqueue_alloc()")
> 4bad58ebc8bc ("signal: Allow tasks to cache one sigqueue struct")
> 399f8dd9a866 ("signal: Prevent sigqueue caching after task got released")
>
> from Linus' tree and commit:
>
> d64696905554 ("Reimplement RLIMIT_SIGPENDING on top of ucounts")
>
> from the userns tree.
Since commits
4bad58ebc8bc ("signal: Allow tasks to cache one sigqueue struct")
399f8dd9a866 ("signal: Prevent sigqueue caching after task got released")
have been reverted in Linus' tree, the conflict resolution is a bit
simpler now:
diff --cc kernel/signal.c
index 20d1d896d5b0,9a6dab712123..de0920353d30
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@@ -408,12 -410,11 +408,12 @@@ void task_join_group_stop(struct task_s
* appropriate lock must be held to stop the target task from exiting
*/
static struct sigqueue *
-__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit)
+__sigqueue_alloc(int sig, struct task_struct *t, gfp_t gfp_flags,
+ int override_rlimit, const unsigned int sigqueue_flags)
{
struct sigqueue *q = NULL;
- struct user_struct *user;
- int sigpending;
+ struct ucounts *ucounts = NULL;
+ long sigpending;
/*
* Protect access to @t credentials. This can go away when all
@@@ -424,27 -425,26 +424,26 @@@
* changes from/to zero.
*/
rcu_read_lock();
- user = __task_cred(t)->user;
- sigpending = atomic_inc_return(&user->sigpending);
+ ucounts = task_ucounts(t);
+ sigpending = inc_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_SIGPENDING, 1);
if (sigpending == 1)
- get_uid(user);
+ ucounts = get_ucounts(ucounts);
rcu_read_unlock();
- if (override_rlimit || likely(sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) {
+ if (override_rlimit || (sigpending < LONG_MAX && sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) {
- q = kmem_cache_alloc(sigqueue_cachep, flags);
+ q = kmem_cache_alloc(sigqueue_cachep, gfp_flags);
} else {
print_dropped_signal(sig);
}
if (unlikely(q == NULL)) {
- if (atomic_dec_and_test(&user->sigpending))
- free_uid(user);
+ if (ucounts && dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_SIGPENDING, 1))
+ put_ucounts(ucounts);
} else {
INIT_LIST_HEAD(&q->list);
- q->flags = 0;
+ q->flags = sigqueue_flags;
- q->user = user;
+ q->ucounts = ucounts;
}
-
return q;
}
--
Cheers,
Stephen Rothwell
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists