Linux 5.6 Kernel Adds New System Call For "openat2" - More Extensible openat()

Written by Michael Larabel in Linux Kernel on 29 January 2020 at 11:48 AM EST. 1 Comment
LINUX KERNEL
A new system call added to the very feature rich Linux 5.6 kernel is openat2() for more extensible behavior compared to the existing openat() functionality.

The openat() system call has long existed as similar to open() but allowing relative paths to the directory stipulated by the passed file descriptor. With time trying to extend openat() has led to headaches for developers that is now made more extensible with openat2().

The openat2() system call allows returning an error when an invalid flag is passed (a previous issue with openat in not knowing whether a given flag was supported by the current kernel) and making the syscall more extensible for handling future file-system features. Openat2 is explained in more detail via this Git commit.

Al Viro sent in the openat2() support via this pull request. As part of the openat2() series is also new resolution restriction flags for protecting against difference race conditions and attack scenarios. Among those flags that can be passed to openat2() allow for blocking symlink traversals, blocking magic link traversals, blocking VFS mount traversals, and blocking any path components resolving outside the starting point of the resolution.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week