From: "Alexandra Hájková" <alexandra.khirnova@gmail.com>
To: libc-alpha@sourceware.org
Cc: "Alexandra Hájková" <ahajkova@redhat.com>
Subject: [PATCH] Linux: Add execveat system call wrapper
Date: Wed, 24 Mar 2021 14:54:02 +0100 [thread overview]
Message-ID: <20210324135402.2685623-1-ahajkova@redhat.com> (raw)
In-Reply-To: <20200428122019.26826-1-ahajkova@redhat.com>
From: Alexandra Hájková <ahajkova@redhat.com>
Also add the test for the new wrapper.
---
This version:
* was updated to use 2.24 symbol version
* "difrd < 0" check was dropped
NEWS | 5 +
include/unistd.h | 4 +
posix/Makefile | 4 +-
posix/Versions | 3 +
posix/execveat.c | 41 ++++
posix/tst-execveat-compat.c | 32 ++++
posix/tst-execveat.c | 180 ++++++++++++++++++
posix/unistd.h | 5 +
sysdeps/mach/hurd/i386/libc.abilist | 1 +
sysdeps/unix/sysv/linux/aarch64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/alpha/libc.abilist | 1 +
sysdeps/unix/sysv/linux/arm/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/arm/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/csky/libc.abilist | 1 +
sysdeps/unix/sysv/linux/execveat.c | 54 ++++++
sysdeps/unix/sysv/linux/execveat_fallback.c | 69 +++++++
sysdeps/unix/sysv/linux/hppa/libc.abilist | 1 +
sysdeps/unix/sysv/linux/i386/libc.abilist | 1 +
sysdeps/unix/sysv/linux/ia64/libc.abilist | 1 +
.../sysv/linux/m68k/coldfire/libc.abilist | 1 +
.../unix/sysv/linux/m68k/m680x0/libc.abilist | 1 +
.../sysv/linux/microblaze/be/libc.abilist | 1 +
.../sysv/linux/microblaze/le/libc.abilist | 1 +
.../sysv/linux/mips/mips32/fpu/libc.abilist | 1 +
.../sysv/linux/mips/mips32/nofpu/libc.abilist | 1 +
.../sysv/linux/mips/mips64/n32/libc.abilist | 1 +
.../sysv/linux/mips/mips64/n64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/nios2/libc.abilist | 1 +
.../linux/powerpc/powerpc32/fpu/libc.abilist | 1 +
.../powerpc/powerpc32/nofpu/libc.abilist | 1 +
.../linux/powerpc/powerpc64/be/libc.abilist | 1 +
.../linux/powerpc/powerpc64/le/libc.abilist | 1 +
.../unix/sysv/linux/riscv/rv64/libc.abilist | 1 +
.../unix/sysv/linux/s390/s390-32/libc.abilist | 1 +
.../unix/sysv/linux/s390/s390-64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sh/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sh/le/libc.abilist | 1 +
.../sysv/linux/sparc/sparc32/libc.abilist | 1 +
.../sysv/linux/sparc/sparc64/libc.abilist | 1 +
.../unix/sysv/linux/x86_64/64/libc.abilist | 1 +
.../unix/sysv/linux/x86_64/x32/libc.abilist | 1 +
41 files changed, 427 insertions(+), 1 deletion(-)
create mode 100644 posix/execveat.c
create mode 100644 posix/tst-execveat-compat.c
create mode 100644 posix/tst-execveat.c
create mode 100644 sysdeps/unix/sysv/linux/execveat.c
create mode 100644 sysdeps/unix/sysv/linux/execveat_fallback.c
diff --git a/NEWS b/NEWS
index aa0f10a891..a61071b494 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,11 @@ Major new features:
a dump of information related to IFUNC resolver operation and
glibc-hwcaps subdirectory selection.
+* The function execveat has been added and it operates similar to execve.
+ The syscall is already used to implement fexecve without requiring /proc to
+ be mounted. Similar to fexecve, if the syscall is not supported a fallback
+ which access /proc is used.
+
Deprecated and removed features, and other changes affecting compatibility:
[Add deprecations, removals and changes affecting compatibility here]
diff --git a/include/unistd.h b/include/unistd.h
index 54becbc9eb..2dd901ed09 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -192,6 +192,10 @@ extern int __libc_pause (void);
extern int __getlogin_r_loginuid (char *name, size_t namesize)
attribute_hidden;
+extern int
+__execveat_fallback (int dirfd, const char *path, char *const argv[],
+ char *const envp[], int flags);
+
# if IS_IN (rtld)
# include <dl-unistd.h>
# endif
diff --git a/posix/Makefile b/posix/Makefile
index be0c72f0bb..f0ebe34c8e 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -66,7 +66,8 @@ routines := \
posix_madvise \
get_child_max sched_cpucount sched_cpualloc sched_cpufree \
streams-compat \
- shm-directory
+ shm-directory \
+ execveat
aux := init-posix environ
tests := test-errno tstgetopt testfnm runtests runptests \
@@ -118,6 +119,7 @@ endif
tests-internal := bug-regex5 bug-regex20 bug-regex33 \
tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3
+tests-static-internal += tst-execveat-compat
tests-container := bug-ga2
xtests := tst-getaddrinfo4 tst-getaddrinfo5 tst-sched_rr_get_interval
ifeq (yes,$(build-shared))
diff --git a/posix/Versions b/posix/Versions
index cfd3819966..b77e251e00 100644
--- a/posix/Versions
+++ b/posix/Versions
@@ -147,6 +147,9 @@ libc {
}
GLIBC_2.30 {
}
+ GLIBC_2.34 {
+ execveat;
+ }
GLIBC_PRIVATE {
__libc_fork; __libc_pread; __libc_pwrite;
__nanosleep_nocancel; __pause_nocancel;
diff --git a/posix/execveat.c b/posix/execveat.c
new file mode 100644
index 0000000000..3f0d0820e7
--- /dev/null
+++ b/posix/execveat.c
@@ -0,0 +1,41 @@
+/* Execute program relative to a directory file descriptor.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+/* Replace the current process, executing PATH relative to DIFRD with
+ * arguments ARGV and environment ENVP.
+ * ARGV and ENVP are terminated by NULL pointers. */
+int
+__execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
+ int flags)
+{
+ if (path == NULL || argv == NULL || envp == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (execveat)
+
+weak_alias (__execveat, execveat)
diff --git a/posix/tst-execveat-compat.c b/posix/tst-execveat-compat.c
new file mode 100644
index 0000000000..082c67690d
--- /dev/null
+++ b/posix/tst-execveat-compat.c
@@ -0,0 +1,32 @@
+/* Test the fallback implementation of execveat.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Get the declaration of the official execveat function. */
+#include <unistd.h>
+
+/* Compile a local version of execveat. */
+#include <sysdeps/unix/sysv/linux/execveat_fallback.c>
+
+int
+__execveat_fallback (int dirfd, const char *path, char *const argv[],
+ char *const envp[], int flags);
+
+/* Re-use the test, but run it against copy_file_range_compat defined
+ above. */
+#define execveat execveat_fallback
+#include "tst-execveat.c"
diff --git a/posix/tst-execveat.c b/posix/tst-execveat.c
new file mode 100644
index 0000000000..52779de8cd
--- /dev/null
+++ b/posix/tst-execveat.c
@@ -0,0 +1,180 @@
+/* Test execveat at the various corner cases.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/temp_file.h>
+#include <support/xdlfcn.h>
+#include <support/xstdio.h>
+#include <support/xunistd.h>
+#include <wait.h>
+#include <support/test-driver.h>
+
+int
+call_execveat (int fd, const char *pathname, int flags, int expected_fail,
+ int num)
+{
+ char *envp[] = { (char *) "FOO=3", NULL };
+ char *argv[] = { (char *) "sh", (char *) "-c", (char *) "exit $FOO", NULL };
+ pid_t pid;
+ int status;
+
+ if (test_verbose > 0)
+ printf ("call line number: %d\n", num);
+
+ pid = xfork ();
+ if (pid == 0)
+ {
+ TEST_COMPARE (execveat (fd, pathname, argv, envp, flags), -1);
+ if (errno == ENOSYS)
+ FAIL_UNSUPPORTED ("execveat is unimplemented");
+ else if (errno == expected_fail)
+ {
+ if (test_verbose > 0)
+ printf ("expected fail: errno %d\n", errno);
+ _exit (0);
+ }
+ else
+ FAIL_EXIT1 ("execveat failed: %m (%d)", errno);
+ }
+ xwaitpid (pid, &status, 0);
+
+ if (WIFEXITED (status))
+ {
+ if (WEXITSTATUS (status) == EXIT_UNSUPPORTED)
+ FAIL_UNSUPPORTED ("execveat is unimplemented");
+ else if (expected_fail != 0)
+ TEST_COMPARE (WEXITSTATUS (status), 0);
+ else
+ TEST_COMPARE (WEXITSTATUS (status), 3);
+ }
+ return 0;
+}
+
+static int
+do_test (void)
+{
+ DIR *dirp;
+ int fd, fd_out;
+ char *tmp_dir, *symlink_name, *tmp_sh;
+ struct stat64 st;
+
+ dirp = opendir ("/bin");
+ if (dirp == NULL)
+ FAIL_EXIT1 ("failed to open /bin");
+ fd = dirfd (dirp);
+
+ /* Call execveat for various fd/pathname combinations. */
+
+ /* Check the pathname relative to a valid dirfd. */
+ call_execveat (fd, "sh", 0, 0, __LINE__);
+ xchdir ("/bin");
+ /* Use the special value AT_FDCWD as dirfd. Quoting open(2):
+ If pathname is relative and dirfd is the special value AT_FDCWD, then
+ pathname is interpreted relative to the current working directory of
+ the calling process. */
+ call_execveat (AT_FDCWD, "sh", 0, 0, __LINE__);
+ xclose (fd);
+#ifdef O_PATH
+ /* Check the pathname relative to a valid dirfd with O_PATH. */
+ fd = xopen ("/bin", O_PATH | O_DIRECTORY, O_RDONLY);
+ call_execveat (fd, "sh", 0, 0, __LINE__);
+ xclose (fd);
+
+ /* Check absolute pathname, dirfd should be ignored. */
+ call_execveat (AT_FDCWD, "/bin/sh", 0, 0, __LINE__);
+ fd = xopen ("/usr", O_PATH | O_DIRECTORY, 0);
+ /* Same check for absolute pathname, but with input file descriptor
+ openend with different flags. The dirfd should be ignored. */
+ call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+ xclose (fd);
+#endif
+
+ fd = xopen ("/usr", O_RDONLY, 0);
+ /* Same check for absolute pathname, but with input file descriptor
+ openend with different flags. The dirfd should be ignored. */
+ call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+ xclose (fd);
+
+ fd = xopen ("/bin/sh", O_RDONLY, 0);
+ /* Check relative pathname, where dirfd does not point to a directory. */
+ call_execveat (fd, "sh", 0, ENOTDIR, __LINE__);
+ /* Check absolute pathname, but dirfd is a regular file. The dirfd
+ should be ignored. */
+ call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+ xclose (fd);
+
+#ifdef O_PATH
+ /* Quoting open(2): O_PATH
+ Obtain a file descriptor that can be used for two purposes: to
+ indicate a location in the filesystem tree and to perform
+ operations that act purely at the file descriptor level. */
+ fd = xopen ("/bin/sh", O_PATH, 0);
+ /* Check the empty pathname. Dirfd is a regular file with O_PATH. */
+ call_execveat (fd, "", 0, ENOENT, __LINE__);
+ /* Same check for an empty pathname, but with AT_EMPTY_PATH flag.
+ Quoting open(2):
+ If oldpath is an empty string, create a link to the file referenced
+ by olddirfd (which may have been obtained using the open(2) O_PATH flag. */
+ call_execveat (fd, "", AT_EMPTY_PATH, 0, __LINE__);
+ call_execveat (fd, "", AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, 0, __LINE__);
+ xclose (fd);
+
+ /* Create a temporary directory "tmp_dir" and create a symbolik link tmp_sh
+ pointing to /bin/sh inside the tmp_dir. Open dirfd as a symbolic link. */
+ tmp_dir = support_create_temp_directory ("tst-execveat_dir");
+ symlink_name = xasprintf ("%s/symlink", tmp_dir);
+ xsymlink ("tmp_sh", symlink_name);
+ add_temp_file (symlink_name);
+ tmp_sh = xasprintf ("%s/tmp_sh", tmp_dir);
+ add_temp_file (tmp_sh);
+ fd_out = xopen (symlink_name, O_CREAT | O_WRONLY, 0);
+ xstat ("/bin/sh", &st);
+ fd = xopen ("/bin/sh", O_RDONLY, 0);
+ xcopy_file_range (fd, 0, fd_out, 0, st.st_size, 0);
+ xfchmod (fd_out, 0700);
+ xclose (fd);
+ xclose (fd_out);
+ fd_out = xopen (symlink_name, O_PATH, 0);
+
+ /* Check the empty pathname. Dirfd is a symbolic link. */
+ call_execveat (fd_out, "", 0, ENOENT, __LINE__);
+ call_execveat (fd_out, "", AT_EMPTY_PATH, 0, __LINE__);
+ call_execveat (fd_out, "", AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, 0,
+ __LINE__);
+ xclose (fd_out);
+ free (symlink_name);
+ free (tmp_sh);
+ free (tmp_dir);
+#endif
+
+ /* Call execveat with closed fd, we expect this to fail with EBADF. */
+ call_execveat (fd, "sh", 0, EBADF, __LINE__);
+ /* Call execveat with closed fd, we expect this to pass because the pathname is
+ absolute. */
+ call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/posix/unistd.h b/posix/unistd.h
index 3f22763379..d9d8929f71 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -295,6 +295,11 @@ extern int euidaccess (const char *__name, int __type)
/* An alias for `euidaccess', used by some other systems. */
extern int eaccess (const char *__name, int __type)
__THROW __nonnull ((1));
+
+/* Execute program relative to a directory file descriptor. */
+extern int execveat (int __fd, const char *__path, char *const __argv[],
+ char *const __envp[], int __flags)
+ __THROW __nonnull ((2, 3));
#endif
#ifdef __USE_ATFILE
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index e10a286d2e..bef66d105c 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2204,6 +2204,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index bac795262d..51f34d0f6d 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2172,3 +2172,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 897f70db22..7da53174ef 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2254,6 +2254,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 094236f713..108c41ae24 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -156,6 +156,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 2bb4d31e81..a995a356a4 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -153,6 +153,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index d4291fecfb..33d0dfb2b7 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2116,3 +2116,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
diff --git a/sysdeps/unix/sysv/linux/execveat.c b/sysdeps/unix/sysv/linux/execveat.c
new file mode 100644
index 0000000000..0576f36b98
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/execveat.c
@@ -0,0 +1,54 @@
+/* Execute program relative to a directory file descriptor.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <kernel-features.h>
+#include <fd_to_filename.h>
+#include <not-cancel.h>
+#ifndef __ASSUME_EXECVEAT
+# include "execveat_fallback.c"
+#endif
+
+/* Execute the file FD refers to, overlaying the running program image.
+ ARGV and ENVP are passed to the new program, as for `execve'. */
+int
+execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
+ int flags)
+{
+ /* Avoid implicit array coercion in syscall macros. */
+ INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0], flags);
+#ifndef __ASSUME_EXECVEAT
+ if (errno != ENOSYS)
+ return -1;
+
+ if ((flags & ~(AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW)) != 0)
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
+
+ return __execveat_fallback (dirfd, path, argv, envp, flags);
+#endif
+
+ return -1;
+}
diff --git a/sysdeps/unix/sysv/linux/execveat_fallback.c b/sysdeps/unix/sysv/linux/execveat_fallback.c
new file mode 100644
index 0000000000..c4a37d3799
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/execveat_fallback.c
@@ -0,0 +1,69 @@
+/* Execute program relative to a directory file descriptor.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <kernel-features.h>
+#include <fd_to_filename.h>
+#include <not-cancel.h>
+
+int
+__execveat_fallback (int dirfd, const char *path, char *const argv[],
+ char *const envp[], int flags)
+{
+ int fd;
+
+ if (path[0] == '\0' && (flags & AT_EMPTY_PATH) && dirfd >= 0)
+ fd = dirfd;
+ else
+ {
+ int oflags = O_CLOEXEC;
+ if (flags & AT_SYMLINK_NOFOLLOW)
+ oflags |= O_NOFOLLOW;
+ fd = __openat_nocancel (dirfd, path, oflags);
+ }
+ if (fd < 0)
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (EBADFD);
+
+ struct fd_to_filename fdfilename;
+ const char *gfilename = __fd_to_filename (fd, &fdfilename);
+
+ /* We do not need the return value. */
+ __execve (gfilename, argv, envp);
+
+ int save = errno;
+
+ /* We come here only if the 'execve' call fails. Determine whether
+ /proc is mounted. If not we return ENOSYS. */
+ struct stat64 st;
+ if (__stat64 (FD_TO_FILENAME_PREFIX, &st) != 0 && errno == ENOENT)
+ save = ENOSYS;
+
+ if (fd != dirfd)
+ __close_nocancel_nostatus (fd);
+ __set_errno (save);
+
+ return -1;
+}
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 1fd2a862f6..e1430bb232 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2075,6 +2075,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 943331f01e..7cb2d0dd6d 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2242,6 +2242,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index f530151bde..2171cd3cb2 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2107,6 +2107,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 6e76b6dcaa..388eb76abf 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -157,6 +157,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0x98
GLIBC_2.4 _IO_2_1_stdin_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 7541b8289f..067ed53f2b 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2187,6 +2187,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 6cf1936c42..a792461b45 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2167,3 +2167,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index 98730ebcda..0e09fe6322 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2164,3 +2164,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 92fa6cbc73..5d1b0b3d78 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2158,6 +2158,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 265a49e74e..a278c0a092 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2156,6 +2156,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index cfa5e1111b..054d3436eb 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2164,6 +2164,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 8c03ac52cd..c22ef9f196 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2158,6 +2158,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 17f5609e06..c356e9f863 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2205,3 +2205,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 76a16e2a6d..d1de01f91d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2214,6 +2214,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 697f072fd4..a1d52887bb 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2247,6 +2247,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 2647bb51f1..10cdabb11c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2077,6 +2077,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 036b1c8345..70792ed87b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2367,3 +2367,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index fb5ad9909f..9b71083136 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2134,3 +2134,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index cead75acc5..aba76fbadd 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2212,6 +2212,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 31366dd7e6..6a5a765f4b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2113,6 +2113,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index a3a8be8910..b6629c244f 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2082,6 +2082,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 8f505c5045..e15ab4c569 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2079,6 +2079,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 53ef6304f1..11cad082d8 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2203,6 +2203,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index eba0cb156d..0ff8cb8739 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2130,6 +2130,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 17ce5dfd58..040d44d3a8 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2089,6 +2089,7 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 17a1c83903..4355e06891 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2186,3 +2186,4 @@ GLIBC_2.33 mknodat F
GLIBC_2.33 stat F
GLIBC_2.33 stat64 F
GLIBC_2.34 __libc_start_main F
+GLIBC_2.34 execveat F
--
2.26.3
next prev parent reply other threads:[~2021-03-24 13:54 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 12:20 Alexandra Hájková
2020-04-28 14:17 ` Florian Weimer
2020-04-28 15:03 ` Joseph Myers
2020-04-28 15:03 ` Joseph Myers
2020-04-28 15:08 ` Florian Weimer
2020-04-28 15:29 ` Joseph Myers
2020-04-28 17:15 ` Florian Weimer
2020-04-28 17:19 ` Joseph Myers
2020-04-28 17:44 ` Adhemerval Zanella
2020-04-28 17:50 ` Florian Weimer
2020-04-28 18:31 ` Adhemerval Zanella
2020-04-30 11:15 ` Florian Weimer
2020-04-30 12:28 ` Adhemerval Zanella
2020-04-30 12:55 ` Florian Weimer
2020-04-30 19:03 ` Adhemerval Zanella
2020-04-30 12:32 ` Adhemerval Zanella
2020-11-06 21:03 ` Alexandra Hájková
2020-11-06 22:15 ` Joseph Myers
2020-11-09 18:43 ` Florian Weimer
2020-11-09 21:34 ` Yann Droneaud
2020-11-26 11:31 ` Alexandra Petlanova Hajkova
2020-11-09 20:39 ` Adhemerval Zanella
2020-12-03 13:55 ` Florian Weimer
2020-11-26 21:28 ` Alexandra Hájková
2020-11-27 14:58 ` Adhemerval Zanella
2020-11-27 17:32 ` Florian Weimer
2020-11-27 17:38 ` Adhemerval Zanella
2020-12-03 14:20 ` Alexandra Hájková
2020-12-03 14:37 ` Andreas Schwab
2020-12-08 14:44 ` Adhemerval Zanella
2020-12-08 15:18 ` Florian Weimer
2020-12-08 16:41 ` Adhemerval Zanella
2021-03-15 21:42 ` Alexandra Hájková
2021-03-15 22:12 ` Joseph Myers
2021-03-15 22:17 ` Dmitry V. Levin
2021-03-24 13:54 ` Alexandra Hájková [this message]
2021-03-26 20:36 ` Adhemerval Zanella
2021-04-02 12:13 ` Alexandra Hájková
2021-04-02 13:29 ` Adhemerval Zanella
2021-04-05 16:32 ` Alexandra Hájková
2021-04-12 10:26 ` Alexandra Hájková
2021-04-12 11:14 ` Andreas Schwab
2021-04-12 19:26 ` Alexandra Hájková
2021-04-13 19:27 ` Adhemerval Zanella
2021-04-21 18:11 ` Alexandra Hájková
2021-05-03 19:20 ` Adhemerval Zanella
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=20210324135402.2685623-1-ahajkova@redhat.com \
--to=alexandra.khirnova@gmail.com \
--cc=ahajkova@redhat.com \
--cc=libc-alpha@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).