-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libspl: getexecname() cleanup and gethostid() fixes, /proc/sys/kernel/spl/hostid fix for recent kernels in SPL #11879
Closed
nabijaczleweli
wants to merge
5
commits into
openzfs:master
from
nabijaczleweli:smart-practical-logic
Closed
libspl: getexecname() cleanup and gethostid() fixes, /proc/sys/kernel/spl/hostid fix for recent kernels in SPL #11879
nabijaczleweli
wants to merge
5
commits into
openzfs:master
from
nabijaczleweli:smart-practical-logic
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nabijaczleweli
force-pushed
the
smart-practical-logic
branch
8 times, most recently
from
April 11, 2021 01:43
74a9bdf
to
00384ce
Compare
nabijaczleweli
changed the title
libspl: getexecname() and gethostid() fixes, /proc/sys/kernel/spl/hostid fix for recent kernels in SPL
libspl: getexecname() cleanup and gethostid() fixes, /proc/sys/kernel/spl/hostid fix for recent kernels in SPL
Apr 11, 2021
nabijaczleweli
force-pushed
the
smart-practical-logic
branch
4 times, most recently
from
April 11, 2021 14:00
41fa7c3
to
ba070cb
Compare
behlendorf
reviewed
Apr 11, 2021
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
nabijaczleweli
force-pushed
the
smart-practical-logic
branch
from
April 12, 2021 08:24
413aef9
to
91b3f23
Compare
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
This fixes /proc/sys/kernel/spl/hostid on kernels with mainline commit 32927393dc1ccd60fb2bdc05b9e8e88753761469 ("sysctl: pass kernel pointers to ->proc_handler") ‒ 5.7-rc1 and up The access_ok() check in copy_to_user() in proc_copyout_string() would always fail, so all userspace reads and writes would fail with EINVAL proc_dostring() strips only the final new-line, but simple_strtoul() doesn't actually need a back-trimmed string ‒ writing "012345678 \n" is still allowed, as is "012345678zupsko", &c. This alters what happens when an invalid value is written ‒ previously it'd get set to what-ever simple_strtoul() returned (probably 0, thereby resetting it to default), now it does nothing Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11878
The kernel and user-space must agree, after all Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
nabijaczleweli
force-pushed
the
smart-practical-logic
branch
from
April 12, 2021 08:34
91b3f23
to
bdfded7
Compare
Rebased |
behlendorf
approved these changes
Apr 15, 2021
behlendorf
added
Status: Accepted
Ready to integrate (reviewed, tested)
and removed
Status: Code Review Needed
Ready for review and testing
labels
Apr 15, 2021
behlendorf
pushed a commit
that referenced
this pull request
Apr 15, 2021
Merge the actual implementations of getexecname() and slightly clean up the FreeBSD one. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11879
behlendorf
pushed a commit
that referenced
this pull request
Apr 15, 2021
This fixes /proc/sys/kernel/spl/hostid on kernels with mainline commit 32927393dc1ccd60fb2bdc05b9e8e88753761469 ("sysctl: pass kernel pointers to ->proc_handler") ‒ 5.7-rc1 and up The access_ok() check in copy_to_user() in proc_copyout_string() would always fail, so all userspace reads and writes would fail with EINVAL proc_dostring() strips only the final new-line, but simple_strtoul() doesn't actually need a back-trimmed string ‒ writing "012345678 \n" is still allowed, as is "012345678zupsko", &c. This alters what happens when an invalid value is written ‒ previously it'd get set to what-ever simple_strtoul() returned (probably 0, thereby resetting it to default), now it does nothing Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11878 Closes #11879
behlendorf
pushed a commit
that referenced
this pull request
Apr 15, 2021
Fixes get_system_hostid() if it was set via the aforementioned sysctl and simplifies the code a bit. The kernel and user-space must agree, after all. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11879
behlendorf
pushed a commit
that referenced
this pull request
Apr 15, 2021
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11879
behlendorf
pushed a commit
to behlendorf/zfs
that referenced
this pull request
Apr 21, 2021
This fixes /proc/sys/kernel/spl/hostid on kernels with mainline commit 32927393dc1ccd60fb2bdc05b9e8e88753761469 ("sysctl: pass kernel pointers to ->proc_handler") ‒ 5.7-rc1 and up The access_ok() check in copy_to_user() in proc_copyout_string() would always fail, so all userspace reads and writes would fail with EINVAL proc_dostring() strips only the final new-line, but simple_strtoul() doesn't actually need a back-trimmed string ‒ writing "012345678 \n" is still allowed, as is "012345678zupsko", &c. This alters what happens when an invalid value is written ‒ previously it'd get set to what-ever simple_strtoul() returned (probably 0, thereby resetting it to default), now it does nothing Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11878 Closes openzfs#11879
behlendorf
pushed a commit
to behlendorf/zfs
that referenced
this pull request
Apr 21, 2021
Fixes get_system_hostid() if it was set via the aforementioned sysctl and simplifies the code a bit. The kernel and user-space must agree, after all. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
behlendorf
pushed a commit
to behlendorf/zfs
that referenced
this pull request
Apr 21, 2021
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 6, 2021
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 6, 2021
Merge the actual implementations of getexecname() and slightly clean up the FreeBSD one. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 6, 2021
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 6, 2021
Merge the actual implementations of getexecname() and slightly clean up the FreeBSD one. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 6, 2021
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 6, 2021
Merge the actual implementations of getexecname() and slightly clean up the FreeBSD one. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 7, 2021
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
ghost
pushed a commit
to truenas/zfs
that referenced
this pull request
May 7, 2021
Merge the actual implementations of getexecname() and slightly clean up the FreeBSD one. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
This fixes /proc/sys/kernel/spl/hostid on kernels with mainline commit 32927393dc1ccd60fb2bdc05b9e8e88753761469 ("sysctl: pass kernel pointers to ->proc_handler") ‒ 5.7-rc1 and up The access_ok() check in copy_to_user() in proc_copyout_string() would always fail, so all userspace reads and writes would fail with EINVAL proc_dostring() strips only the final new-line, but simple_strtoul() doesn't actually need a back-trimmed string ‒ writing "012345678 \n" is still allowed, as is "012345678zupsko", &c. This alters what happens when an invalid value is written ‒ previously it'd get set to what-ever simple_strtoul() returned (probably 0, thereby resetting it to default), now it does nothing Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11878 Closes openzfs#11879
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
Fixes get_system_hostid() if it was set via the aforementioned sysctl and simplifies the code a bit. The kernel and user-space must agree, after all. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11879
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
See individual commit messages, #11878.
Description
The second patch merges the actual implementations of getexecname() (and slightly cleans up the FreeBSD one, which I haven't tested, but I can't see why it wouldn't be identical (beside maybe the header reduxion going badly)).
The third patch fixes
/proc/sys/kernel/spl/hostid
on 5.7+ kernels. I haven't actually tested this on any older kernel, but the blame ofkernel/sysctl.c#_proc_do_string()
says there's no need to worry:The fourth patch (a) fixes get_system_hostid() if it was set via the aforementioned sysctl, (b) makes it mildly faster, considering no-one sets spl_hostid, and (c) simplifies the code a bit.
The fifth patch uses the same limits in dummy tables as in the global ones.
How Has This Been Tested?
Ran the functions, they return the right results (on Linux), the module behaves right on the kernel from #11878.
Types of changes
Checklist:
Signed-off-by
.