commit: afa38c053de48152beef9d8bf6726a4710bcba58
Author: Mike Frysinger gentoo org>
AuthorDate: Sat Oct 23 07:25:25 2021 +
Commit: Mike Frysinger gentoo org>
CommitDate: Sat Oct 23 22:18:03 2021 +
URL:https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=afa38c05
libsandbox: add 64-bit time_t wrappers
This intercepts the C library 64-bit time_t interfaces. The syscall
trace side will need more work first.
Bug: https://bugs.gentoo.org/751241
Signed-off-by: Mike Frysinger gentoo.org>
libsandbox/symbols.h.in | 5 +
libsandbox/wrapper-funcs/__futimesat64.c | 13 +
libsandbox/wrapper-funcs/__lutimes64.c | 13 +
libsandbox/wrapper-funcs/__utime64.c | 13 +
libsandbox/wrapper-funcs/__utimensat64.c | 13 +
libsandbox/wrapper-funcs/__utimes64.c| 13 +
libsandbox/wrapper-funcs/futimesat.c | 4 +++-
libsandbox/wrapper-funcs/lutimes.c | 4 +++-
libsandbox/wrapper-funcs/utime.c | 4 +++-
libsandbox/wrapper-funcs/utimensat.c | 4 +++-
libsandbox/wrapper-funcs/utimes.c| 4 +++-
tests/local.mk | 2 ++
tests/test-skel-0.c | 4 ++--
tests/utimensat64-0.c| 3 +++
tests/utimensat64-1.sh | 9 +
tests/utimensat64.at | 1 +
tests/utimensat64_static-0.c | 1 +
tests/utimensat64_static-1.sh| 10 ++
tests/utimensat64_static.at | 1 +
19 files changed, 114 insertions(+), 7 deletions(-)
diff --git a/libsandbox/symbols.h.in b/libsandbox/symbols.h.in
index 0fe6eca..40c04e3 100644
--- a/libsandbox/symbols.h.in
+++ b/libsandbox/symbols.h.in
@@ -74,9 +74,14 @@ lremovexattr
setxattr
lsetxattr
utime
+__utime64
utimes
+__utimes64
utimensat
+__utimensat64
futimesat
+__futimesat64
lutimes
+__lutimes64
fork
vfork
diff --git a/libsandbox/wrapper-funcs/__futimesat64.c
b/libsandbox/wrapper-funcs/__futimesat64.c
new file mode 100644
index 000..9ad791e
--- /dev/null
+++ b/libsandbox/wrapper-funcs/__futimesat64.c
@@ -0,0 +1,13 @@
+/*
+ * __futimesat64() wrapper.
+ *
+ * Copyright 1999-2021 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+/*
+ * NB: Reusing the 32-bit time interface isn't entirely correct as the 64-bit
time interface uses a
+ * different structure, but we never decode the time values in sandbox, so it
doesn't matter to use.
+ */
+#define WRAPPER_SAFE() _SB_SAFE_AT(SB_NR_FUTIMESAT, STRING_NAME, dirfd,
filename, 0)
+#include "futimesat.c"
diff --git a/libsandbox/wrapper-funcs/__lutimes64.c
b/libsandbox/wrapper-funcs/__lutimes64.c
new file mode 100644
index 000..edab47c
--- /dev/null
+++ b/libsandbox/wrapper-funcs/__lutimes64.c
@@ -0,0 +1,13 @@
+/*
+ * __lutimes64() wrapper.
+ *
+ * Copyright 1999-2021 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+/*
+ * NB: Reusing the 32-bit time interface isn't entirely correct as the 64-bit
time interface uses a
+ * different structure, but we never decode the time values in sandbox, so it
doesn't matter to use.
+ */
+#define WRAPPER_SAFE() _SB_SAFE(SB_NR_LUTIMES, STRING_NAME, filename)
+#include "lutimes.c"
diff --git a/libsandbox/wrapper-funcs/__utime64.c
b/libsandbox/wrapper-funcs/__utime64.c
new file mode 100644
index 000..4e1b573
--- /dev/null
+++ b/libsandbox/wrapper-funcs/__utime64.c
@@ -0,0 +1,13 @@
+/*
+ * __utime64() wrapper.
+ *
+ * Copyright 1999-2021 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+/*
+ * NB: Reusing the 32-bit time interface isn't entirely correct as the 64-bit
time interface uses a
+ * different structure, but we never decode the time values in sandbox, so it
doesn't matter to use.
+ */
+#define WRAPPER_SAFE() _SB_SAFE(SB_NR_UTIME, STRING_NAME, filename)
+#include "utime.c"
diff --git a/libsandbox/wrapper-funcs/__utimensat64.c
b/libsandbox/wrapper-funcs/__utimensat64.c
new file mode 100644
index 000..4ef1c69
--- /dev/null
+++ b/libsandbox/wrapper-funcs/__utimensat64.c
@@ -0,0 +1,13 @@
+/*
+ * __utimensat64() wrapper.
+ *
+ * Copyright 1999-2021 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+/*
+ * NB: Reusing the 32-bit time interface isn't entirely correct as the 64-bit
time interface uses a
+ * different structure, but we never decode the time values in sandbox, so it
doesn't matter to use.
+ */
+#define WRAPPER_SAFE() _SB_SAFE_AT(SB_NR_UTIMENSAT, STRING_NAME, dirfd,
filename, flags)
+#include "utimensat.c"
diff --git a/libsandbox/wrapper-funcs/__utimes64.c
b/libsandbox/wrapper-funcs/__utimes64.c
new file mode 100644
index 000..3fa6688
--- /dev/null
+++ b/libsandbox/wrapper-funcs/__utimes64.c
@@ -0,0 +1,13 @@
+/*
+ * __utimes64() wrapper.
+ *
+ * Copyright 1999-2021 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+/*
+ * NB: Reusing the 32-bit time interface isn't entirely correct as the 64-bit
time interface uses a
+ * different structure, but we never deco