tools/testing/selftests/bpf/progs/verifier_vfs_reject.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/verifier_vfs_reject.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/progs/verifier_vfs_reject.c
Extension
.c
Size
4679 bytes
Lines
177
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

SEC("fentry/vfs_open")
__failure __msg("calling kernel function bpf_path_d_path is not allowed")
int BPF_PROG(path_d_path_kfunc_non_lsm, struct path *path, struct file *f)
{
	/* Calling bpf_path_d_path() from a non-LSM BPF program isn't permitted.
	 */
	bpf_path_d_path(path, buf, sizeof(buf));
	return 0;
}

SEC("lsm.s/inode_rename")
__failure __msg("invalid mem access 'trusted_ptr_or_null_'")
int BPF_PROG(inode_rename, struct inode *old_dir, struct dentry *old_dentry,
	     struct inode *new_dir, struct dentry *new_dentry,
	     unsigned int flags)
{
	struct inode *inode = new_dentry->d_inode;
	ino_t ino;

	ino = inode->i_ino;
	if (ino == 0)
		return -EACCES;
	return 0;
}
char _license[] SEC("license") = "GPL";

Annotation

Implementation Notes