From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Cc: "H . J . Lu" <hjl.tools@gmail.com>,
Florian Weimer <fweimer@redhat.com>,
Zack Weinberg <zack@owlfolio.org>
Subject: [PATCH v3 1/4] elf: Consolidate stackinfo.h
Date: Tue, 18 Jun 2024 16:40:19 -0300 [thread overview]
Message-ID: <20240618194102.2059389-2-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20240618194102.2059389-1-adhemerval.zanella@linaro.org>
And use sane default the generic implementation.
---
sysdeps/aarch64/stackinfo.h | 33 ---------------------
sysdeps/arc/stackinfo.h | 33 ---------------------
sysdeps/csky/stackinfo.h | 29 ------------------
sysdeps/generic/stackinfo.h | 15 ++++++++--
sysdeps/loongarch/stackinfo.h | 33 ---------------------
sysdeps/nios2/stackinfo.h | 33 ---------------------
sysdeps/powerpc/{ => powerpc32}/stackinfo.h | 8 +----
sysdeps/riscv/stackinfo.h | 33 ---------------------
8 files changed, 13 insertions(+), 204 deletions(-)
delete mode 100644 sysdeps/aarch64/stackinfo.h
delete mode 100644 sysdeps/arc/stackinfo.h
delete mode 100644 sysdeps/csky/stackinfo.h
delete mode 100644 sysdeps/loongarch/stackinfo.h
delete mode 100644 sysdeps/nios2/stackinfo.h
rename sysdeps/powerpc/{ => powerpc32}/stackinfo.h (82%)
delete mode 100644 sysdeps/riscv/stackinfo.h
diff --git a/sysdeps/aarch64/stackinfo.h b/sysdeps/aarch64/stackinfo.h
deleted file mode 100644
index 5a4dce7309..0000000000
--- a/sysdeps/aarch64/stackinfo.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2001-2024 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/>. */
-
-/* This file contains a bit of information about the stack allocation
- of the processor. */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-#include <elf.h>
-
-/* On AArch64 the stack grows down. */
-#define _STACK_GROWS_DOWN 1
-
-/* Default to a non-executable stack. */
-#define DEFAULT_STACK_PERMS (PF_R|PF_W)
-
-#endif /* stackinfo.h */
diff --git a/sysdeps/arc/stackinfo.h b/sysdeps/arc/stackinfo.h
deleted file mode 100644
index 99a7f56ea0..0000000000
--- a/sysdeps/arc/stackinfo.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Stack environment definitions for ARC.
- Copyright (C) 2020-2024 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/>. */
-
-/* This file contains a bit of information about the stack allocation
- of the processor. */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-#include <elf.h>
-
-/* On ARC the stack grows down. */
-#define _STACK_GROWS_DOWN 1
-
-/* Default to a non-executable stack. */
-#define DEFAULT_STACK_PERMS (PF_R|PF_W)
-
-#endif /* stackinfo.h */
diff --git a/sysdeps/csky/stackinfo.h b/sysdeps/csky/stackinfo.h
deleted file mode 100644
index ef22fa3249..0000000000
--- a/sysdeps/csky/stackinfo.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Stack environment definitions. C-SKY version.
- Copyright (C) 2018-2024 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/>. */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-#include <elf.h>
-
-/* On C-SKY the stack grows down. */
-#define _STACK_GROWS_DOWN 1
-
-#define DEFAULT_STACK_PERMS (PF_R|PF_W)
-
-#endif /* stackinfo.h */
diff --git a/sysdeps/generic/stackinfo.h b/sysdeps/generic/stackinfo.h
index bf752ce94d..51e5f92055 100644
--- a/sysdeps/generic/stackinfo.h
+++ b/sysdeps/generic/stackinfo.h
@@ -15,6 +15,15 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* This file contains a bit of information about the stack allocation
- of the processor. Since there is no general truth we can't say
- anything here. */
+/* This file contains a bit of information about the stack allocation of the
+ processor. Default to a non executable stack that grows downwards. */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H 1
+
+#include <elf.h>
+
+#define _STACK_GROWS_DOWN 1
+#define DEFAULT_STACK_PERMS (PF_R|PF_W)
+
+#endif
diff --git a/sysdeps/loongarch/stackinfo.h b/sysdeps/loongarch/stackinfo.h
deleted file mode 100644
index 6ee50552b7..0000000000
--- a/sysdeps/loongarch/stackinfo.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Stack environment definitions for LoongArch.
- Copyright (C) 2022-2024 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/>. */
-
-/* This file contains a bit of information about the stack allocation
- of the processor. */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-#include <elf.h>
-
-/* On LoongArch the stack grows down. */
-#define _STACK_GROWS_DOWN 1
-
-/* Default to a non-executable stack. */
-#define DEFAULT_STACK_PERMS (PF_R | PF_W)
-
-#endif /* stackinfo.h */
diff --git a/sysdeps/nios2/stackinfo.h b/sysdeps/nios2/stackinfo.h
deleted file mode 100644
index e67d53ee87..0000000000
--- a/sysdeps/nios2/stackinfo.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Stack environment definitions for Nios II.
- Copyright (C) 2012-2024 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/>. */
-
-/* This file contains a bit of information about the stack allocation
- of the processor. */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-#include <elf.h>
-
-/* On Nios II the stack grows down. */
-#define _STACK_GROWS_DOWN 1
-
-/* Default to a non-executable stack. */
-#define DEFAULT_STACK_PERMS (PF_R|PF_W)
-
-#endif /* stackinfo.h */
diff --git a/sysdeps/powerpc/stackinfo.h b/sysdeps/powerpc/powerpc32/stackinfo.h
similarity index 82%
rename from sysdeps/powerpc/stackinfo.h
rename to sysdeps/powerpc/powerpc32/stackinfo.h
index 410689bc27..2ca360068a 100644
--- a/sysdeps/powerpc/stackinfo.h
+++ b/sysdeps/powerpc/powerpc32/stackinfo.h
@@ -26,13 +26,7 @@
/* On PPC the stack grows down. */
#define _STACK_GROWS_DOWN 1
-#if __WORDSIZE == 64
-/* PPC64 doesn't need an executable stack and doesn't need PT_GNU_STACK
- * to make the stack nonexecutable. */
-# define DEFAULT_STACK_PERMS (PF_R|PF_W)
-#else
/* PF_X can be overridden if PT_GNU_STACK is present but is presumed absent. */
-# define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
-#endif
+#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
#endif /* stackinfo.h */
diff --git a/sysdeps/riscv/stackinfo.h b/sysdeps/riscv/stackinfo.h
deleted file mode 100644
index a786d4f9b0..0000000000
--- a/sysdeps/riscv/stackinfo.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Stack environment definitions for RISC-V.
- Copyright (C) 2011-2024 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/>. */
-
-/* This file contains a bit of information about the stack allocation
- of the processor. */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-#include <elf.h>
-
-/* On RISC-V the stack grows down. */
-#define _STACK_GROWS_DOWN 1
-
-/* Default to a non-executable stack. */
-#define DEFAULT_STACK_PERMS (PF_R | PF_W)
-
-#endif /* stackinfo.h */
--
2.43.0
next prev parent reply other threads:[~2024-06-18 19:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 19:40 [PATCH v3 0/4] Improve executable stack handling Adhemerval Zanella
2024-06-18 19:40 ` Adhemerval Zanella [this message]
2024-06-18 19:40 ` [PATCH v3 2/4] elf: Do not change stack permission on dlopen/dlmopen Adhemerval Zanella
2024-06-18 19:40 ` [PATCH v3 3/4] elf: Add tst-execstack-prog-static Adhemerval Zanella
2024-06-18 19:40 ` [PATCH v3 4/4] elf: Add glibc.rtld.execstack 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=20240618194102.2059389-2-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=zack@owlfolio.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).