thread fixes v5.6-rc6
Hey Linus,
/* Summary */
This contains a single fix for a regression which was introduced when we introduced the ability to select a specific pid at process creation time. When this feature is requested, the error value will be set to -EPERM after exiting the pid allocation loop. This caused EPERM to be returned when e.g. the init process/child subreaper of the pid namespace has already died where we used to return ENOMEM before.
The first patch here simply fixes the regression by unconditionally setting the return value back to ENOMEM again once we've successfully allocated the requested pid number. This should be easy to backport to v5.5.
The second patch adds a comment explaining that we must keep returning ENOMEM since we've been doing it for a long time and have explicitly documented this behavior for userspace. This seemed worthwhile because we now have at least two separate example where people tried to change the return value to something other than ENOMEM (The first version of the regression fix did that too and the commit message links to an earlier patch that tried to do the same.).
I have a simple regression test to make sure we catch this regression in the future but since that introduces a whole new selftest subdir and test files I'll keep this for v5.7.
/* Testing */
All patches have seen exposure in linux-next and are based on v5.6-rc1. I've had a build warning reported to me for the first version of the second patch two days ago that tried to remove the unconditional initalization but that's fixed and linux-next seemed happy. The second patch is now a pure non-functional change.
/* Conflicts */
At the time of creating this pr no merge conflicts were reported with anything that is expected to land this merge window.
The following changes since commit 98d54f81e36ba3bf92172791eba5ca5bd813989b:
Linux 5.6-rc4 (2020-03-01 16:38:46 -0600)
are available in the Git repository at:
[email protected]:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-2020-03-10
for you to fetch changes up to 10dab84caf400f2f5f8b010ebb0c7c4272ec5093:
pid: make ENOMEM return value more obvious (2020-03-09 23:40:05 +0100)
Please consider pulling these changes from the signed for-linus-2020-03-10 tag.
Thanks!
Christian
----------------------------------------------------------------
for-linus-2020-03-10
----------------------------------------------------------------
Christian Brauner (1):
pid: make ENOMEM return value more obvious
Corey Minyard (1):
pid: Fix error return value in some cases
kernel/pid.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
The pull request you sent on Wed, 11 Mar 2020 16:44:05 +0100:
The pull request you sent on Wed, 11 Mar 2020 16:44:05 +0100:
Quoted 1 line
[email protected]:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-2020-03-10
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/addcb1d0ee31aa1472a7afd31a63162423af9c93
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Quoted 20 lines · Christian Brauner
Hey Linus,
/* Summary */
This contains a single fix for a regression which was introduced when we introduced the ability to select a specific pid at process creation time. When this feature is requested, the error value will be set to-EPERMafter exiting the pid allocation loop. This caused EPERM to be returned when e.g. the init process/child subreaper of the pid namespace has already died where we used to return ENOMEM before.
The first patch here simply fixes the regression by unconditionally setting the return value back to ENOMEM again once we've successfully allocated the requested pid number. This should be easy to backport to v5.5.The second patch adds a comment explaining that we must keep returning ENOMEM since we've been doing it for a long time and have explicitly documented this behavior for userspace. This seemed worthwhile because we now have at least two separate example where people tried to change the return value to something other than ENOMEM (The first version of the regression fix did that too and the commit message links to an earlier patch that tried to do the same.).
Quoted 6 lines
I have a simple regression test to make sure we catch this regression in the future but since that introduces a whole new selftest subdir and test files I'll keep this for v5.7.
/* Testing */
All patches have seen exposure in linux-next and are based on v5.6-rc1.
Hm, just noticed this was supposed to be v5.6-rc4 as can be seen from the base commit below. Missed to update it.
Quoted 39 lines
I've had a build warning reported to me for the first version of the second patch two days ago that tried to remove the unconditional initalization but that's fixed and linux-next seemed happy. The second patch is now a pure non-functional change.
/* Conflicts */
At the time of creating this pr no merge conflicts were reported with anything that is expected to land this merge window.The following changes since commit
98d54f81e36ba3bf92172791eba5ca5bd813989b:Linux 5.6-rc4 (2020-03-01 16:38:46 -0600)
are available in the Git repository at:
[email protected]:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-2020-03-10
for you to fetch changes up to
10dab84caf400f2f5f8b010ebb0c7c4272ec5093:pid: make ENOMEM return value more obvious (2020-03-09 23:40:05 +0100)
Please consider pulling these changes from the signed for-linus-2020-03-10 tag.
Thanks!
Christian----------------------------------------------------------------
for-linus-2020-03-10----------------------------------------------------------------
Christian Brauner (1):
pid: make ENOMEM return value more obviousCorey Minyard (1):
pid: Fix error return value in some caseskernel/pid.c | 10 ++++++++++ 1 file changed, 10 insertions(+)