From a6c0847582305aaab122d54b635954829812922f Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alexk@zuma.ai>
Date: Thu, 30 Dec 2021 09:32:26 +0000
Subject: [PATCH 1/2] ntpd/ntp_sandbox.c: allow newfstatat on all archs for
 glibc-2.34 in seccomp filter

On Yocto Poky, newfstatat is used on (at least) arm64, x86_64 and
riscv64:

  2021-12-30T09:32:04 ntpd[341]: ERR: SIGSYS: got a trap.
  2021-12-30T09:32:04 ntpd[341]: ERR: SIGSYS/seccomp bad syscall 262/0xc000003e

Upstream-Status: Backport [https://gitlab.com/NTPsec/ntpsec/-/commit/a6c0847582305aaab122d54b635954829812922f]
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alex Kiernan <alexk@zuma.ai>
---
 ntpd/ntp_sandbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ntpd/ntp_sandbox.c b/ntpd/ntp_sandbox.c
index 3d6bccdfcf77..1ae82a671344 100644
--- a/ntpd/ntp_sandbox.c
+++ b/ntpd/ntp_sandbox.c
@@ -349,6 +349,7 @@ int scmp_sc[] = {
 	SCMP_SYS(lseek),
 	SCMP_SYS(membarrier),	/* Needed on Alpine 3.11.3 */
 	SCMP_SYS(munmap),
+	SCMP_SYS(newfstatat),
 	SCMP_SYS(open),
 #ifdef __NR_openat
 	SCMP_SYS(openat),	/* SUSE */
@@ -452,7 +453,6 @@ int scmp_sc[] = {
 #endif
 #if defined(__aarch64__)
 	SCMP_SYS(faccessat),
-	SCMP_SYS(newfstatat),
 	SCMP_SYS(renameat),
 	SCMP_SYS(linkat),
 	SCMP_SYS(unlinkat),
-- 
2.34.1

