Skip to content
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: Fix bad mode value #5205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Rtoax
Copy link
Contributor

@Rtoax Rtoax commented Feb 5, 2025

O_TMPFILE = 020200000 = __O_TMPFILE | O_DIRECTORY

If flag contains only O_DIRECTORY, the mode value is invalid. The mode value is valid only when flag contains both __O_TMPFILE and O_DIRECTORY.

For example, 02204000 only contains __O_TMPFILE or O_DIRECTORY, will get bad random mode value:

$ sudo ./opensnoop.py -e
PID    COMM               FD ERR FLAGS    MODE PATH
1325   in:imjournal      108   0 02000101 146720225 /var/lib/rsyslog/imjournal.state.tmp
                                  ^
                                  __O_TMPFILE

927848 cgroupify           5   0 02204000 22343344131 .
                                   ^
                                   O_DIRECTORY

Fix: commit e80ad4d ("tools/opensnoop: Display mode for -e, --extended_fields (#5196)")

O_TMPFILE = 020200000 = __O_TMPFILE | O_DIRECTORY

If flag contains only O_DIRECTORY, the mode value is invalid. The mode value is
valid only when flag contains both __O_TMPFILE and O_DIRECTORY.

For example, 02204000 only contains __O_TMPFILE or O_DIRECTORY, will get bad
random mode value:

    $ sudo ./opensnoop.py -e
    PID    COMM               FD ERR FLAGS    MODE PATH
    1325   in:imjournal      108   0 02000101 146720225 /var/lib/rsyslog/imjournal.state.tmp
                                      ^
                                      __O_TMPFILE

    927848 cgroupify           5   0 02204000 22343344131 .
                                       ^
                                       O_DIRECTORY

Fix: commit e80ad4d ("tools/opensnoop: Display mode for -e, --extended_fields (iovisor#5196)")
Signed-off-by: Rong Tao <[email protected]>
@Rtoax Rtoax force-pushed the patch-79-tools-opensnoop-bugfix branch from e6811b3 to d82c3a8 Compare February 5, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant