Skip to contentSkip to conversation

riscv: add Linux note to vdso

PATCH In review Andreas Schwab 2 participants 2 messages Apr 27, 2020 – May 4, 2020 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: add Linux note to vdso

The Linux note in the vdso allows glibc to check the running kernel version without having to issue the uname syscall.

---
 arch/riscv/kernel/vdso/Makefile |  2 +-
 arch/riscv/kernel/vdso/note.S   | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/kernel/vdso/note.S
arch/riscv/kernel/vdso/Makefile +1 -1
index 33b16f4212f7..281dc58189e0 100644
@@ -12,7 +12,7 @@ vdso-syms += getcpu
 vdso-syms += flush_icache
 
 # Files to link into the vdso
-obj-vdso = $(patsubst %, %.o, $(vdso-syms))
+obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
 
 # Build rules
 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
arch/riscv/kernel/vdso/note.S new file +12 -0
new file mode 100644
index 000000000000..2a956c942211
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
+ * Here we can supply some information useful to userland.
+ */
+
+#include <linux/elfnote.h>
+#include <linux/version.h>
+
+ELFNOTE_START(Linux, 0, "a")
+	.long LINUX_VERSION_CODE
+ELFNOTE_END
Signature · 7 lines
2.26.2


-- 
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
maintainer
#1 lore raw
Quoted 31 lines · On Mon, 27 Apr 2020 08:13:34 PDT (-0700), [email protected] wrote:

The Linux note in the vdso allows glibc to check the running kernel version without having to issue the uname syscall.

---
 arch/riscv/kernel/vdso/Makefile |  2 +-
 arch/riscv/kernel/vdso/note.S   | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/kernel/vdso/note.S
arch/riscv/kernel/vdso/Makefile +1 -1
index 33b16f4212f7..281dc58189e0 100644
@@ -12,7 +12,7 @@ vdso-syms += getcpu
 vdso-syms += flush_icache
 
 # Files to link into the vdso
-obj-vdso = $(patsubst %, %.o, $(vdso-syms))
+obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
 
 # Build rules
 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
arch/riscv/kernel/vdso/note.S new file +2 -0
new file mode 100644
index 000000000000..2a956c942211
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*

arch/riscv/kernel/vdso/note.S line 12

Quoted 10 lines
arch/riscv/kernel/vdso/note.S new file +10 -0
+ * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
+ * Here we can supply some information useful to userland.
+ */
+
+#include <linux/elfnote.h>
+#include <linux/version.h>
+
+ELFNOTE_START(Linux, 0, "a")
+	.long LINUX_VERSION_CODE
+ELFNOTE_END

Thanks. I've put this on fixes.