Skip to content

eBPF-based security platform

treewide: name the seal xattr XATTR_SEAL in userspace too

Daniel Borkmann8c8908cfe102
diff --git a/testing/helper/test-seal.c b/testing/helper/test-seal.c
index 188def62..1511bce0 100644
--- a/testing/helper/test-seal.c
+++ b/testing/helper/test-seal.c
@@ -36,7 +36,7 @@ static void show_label(const char *path)
char label[128];
ssize_t n;
- n = lgetxattr(path, XATTR_NAME, label, sizeof(label) - 1);
+ n = lgetxattr(path, XATTR_SEAL, label, sizeof(label) - 1);
if (n < 0) {
printf("label=none\n");
return;
diff --git a/util/image_cache.c b/util/image_cache.c
index c7c66da6..c51d77ef 100644
--- a/util/image_cache.c
+++ b/util/image_cache.c
@@ -133,7 +133,7 @@ static int fetch_file(const char *source, const char *destination, __u64 max)
if (fd < 0)
return -errno;
download.fd = fd;
- ret = fsetxattr(fd, XATTR_NAME, SEAL_LABEL,
+ ret = fsetxattr(fd, XATTR_SEAL, SEAL_LABEL,
strlen(SEAL_LABEL), 0) ? -errno : 0;
if (!ret)
ret = !strncmp(source, "https://", 8) ?
diff --git a/util/image_runtime.c b/util/image_runtime.c
index 432bfb24..f2f3d0f0 100644
--- a/util/image_runtime.c
+++ b/util/image_runtime.c
@@ -392,7 +392,7 @@ int image_runtime_mount(void)
static int seal_fd(void *ctx, int fd)
{
- return fsetxattr(fd, XATTR_NAME, SEAL_LABEL,
+ return fsetxattr(fd, XATTR_SEAL, SEAL_LABEL,
strlen(SEAL_LABEL), 0) ?
-errno :
0;
diff --git a/util/paths.h b/util/paths.h
index 1b8b7db2..2aac1dc3 100644
--- a/util/paths.h
+++ b/util/paths.h
@@ -117,7 +117,7 @@
#define SIGNING_KEY_FILE "signing_key.pem"
#define SIGNING_KEY_PATH KEYS_DIR "/" SIGNING_KEY_FILE
-#define XATTR_NAME "security.bpf.shirudo"
+#define XATTR_SEAL "security.bpf.shirudo"
#define XATTR_POLICY "security.bpf.shirudo.policy"
/*
diff --git a/util/seal.c b/util/seal.c
index c1182a8f..53f30f76 100644
--- a/util/seal.c
+++ b/util/seal.c
@@ -28,7 +28,7 @@
int seal_label(const char *path)
{
- if (lsetxattr(path, XATTR_NAME, SEAL_LABEL,
+ if (lsetxattr(path, XATTR_SEAL, SEAL_LABEL,
sizeof(SEAL_LABEL) - 1, 0) != 0)
return -errno;
return 0;
@@ -127,13 +127,13 @@ static ssize_t seal_label_len(ssize_t n)
static ssize_t seal_fget(int fd, char label[SEAL_LABEL_LEN])
{
- return seal_label_len(fgetxattr(fd, XATTR_NAME, label,
+ return seal_label_len(fgetxattr(fd, XATTR_SEAL, label,
SEAL_LABEL_LEN));
}
static ssize_t seal_lget(const char *path, char label[SEAL_LABEL_LEN])
{
- return seal_label_len(lgetxattr(path, XATTR_NAME, label,
+ return seal_label_len(lgetxattr(path, XATTR_SEAL, label,
SEAL_LABEL_LEN));
}
@@ -253,7 +253,7 @@ int seal_inherit(int dfd, int fd)
return (int)olen;
if (olen == plen && !memcmp(parent, own, (size_t)plen))
return 0;
- if (fsetxattr(fd, XATTR_NAME, parent, (size_t)plen, 0))
+ if (fsetxattr(fd, XATTR_SEAL, parent, (size_t)plen, 0))
return -errno;
return 0;
}
@@ -277,7 +277,7 @@ int seal_inherit_path(const char *path)
return (int)olen;
if (olen == plen && !memcmp(parent, own, (size_t)plen))
return 0;
- if (lsetxattr(path, XATTR_NAME, parent, (size_t)plen, 0))
+ if (lsetxattr(path, XATTR_SEAL, parent, (size_t)plen, 0))
return -errno;
return 0;
}
@@ -299,7 +299,7 @@ static int seal_regular(int fd)
/* 1 for a label of any size, 0 for none, -errno when unreadable. */
static int seal_fsealed(int fd)
{
- if (fgetxattr(fd, XATTR_NAME, NULL, 0) >= 0)
+ if (fgetxattr(fd, XATTR_SEAL, NULL, 0) >= 0)
return 1;
return errno == ENODATA || errno == ENOTSUP ? 0 : -errno;
}