-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8357425: (fs) SecureDirectoryStream setPermissions should use fchmodat #25534
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
base: master
Are you sure you want to change the base?
8357425: (fs) SecureDirectoryStream setPermissions should use fchmodat #25534
Conversation
👋 Welcome back bpb! A progress list of the required criteria for merging this PR into |
@bplb This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 40 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
The |
Webrevs
|
src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java
Outdated
Show resolved
Hide resolved
int err; | ||
const char* path = (const char*)jlong_to_ptr(pathAddress); | ||
|
||
RESTARTABLE(fchmodat((int)fd, path, (mode_t)mode, (int)flag), err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MBaesken Do you want to confirm that this will build/run on AIX?
Hi Alan, thanks for reaching out.
|
Thanks for checking. The newDirectoryStream methods return a SecureDirectoryStream on platforms that support all the "at" syscalls (list is in UnixNativeDispatcher.c) so I think it means that it is not supported on AIX because some of the "at" calls don't exist. In that case, once it builds it is okay. |
Note that I did not add |
It is supported on AIX 7.1.0 which dates from September 2010. |
Right, and another option to be to not introduce a new capability but it have it covered by SUPPORTS_OPENAT. |
I thought of that but the code might be less clean. I will revisit the idea. |
The pertinent code in
Maybe the list of "at" syscalls needs to be reexamined and/or made more fine grained (not for this PR)? |
Set<PosixFilePermission> noperms = EnumSet.noneOf(PosixFilePermission.class); | ||
Set<PosixFilePermission> permsDir = getPosixFilePermissions(aDir); | ||
|
||
SecureDirectoryStream<Path> stream = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are doing any more edits then you can change this to use try-with-resources.
Okay, let's go with what you have for now and we can mull over re-visiting this list. It dates from when the support for the "at" functions varied across operating systems and versions. |
Modify to use the
fchmodat(2)
system call to set permissions where possible to do so. This fixes the problem presented in the issue description.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25534/head:pull/25534
$ git checkout pull/25534
Update a local copy of the PR:
$ git checkout pull/25534
$ git pull https://git.openjdk.org/jdk.git pull/25534/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25534
View PR using the GUI difftool:
$ git pr show -t 25534
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25534.diff
Using Webrev
Link to Webrev Comment