Skip to content

Missing DFidName handling, seen with REPORT_NAME #2

@tv42

Description

@tv42

If you specify fanotify::init::Flags::REPORT_NAME, the read results (can?) have a second header that contains the path segment that changed. This triggers a TooShort error (with a misleading message, since there's extra data), due to a if found != expected test.

if found != expected {
return Err(TooShort {
what: FidEvent,
found,
expected,
});
}

If I change that to if found < expected, the code works again, but ignores the extra data. Printing it out reveals the first byte is 2, hence fanotify_event_info_fid.hdr.info_type == 2, FAN_EVENT_INFO_TYPE_DFID_NAME. And it seems this library can request names, but cannot parse them.

It seems EventIterator was written to assume there's only one fanotify_event_info_fid, but as far as I understand that's not guaranteed. I would suggest the code be changed to treat it as a sequence, and silently ignore unrecognized info_type values. That change didn't up being quite trivial enough for me to program it quickly..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions