]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
bpf, inode: add support for symlinks and fix mtime/ctime
authorDaniel Borkmann <daniel@iogearbox.net>
Sat, 29 Oct 2016 00:30:46 +0000 (02:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Oct 2016 19:28:11 +0000 (15:28 -0400)
commit0f98621bef5d2b7ad41f6595899660af344f5016
treec3d3b65b840a10d2baf6f3e7e053017b8ba5204a
parent8778b276645bb156b00d72275541a4e4b188d6dc
bpf, inode: add support for symlinks and fix mtime/ctime

While commit bb35a6ef7da4 ("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 e27f4a942a0e ("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: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/inode.c