Skip to content

Missing openat syscall is blocking grep #946

@rishabhBudhouliya

Description

@rishabhBudhouliya

Issue

Currently, we stub the openat syscall with SYSCALL_CANCEL which is causing grep to fail as it uses openat with AT_FDCWD flag.

__libc_openat (int fd, const char *file, int oflag, ...)
{
mode_t mode = 0;
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
mode = va_arg (arg, mode_t);
va_end (arg);
}
return SYSCALL_CANCEL (openat, fd, file, oflag, mode);

Proposed fix:

I already tested grep successfully by adding

  if (fd == AT_FDCWD)
      return __libc_openat (file, oflag, mode);

to

  • src/glibc/sysdeps/unix/sysv/linux/openat.c
  • src/glibc/sysdeps/unix/sysv/linux/openat64.c
  • src/glibc/sysdeps/unix/sysv/linux/openat_nocancel.c
  • src/glibc/sysdeps/unix/sysv/linux/openat64_nocancel.c

@rennergade and @Yaxuan-w wanted your advice on whether this is the right approach to fix this problem or should we implement openat syscall at RawPOSIX level?

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