-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
tools/opensnoop: Display mode for -e, --extended_fields #5196
base: master
Are you sure you want to change the base?
Conversation
Could you include in the commit message when it is useful to output MODE information, which can be verified outside of the tool, within the tool itself? |
906a2a1
to
761d813
Compare
Thanks, I just add the extra information. |
761d813
to
8ed67b4
Compare
Rebase to master |
8ed67b4
to
c188aaa
Compare
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.
Although for struct open_how, it uses __u64 for flags and mode, but
in reality, mode value should be still within 32bit range.
So I suggest to change 'mode' type to __u32 (unsigned int) instead of 'unsigned short'.
c188aaa
to
bbaa9ed
Compare
bbaa9ed
to
12cd1a7
Compare
When a program creates a file with mode=0000, it cannot even access the file itself. It would be helpful if we could track the mode value. so we can know who did it. Example: open("a.txt", O_WRONLY | O_EXCL | O_CREAT, 0000); Then: $ ls -l a.txt ----------. 1 rongtao rongtao 0 Jan 24 09:07 a.txt $ cat a.txt cat: a.txt: Permission denied $ sudo ./opensnoop.py -e PID COMM FD ERR FLAGS MODE PATH 673067 open 3 0 00000301 n/a a.txt ^^^^ If flags is an illegal value, displaying the mode value can better handle the relationship between flags and mode. After all, mode is only effective when flags only contains O_TMPFILE or O_CREAT. Signed-off-by: Rong Tao <[email protected]>
12cd1a7
to
39d6351
Compare
When a program creates a file with mode=0000, it cannot even access the file
itself. It would be helpful if we could track the mode value. so we can know
who did it.