Skip to content

Commit d687b7f

Browse files
authored
Merge pull request #48 from NationalSecurityAgency/compatibility-fixes
Compatibility fixes
2 parents ea4c73b + d2df8c3 commit d687b7f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

bpf/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const HAS_TASK_STORAGE_MAP: &str = "BPF_MAP_TYPE_TASK_STORAGE";
1313
const HAS_BPF_MAP_CREATE: &str = "bpf_map_create";
1414
const HAS_INODE_SETATTR_IDMAP: &str =
1515
"(*inode_setattr)(struct mnt_idmap *, struct dentry *, struct iattr *)";
16+
const HAS_INODE_SETXATTR_IDMAP: &str = "(*inode_setxattr)(struct mnt_idmap *, struct dentry *, const char *, const void *, size_t, int)";
1617

1718
/// Tells Cargo to rerun the build if the supplied file has changed
1819
fn track_file(header: &str) {
@@ -190,6 +191,7 @@ fn detect_vmlinux_features(vmlinux: &PathBuf) -> Result<HashSet<String>> {
190191
HAS_BPF_MAP_CREATE,
191192
HAS_INODE_SETATTR_IDMAP,
192193
HAS_TASK_STORAGE_MAP,
194+
HAS_INODE_SETXATTR_IDMAP,
193195
] {
194196
if line.contains(feat) {
195197
found.insert(feat.to_string());
@@ -219,6 +221,8 @@ fn export_features_to_header(features: HashSet<String>, out_path: &Path) -> Resu
219221
writeln!(f, "#define HAS_BPF_MAP_CREATE")?;
220222
} else if flag.contains(HAS_INODE_SETATTR_IDMAP) {
221223
writeln!(f, "#define HAS_INODE_SETATTR_IDMAP")?;
224+
} else if flag.contains(HAS_INODE_SETXATTR_IDMAP) {
225+
writeln!(f, "#define HAS_INODE_SETXATTR_IDMAP")?;
222226
}
223227
}
224228

bpf/src/seabee/seabee.bpf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,15 @@ int BPF_PROG(seabee_inode_setattr, struct dentry *dentry, struct iattr *attr)
418418
* @param dentry file
419419
*/
420420
SEC("lsm/inode_setxattr")
421+
#ifdef HAS_INODE_SETXATTR_IDMAP
421422
int BPF_PROG(seabee_inode_setxattr, struct mnt_idmap *idmap,
422423
struct dentry *dentry, const char *name, const void *value,
423424
size_t size, int flags)
425+
#else
426+
int BPF_PROG(seabee_inode_setxattr, struct user_namespace *mnt_userns,
427+
struct dentry *dentry, const char *name, const void *value,
428+
size_t size, int flags)
429+
#endif
424430
{
425431
return decide_inode_access(INODE_SETXATTR, dentry->d_inode,
426432
dentry->d_name.name);

scripts/update_root_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ docker_install() {
113113
elif [ $USE_DNF -eq 1 ]; then
114114
dnf -y install dnf-plugins-core
115115
if command -v dnf5 &>/dev/null; then
116-
dnf config-manager addrepo https://download.docker.com/linux/"$DISTRO"/docker-ce.repo
116+
dnf config-manager addrepo --from-repofile=https://download.docker.com/linux/"$DISTRO"/docker-ce.repo
117117
else
118118
dnf config-manager --add-repo https://download.docker.com/linux/"$DISTRO"/docker-ce.repo
119119
fi

0 commit comments

Comments
 (0)