https://bugs.kde.org/show_bug.cgi?id=507873

            Bug ID: 507873
           Summary: fchmodat fchmodat2 should handle AT_FDCWD and absolute
                    paths
    Classification: Developer tools
           Product: valgrind
      Version First 3.25 GIT
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

There are two syscalls fchmodat and fchmodat2 but only one glibc wrapper:
int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);

The PRE wrappers in coregrind/m_syswrap/syswrap-linux.c simply do:

   if ( !ML_(fd_allowed)(SARG1, "fchmodat", tid, False) )
     SET_STATUS_Failure( VKI_EBADF );

   if ( !ML_(fd_allowed)(SARG1, "fchmodat2", tid, False) )
     SET_STATUS_Failure( VKI_EBADF );

This doesn't handle AT_FDCWD or absolute paths (then fd should be ignored).

fchmodat01.c:47: TFAIL: fchmodat(-100, fchmodatdir/fchmodatfile, 0600, 0)
failed: EBADF (9)
fchmodat02.c:55: TFAIL: fchmodat() with invalid flag expected EINVAL: EBADF (9)

Note that the fchmodat2 testcases don't seem to check for AT_FDCWD or absolute
paths.

This also seems to cause a lot of arm64 LTP failures

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to