From: Stephen Kitt <steve@sk2.org>
To: Alejandro Colomar <alx.manpages@gmail.com>,
Michael Kerrisk <mtk.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, Stephen Kitt <steve@sk2.org>
Subject: [PATCH 2/9] seccomp.2: Use syscall() in the example code
Date: Fri, 7 Jan 2022 17:46:14 +0100 [thread overview]
Message-ID: <20220107164621.275794-2-steve@sk2.org> (raw)
In-Reply-To: <20220107164621.275794-1-steve@sk2.org>
Since seccomp() doesn't exist in glibc, avoid relying on it, and use
syscall() instead. This updates the example program to match the
documentation, which was updated in commit 5945cd7bd3c3 ("seccomp.2:
Use syscall(SYS_...); for system calls without a wrapper").
Signed-off-by: Stephen Kitt <steve@sk2.org>
---
man2/seccomp.2 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/man2/seccomp.2 b/man2/seccomp.2
index a3421871f..67928ed3f 100644
--- a/man2/seccomp.2
+++ b/man2/seccomp.2
@@ -1133,6 +1133,7 @@ cecilia
#include <linux/filter.h>
#include <linux/seccomp.h>
#include <sys/prctl.h>
+#include <sys/syscall.h>
#define X32_SYSCALL_BIT 0x40000000
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
@@ -1190,7 +1191,7 @@ install_filter(int syscall_nr, int t_arch, int f_errno)
.filter = filter,
};
- if (seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog)) {
+ if (syscall(SYS_seccomp, SECCOMP_SET_MODE_FILTER, 0, &prog)) {
perror("seccomp");
return 1;
}
--
2.30.2
next prev parent reply other threads:[~2022-01-07 16:53 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 16:46 [PATCH 1/9] Add a target to check example programs Stephen Kitt
2022-01-07 16:46 ` Stephen Kitt [this message]
2022-01-08 1:18 ` [PATCH 2/9] seccomp.2: Use syscall() in the example code Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 3/9] inet.3: Switch to _DEFAULT_SOURCE in the example Stephen Kitt
2022-01-08 1:26 ` Alejandro Colomar (man-pages)
2022-01-08 9:06 ` Stephen Kitt
2022-01-07 16:46 ` [PATCH 4/9] matherr.3: Exclude the example from analysis Stephen Kitt
2022-01-08 1:31 ` Alejandro Colomar (man-pages)
2022-01-08 9:12 ` Stephen Kitt
2022-01-07 16:46 ` [PATCH 5/9] mq_notify.3: Add signal.h for SIGEV_THREAD Stephen Kitt
2022-01-08 1:38 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 6/9] newlocale.3: Use LC_GLOBAL_LOCALE, not ..._HANDLE Stephen Kitt
2022-01-08 1:41 ` Alejandro Colomar (man-pages)
2022-01-08 9:13 ` Jakub Wilk
2022-01-08 17:58 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 7/9] pkeys.7: Update the example to match glibc Stephen Kitt
2022-01-08 1:59 ` Alejandro Colomar (man-pages)
2022-01-08 14:18 ` Stephen Kitt
2022-01-08 19:20 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 8/9] strtok.3: Enable example analysis, fix declaration Stephen Kitt
2022-01-08 2:04 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 9/9] malloc_info.3: Use intptr_t to store pointers Stephen Kitt
2022-01-08 2:25 ` Alejandro Colomar (man-pages)
2022-01-08 10:30 ` Jakub Wilk
2022-01-08 17:09 ` Stephen Kitt
2022-01-08 19:17 ` Alejandro Colomar (man-pages)
2022-01-08 1:15 ` [PATCH 1/9] Add a target to check example programs Alejandro Colomar (man-pages)
2022-01-08 9:22 ` Stephen Kitt
2022-01-08 19:05 ` Alejandro Colomar (man-pages)
2022-01-08 19:38 ` Alejandro Colomar (man-pages)
2022-01-08 2:02 ` Alejandro Colomar (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220107164621.275794-2-steve@sk2.org \
--to=steve@sk2.org \
--cc=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox