From: Stephen Rothwell <sfr@canb.auug.org.au>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexey Gladkov <legion@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: linux-next: manual merge of the userns tree with Linus' tree
Date: Mon, 28 Jun 2021 17:16:39 +1000 [thread overview]
Message-ID: <20210628171639.2488fdcc@canb.auug.org.au> (raw)
In-Reply-To: <20210625182219.1a2ae36e@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]
Hi all,
On Fri, 25 Jun 2021 18:22:19 +1000 Stephen Rothwell <sfr@canb.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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-06-28 7:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-25 8:22 linux-next: manual merge of the userns tree with Linus' tree Stephen Rothwell
2021-06-28 7:16 ` Stephen Rothwell [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-05-26 4:51 Stephen Rothwell
2021-05-26 4:38 Stephen Rothwell
2021-05-26 4:32 Stephen Rothwell
2016-11-22 8:17 Stephen Rothwell
2016-11-22 17:44 ` Eric W. Biederman
2016-11-22 22:56 ` Stephen Rothwell
2016-07-08 6:13 Stephen Rothwell
2016-06-24 4:41 Stephen Rothwell
2014-04-17 5:06 Stephen Rothwell
2014-04-17 5:25 ` Al Viro
2014-04-17 8:44 ` Eric W. Biederman
2014-04-22 1:37 ` Stephen Rothwell
2014-04-09 2:45 Stephen Rothwell
2014-04-09 2:40 Stephen Rothwell
2014-04-09 2:39 Stephen Rothwell
2012-05-22 7:44 Stephen Rothwell
2012-05-22 14:29 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210628171639.2488fdcc@canb.auug.org.au \
--to=sfr@canb.auug.org.au \
--cc=ebiederm@xmission.com \
--cc=legion@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).