diff options
author | 2021-10-23 03:25:25 -0400 | |
---|---|---|
committer | 2021-10-23 18:18:03 -0400 | |
commit | afa38c053de48152beef9d8bf6726a4710bcba58 (patch) | |
tree | 2ba66da9cba76c6e035c9b972e5c1c629f8f7967 /libsandbox | |
parent | libsandbox: fix flags extraction for a few syscalls (diff) | |
download | sandbox-afa38c053de48152beef9d8bf6726a4710bcba58.tar.gz sandbox-afa38c053de48152beef9d8bf6726a4710bcba58.tar.bz2 sandbox-afa38c053de48152beef9d8bf6726a4710bcba58.zip |
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 <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r-- | libsandbox/symbols.h.in | 5 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/__futimesat64.c | 13 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/__lutimes64.c | 13 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/__utime64.c | 13 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/__utimensat64.c | 13 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/__utimes64.c | 13 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/futimesat.c | 4 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/lutimes.c | 4 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/utime.c | 4 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/utimensat.c | 4 | ||||
-rw-r--r-- | libsandbox/wrapper-funcs/utimes.c | 4 |
11 files changed, 85 insertions, 5 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 0000000..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 0000000..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 0000000..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 0000000..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 0000000..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 decode the time values in sandbox, so it doesn't matter to use. + */ +#define WRAPPER_SAFE() _SB_SAFE(SB_NR_UTIMES, STRING_NAME, filename) +#include "utimes.c" diff --git a/libsandbox/wrapper-funcs/futimesat.c b/libsandbox/wrapper-funcs/futimesat.c index 6f6481b..bc1a966 100644 --- a/libsandbox/wrapper-funcs/futimesat.c +++ b/libsandbox/wrapper-funcs/futimesat.c @@ -7,5 +7,7 @@ #define WRAPPER_ARGS_PROTO int dirfd, const char *filename, const struct timeval times[2] #define WRAPPER_ARGS dirfd, filename, times -#define WRAPPER_SAFE() SB_SAFE_AT(dirfd, filename, 0) +#ifndef WRAPPER_SAFE +# define WRAPPER_SAFE() SB_SAFE_AT(dirfd, filename, 0) +#endif #include "__wrapper_simple.c" diff --git a/libsandbox/wrapper-funcs/lutimes.c b/libsandbox/wrapper-funcs/lutimes.c index 3192a33..fb9ae68 100644 --- a/libsandbox/wrapper-funcs/lutimes.c +++ b/libsandbox/wrapper-funcs/lutimes.c @@ -7,5 +7,7 @@ #define WRAPPER_ARGS_PROTO const char *filename, const struct timeval times[2] #define WRAPPER_ARGS filename, times -#define WRAPPER_SAFE() SB_SAFE(filename) +#ifndef WRAPPER_SAFE +# define WRAPPER_SAFE() SB_SAFE(filename) +#endif #include "__wrapper_simple.c" diff --git a/libsandbox/wrapper-funcs/utime.c b/libsandbox/wrapper-funcs/utime.c index f0a6814..4bbf374 100644 --- a/libsandbox/wrapper-funcs/utime.c +++ b/libsandbox/wrapper-funcs/utime.c @@ -7,5 +7,7 @@ #define WRAPPER_ARGS_PROTO const char *filename, const struct utimbuf *times #define WRAPPER_ARGS filename, times -#define WRAPPER_SAFE() SB_SAFE(filename) +#ifndef WRAPPER_SAFE +# define WRAPPER_SAFE() SB_SAFE(filename) +#endif #include "__wrapper_simple.c" diff --git a/libsandbox/wrapper-funcs/utimensat.c b/libsandbox/wrapper-funcs/utimensat.c index 840ff18..3baf89c 100644 --- a/libsandbox/wrapper-funcs/utimensat.c +++ b/libsandbox/wrapper-funcs/utimensat.c @@ -7,5 +7,7 @@ #define WRAPPER_ARGS_PROTO int dirfd, const char *filename, const struct timespec times[2], int flags #define WRAPPER_ARGS dirfd, filename, times, flags -#define WRAPPER_SAFE() SB_SAFE_AT(dirfd, filename, flags) +#ifndef WRAPPER_SAFE +# define WRAPPER_SAFE() SB_SAFE_AT(dirfd, filename, flags) +#endif #include "__wrapper_simple.c" diff --git a/libsandbox/wrapper-funcs/utimes.c b/libsandbox/wrapper-funcs/utimes.c index b117895..902c6f5 100644 --- a/libsandbox/wrapper-funcs/utimes.c +++ b/libsandbox/wrapper-funcs/utimes.c @@ -7,5 +7,7 @@ #define WRAPPER_ARGS_PROTO const char *filename, const struct timeval times[2] #define WRAPPER_ARGS filename, times -#define WRAPPER_SAFE() SB_SAFE(filename) +#ifndef WRAPPER_SAFE +# define WRAPPER_SAFE() SB_SAFE(filename) +#endif #include "__wrapper_simple.c" |