Bug 493507

Summary: direct readlink syscall from PRE handler is incompatible with FUSE_COMPATIBLE_MAY_BLOCK
Product: [Developer tools] valgrind Reporter: Mark Wielaard <mark>
Component: generalAssignee: Mark Wielaard <mark>
Status: RESOLVED FIXED    
Severity: normal CC: fweimer
Priority: NOR    
Version First Reported In: 3.24 GIT   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=493454
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Implement /proc/self/exe readlink[at] fallback in POST handler

Description Mark Wielaard 2024-09-22 22:14:23 UTC
Created attachment 173980 [details]
Implement /proc/self/exe readlink[at] fallback in POST handler

The generic and linux readlink[at] syscall PRE handler calls readlink[at] directly. This is incompatible with the FUSE_COMPATIBLE_MAY_BLOCK flag. Resolve this by adding a POST handler and only do a direct readlink[at] call (in the POST handler) if we need the /proc/self/exe fallback.
Comment 1 Mark Wielaard 2024-10-05 12:53:56 UTC
commit 0690dc39644d15fc89813419ffcdf9754b098260
Author: Mark Wielaard <mark@klomp.org>
Date:   Sun Sep 22 23:24:34 2024 +0200

    Implement /proc/self/exe readlink[at] fallback in POST handler
    
    Calling the readlink[at] syscall directly from the PRE handler defeats
    the FUSE_COMPATIBLE_MAY_BLOCK (SfMayBlock) flag. Add a POST handler
    that only explicitly calls the readlink[at] handler for the
    /proc/self/exe fallback (this should be fine unless /proc is also
    implemented as fuse in this process).
    
    Adjust readlink[at] GENX_ and LINX_ syswrap macros to GENXY and LINXY.
    
    https://bugs.kde.org/show_bug.cgi?id=493507