* [GIT PULL] ucount fixes for v5.15
@ 2021-10-21 16:02 Eric W. Biederman
2021-10-22 3:35 ` Linus Torvalds
2021-10-22 5:10 ` pr-tracker-bot
0 siblings, 2 replies; 4+ messages in thread
From: Eric W. Biederman @ 2021-10-21 16:02 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Alexey Gladkov, Rune Kleveland, Yu Zhao,
Jordan Glover, Antoine Martin, David Howells, Jarkko Sakkinen
Linus,
Please pull the ucount-fixes-for-v5.15 branch from the git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git ucount-fixes-for-v5.15
HEAD: 5ebcbe342b1c12fae44b4f83cbeae1520e09857e ucounts: Move get_ucounts from cred_alloc_blank to key_change_session_keyring
There has been one very hard to track down bug in the ucount code that
we have been tracking since roughly v5.14 was released. Alex managed to
find a reliable reproducer a few days ago and then I was able to
instrument the code and figure out what the issue was.
It turns out the sigqueue_alloc single atomic operation optimization did
not play nicely with ucounts multiple level rlimits. It turned out that
either sigqueue_alloc or sigqueue_free could be operating on multiple
levels and trigger the conditions for the optimization on more than one
level at the same time.
To deal with that situation I have introduced inc_rlimit_get_ucounts
and dec_rlimit_put_ucounts that just focuses on the optimization and
the rlimit and ucount changes.
While looking into the big bug I found I couple of other little issues
so I am including those fixes here as well.
When I have time I would very much like to dig into process ownership of
the shared signal queue and see if we could pick a single owner for the
entire queue so that all of the rlimits can count to that owner. Which
should entirely remove the need to call get_ucounts and put_ucounts
in sigqueue_alloc and sigqueue_free. It is difficult because Linux
unlike POSIX supports setuid that works on a single thread.
Eric W. Biederman (4):
ucounts: Fix signal ucount refcounting
ucounts: Pair inc_rlimit_ucounts with dec_rlimit_ucoutns in commit_creds
ucounts: Proper error handling in set_cred_ucounts
ucounts: Move get_ucounts from cred_alloc_blank to key_change_session_keyring
kernel/cred.c | 9 ++++-----
security/keys/process_keys.c | 8 ++++++++
2 files changed, 12 insertions(+), 5 deletions(-)
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GIT PULL] ucount fixes for v5.15
2021-10-21 16:02 [GIT PULL] ucount fixes for v5.15 Eric W. Biederman
@ 2021-10-22 3:35 ` Linus Torvalds
2021-10-22 14:59 ` Eric W. Biederman
2021-10-22 5:10 ` pr-tracker-bot
1 sibling, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2021-10-22 3:35 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Linux Kernel Mailing List, Alexey Gladkov, Rune Kleveland,
Yu Zhao, Jordan Glover, Antoine Martin, David Howells,
Jarkko Sakkinen
On Thu, Oct 21, 2021 at 6:04 AM Eric W. Biederman <ebiederm@xmission.com> wrote:
>
> kernel/cred.c | 9 ++++-----
> security/keys/process_keys.c | 8 ++++++++
> 2 files changed, 12 insertions(+), 5 deletions(-)
That's not remotely the right diffstat.
What's going on?
The shortlog was correct, and I pulled the branch, because everything
else looked ok, but that diffstat in the pull request was some
complete fantasy.
If I were to guess, I think the diffstat may be everything _but_ that
first ("ucounts: Fix signal ucount refcounting") fix. I just don't see
how/why you'd get that as part of the pull request.
Linus
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GIT PULL] ucount fixes for v5.15
2021-10-21 16:02 [GIT PULL] ucount fixes for v5.15 Eric W. Biederman
2021-10-22 3:35 ` Linus Torvalds
@ 2021-10-22 5:10 ` pr-tracker-bot
1 sibling, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2021-10-22 5:10 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Linus Torvalds, linux-kernel, Alexey Gladkov, Rune Kleveland,
Yu Zhao, Jordan Glover, Antoine Martin, David Howells,
Jarkko Sakkinen
The pull request you sent on Thu, 21 Oct 2021 11:02:14 -0500:
> git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git ucount-fixes-for-v5.15
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/9d235ac01f54e8f8c1d967b25ac29e4313a41c5c
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GIT PULL] ucount fixes for v5.15
2021-10-22 3:35 ` Linus Torvalds
@ 2021-10-22 14:59 ` Eric W. Biederman
0 siblings, 0 replies; 4+ messages in thread
From: Eric W. Biederman @ 2021-10-22 14:59 UTC (permalink / raw)
To: Linus Torvalds
Cc: Linux Kernel Mailing List, Alexey Gladkov, Rune Kleveland,
Yu Zhao, Jordan Glover, Antoine Martin, David Howells,
Jarkko Sakkinen
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Thu, Oct 21, 2021 at 6:04 AM Eric W. Biederman <ebiederm@xmission.com> wrote:
>>
>> kernel/cred.c | 9 ++++-----
>> security/keys/process_keys.c | 8 ++++++++
>> 2 files changed, 12 insertions(+), 5 deletions(-)
>
> That's not remotely the right diffstat.
>
> What's going on?
Sigh. I sent the diffstat from when I sent the additional patches
out for review instead of the diffstat for the entire branch I was
asking you to pull.
I really should have named things differently on my end when I sent
the additional changes out for review.
The correct diffstat should have been.
include/linux/user_namespace.h | 2 ++
kernel/cred.c | 9 ++++----
kernel/signal.c | 25 ++++++---------------
kernel/ucount.c | 49 ++++++++++++++++++++++++++++++++++++++++++
security/keys/process_keys.c | 8 +++++++
5 files changed, 69 insertions(+), 24 deletions(-)
> The shortlog was correct, and I pulled the branch, because everything
> else looked ok, but that diffstat in the pull request was some
> complete fantasy.
>
> If I were to guess, I think the diffstat may be everything _but_ that
> first ("ucounts: Fix signal ucount refcounting") fix. I just don't see
> how/why you'd get that as part of the pull request.
You are exactly right.
My apologies for the confusion.
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-22 15:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 16:02 [GIT PULL] ucount fixes for v5.15 Eric W. Biederman
2021-10-22 3:35 ` Linus Torvalds
2021-10-22 14:59 ` Eric W. Biederman
2021-10-22 5:10 ` pr-tracker-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.