[v4,2/4] rtld: Remove DL_ARGV_NOT_RELRO
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
This is no longer needed because _dl_skip_args is always 0, so the
target specific code that modifies argv after relro protection is
applied is no longer used.
After the patch relro protection is applied to _dl_argv consistently
on all targets.
---
v4:
- New patch.
---
elf/rtld.c | 7 -------
sysdeps/aarch64/dl-sysdep.h | 4 ----
sysdeps/alpha/dl-sysdep.h | 23 -----------------------
sysdeps/arc/dl-sysdep.h | 4 ----
sysdeps/arm/dl-sysdep.h | 4 ----
sysdeps/csky/dl-sysdep.h | 23 -----------------------
sysdeps/generic/ldsodefs.h | 12 ++----------
sysdeps/ia64/dl-sysdep.h | 23 -----------------------
sysdeps/nios2/dl-sysdep.h | 4 ----
sysdeps/s390/s390-32/dl-sysdep.h | 23 -----------------------
sysdeps/sparc/dl-sysdep.h | 23 -----------------------
sysdeps/unix/sysv/linux/ia64/dl-sysdep.h | 4 ----
12 files changed, 2 insertions(+), 152 deletions(-)
delete mode 100644 sysdeps/alpha/dl-sysdep.h
delete mode 100644 sysdeps/csky/dl-sysdep.h
delete mode 100644 sysdeps/ia64/dl-sysdep.h
delete mode 100644 sysdeps/s390/s390-32/dl-sysdep.h
delete mode 100644 sysdeps/sparc/dl-sysdep.h
Comments
* Szabolcs Nagy via Libc-alpha:
> This is no longer needed because _dl_skip_args is always 0, so the
> target specific code that modifies argv after relro protection is
> applied is no longer used.
>
> After the patch relro protection is applied to _dl_argv consistently
> on all targets.
I double-checked and as far as I can tell, the _dl_argv update is indeed
conditional on _dl_skip_args != 0. Maybe you could define _dl_skip_args
as const and add a comment that it is there for the benefit of
non-yet-ported startup code, but maybe we can clean this up quickly so
that it does not matter.
Tested on s390-linux-gnu and s390x-linux-gnu, powerpc64le-linux-gnu.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Tested-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
@@ -157,16 +157,9 @@ static void dl_main_state_init (struct dl_main_state *state);
extern char **_environ attribute_hidden;
static void process_envvars (struct dl_main_state *state);
-#ifdef DL_ARGV_NOT_RELRO
-int _dl_argc attribute_hidden;
-char **_dl_argv = NULL;
-/* Nonzero if we were run directly. */
-unsigned int _dl_skip_args attribute_hidden;
-#else
int _dl_argc attribute_relro attribute_hidden;
char **_dl_argv attribute_relro = NULL;
unsigned int _dl_skip_args attribute_relro attribute_hidden;
-#endif
rtld_hidden_data_def (_dl_argv)
#ifndef THREAD_SET_STACK_GUARD
@@ -18,8 +18,4 @@
#include_next <dl-sysdep.h>
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
-
#define DL_EXTERN_PROTECTED_DATA
deleted file mode 100644
@@ -1,23 +0,0 @@
-/* System-specific settings for dynamic linker code. Alpha version.
- Copyright (C) 2002-2022 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_next <dl-sysdep.h>
-
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
@@ -18,8 +18,4 @@
#include_next <dl-sysdep.h>
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
-
#define DL_EXTERN_PROTECTED_DATA
@@ -18,8 +18,4 @@
#include_next <dl-sysdep.h>
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
-
#define DL_EXTERN_PROTECTED_DATA
deleted file mode 100644
@@ -1,23 +0,0 @@
-/* System-specific settings for dynamic linker code. C-SKY version.
- Copyright (C) 2018-2022 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_next <dl-sysdep.h>
-
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
@@ -762,18 +762,10 @@ rtld_hidden_proto (__libc_stack_end)
/* Parameters passed to the dynamic linker. */
extern int _dl_argc attribute_hidden attribute_relro;
-extern char **_dl_argv
-#ifndef DL_ARGV_NOT_RELRO
- attribute_relro
-#endif
- ;
+extern char **_dl_argv attribute_relro;
rtld_hidden_proto (_dl_argv)
#if IS_IN (rtld)
-extern unsigned int _dl_skip_args attribute_hidden
-# ifndef DL_ARGV_NOT_RELRO
- attribute_relro
-# endif
- ;
+extern unsigned int _dl_skip_args attribute_hidden attribute_relro;
#endif
#define rtld_progname _dl_argv[0]
deleted file mode 100644
@@ -1,23 +0,0 @@
-/* System-specific settings for dynamic linker code. IA-64 version.
- Copyright (C) 2002-2022 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_next <dl-sysdep.h>
-
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
@@ -18,8 +18,4 @@
#include_next <dl-sysdep.h>
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
-
#define DL_EXTERN_PROTECTED_DATA
deleted file mode 100644
@@ -1,23 +0,0 @@
-/* System-specific settings for dynamic linker code. S/390 version.
- Copyright (C) 2014-2022 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_next <dl-sysdep.h>
-
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
deleted file mode 100644
@@ -1,23 +0,0 @@
-/* System-specific settings for dynamic linker code. SPARC version.
- Copyright (C) 2002-2022 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_next <dl-sysdep.h>
-
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
@@ -48,8 +48,4 @@ extern int _dl_sysinfo_break attribute_hidden;
".previous");
#endif
-/* _dl_argv cannot be attribute_relro, because _dl_start_user
- might write into it after _dl_start returns. */
-#define DL_ARGV_NOT_RELRO 1
-
#endif /* dl-sysdep.h */