• Daniel Borkmann's avatar
    bpf, inode: add support for symlinks and fix mtime/ctime · 0f98621b
    Daniel Borkmann authored
    While commit bb35a6ef ("bpf, inode: allow for rename and link ops")
    added support for hard links that can be used for prog and map nodes,
    this work adds simple symlink support, which can be used f.e. for
    directories also when unpriviledged and works with cmdline tooling that
    understands S_IFLNK anyway. Since the switch in e27f4a94 ("bpf: Use
    mount_nodev not mount_ns to mount the bpf filesystem"), there can be
    various mount instances with mount_nodev() and thus hierarchy can be
    flattened to facilitate object sharing. Thus, we can keep bpf tooling
    also working by repointing paths.
    
    Most of the functionality can be used from vfs library operations. The
    symlink is stored in the inode itself, that is in i_link, which is
    sufficient in our case as opposed to storing it in the page cache.
    While at it, I noticed that bpf_mkdir() and bpf_mkobj() don't update
    the directories mtime and ctime, so add a common helper for it called
    bpf_dentry_finalize() that takes care of it for all cases now.
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    0f98621b
inode.c 8.11 KB