All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Modify hardcode to SECCOMP_MODE_FILTER
@ 2020-12-17  8:46 Zhuling
  0 siblings, 0 replies; only message in thread
From: Zhuling @ 2020-12-17  8:46 UTC (permalink / raw)
  To: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, linux-kernel, netdev, bpf
  Cc: luanjianhai, luchunhua, zhuling8

From: zhuling <zhuling8@huawei.com>

    bpf/seccomp: modify hardcode 2 to SECCOMP_MODE_FILTER

    while the hardcode 2 has been define in seccomp_bpf.c, we should use
the definitions(SECCOMP_MODE_FILTER) instead of hardcode 2.

Signed-off-by: zhuling <zhuling8@huawei.com>
---
 samples/bpf/tracex5_user.c | 2 +-
 samples/seccomp/dropper.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/samples/bpf/tracex5_user.c b/samples/bpf/tracex5_user.c
index c17d3fb..417753f 100644
--- a/samples/bpf/tracex5_user.c
+++ b/samples/bpf/tracex5_user.c
@@ -28,7 +28,7 @@ static void install_accept_all_seccomp(void)
 		.len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
 		.filter = filter,
 	};
-	if (prctl(PR_SET_SECCOMP, 2, &prog))
+	if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog))
 		perror("prctl");
 }

diff --git a/samples/seccomp/dropper.c b/samples/seccomp/dropper.c
index cc0648e..08f8e7f 100644
--- a/samples/seccomp/dropper.c
+++ b/samples/seccomp/dropper.c
@@ -46,7 +46,7 @@ static int install_filter(int nr, int arch, int error)
 		perror("prctl(NO_NEW_PRIVS)");
 		return 1;
 	}
-	if (prctl(PR_SET_SECCOMP, 2, &prog)) {
+	if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) {
 		perror("prctl(PR_SET_SECCOMP)");
 		return 1;
 	}
--
2.9.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-17  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17  8:46 [PATCH] Modify hardcode to SECCOMP_MODE_FILTER Zhuling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.