Add values for NetBSD .note.netbsd.ident notes (PaX).

Message ID 20210202125347.GA168792@gmail.com
State New
Headers show
Series
  • Add values for NetBSD .note.netbsd.ident notes (PaX).
Related show

Commit Message

Frederic Cambus Feb. 2, 2021, 12:53 p.m.
include/ChangeLog:

	* elf/common.h (NT_NETBSD_PAX, NT_NETBSD_PAX_MPROTECT)
	(NT_NETBSD_PAX_NOMPROTECT, NT_NETBSD_PAX_GUARD, NT_NETBSD_PAX_NOGUARD)
	(NT_NETBSD_PAX_ASLR, NT_NETBSD_PAX_NOASLR): Define.
---
 include/ChangeLog    | 6 ++++++
 include/elf/common.h | 9 +++++++++
 2 files changed, 15 insertions(+)

-- 
2.29.2

Comments

Frederic Cambus Feb. 19, 2021, 9:47 a.m. | #1
Hi,

On Tue, Feb 02, 2021 at 01:53:47PM +0100, Frederic Cambus wrote:
> include/ChangeLog:

> 

> 	* elf/common.h (NT_NETBSD_PAX, NT_NETBSD_PAX_MPROTECT)

> 	(NT_NETBSD_PAX_NOMPROTECT, NT_NETBSD_PAX_GUARD, NT_NETBSD_PAX_NOGUARD)

> 	(NT_NETBSD_PAX_ASLR, NT_NETBSD_PAX_NOASLR): Define.


Ping. Anyone willing to look at this?

For reference, information on NetBSD vendor-specific ELF note elements
can be found here: https://www.netbsd.org/docs/kernel/elf-notes.html

readelf already has code under an #ifdef NT_NETBSD_PAX block to handle
.note.netbsd.pax notes.

Patch

diff --git a/include/ChangeLog b/include/ChangeLog
index ad231aeb94..583d118ed3 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@ 
+2021-02-02  Frederic Cambus  <fred@statdns.com>
+
+	* elf/common.h (NT_NETBSD_PAX, NT_NETBSD_PAX_MPROTECT)
+	(NT_NETBSD_PAX_NOMPROTECT, NT_NETBSD_PAX_GUARD, NT_NETBSD_PAX_NOGUARD)
+	(NT_NETBSD_PAX_ASLR, NT_NETBSD_PAX_NOASLR): Define.
+
 2021-01-15  Nelson Chu  <nelson.chu@sifive.com>
 
 	* opcode/riscv.h: Indent and GNU coding standards tidy,
diff --git a/include/elf/common.h b/include/elf/common.h
index e7d55ae078..0f7eab8c22 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -910,6 +910,15 @@ 
 #define NT_NETBSD_IDENT		1
 #define NT_NETBSD_MARCH		5
 
+/* Values for NetBSD .note.netbsd.ident notes.  Note name is "PaX".  */
+#define NT_NETBSD_PAX		3
+#define NT_NETBSD_PAX_MPROTECT		0x01	/* Force enable Mprotect */
+#define NT_NETBSD_PAX_NOMPROTECT	0x02	/* Force disable Mprotect */
+#define NT_NETBSD_PAX_GUARD		0x04	/* Force enable Segvguard */
+#define NT_NETBSD_PAX_NOGUARD		0x08	/* Force disable Segvguard */
+#define NT_NETBSD_PAX_ASLR		0x10	/* Force enable ASLR */
+#define NT_NETBSD_PAX_NOASLR		0x20	/* Force disable ASLR */
+
 /* Values for OpenBSD .note.openbsd.ident notes.  Note name is "OpenBSD".  */
 
 #define NT_OPENBSD_IDENT	1