* [PATCH] riscv: add Linux note to vdso
@ 2020-04-27 15:13 Andreas Schwab
2020-05-04 21:28 ` Palmer Dabbelt
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2020-04-27 15:13 UTC (permalink / raw)
To: linux-riscv
The Linux note in the vdso allows glibc to check the running kernel
version without having to issue the uname syscall.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
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
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index 33b16f4212f7..281dc58189e0 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -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
diff --git a/arch/riscv/kernel/vdso/note.S b/arch/riscv/kernel/vdso/note.S
new file mode 100644
index 000000000000..2a956c942211
--- /dev/null
+++ b/arch/riscv/kernel/vdso/note.S
@@ -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
--
2.26.2
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] riscv: add Linux note to vdso
2020-04-27 15:13 [PATCH] riscv: add Linux note to vdso Andreas Schwab
@ 2020-05-04 21:28 ` Palmer Dabbelt
0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2020-05-04 21:28 UTC (permalink / raw)
To: schwab; +Cc: linux-riscv
On Mon, 27 Apr 2020 08:13:34 PDT (-0700), schwab@suse.de wrote:
> The Linux note in the vdso allows glibc to check the running kernel
> version without having to issue the uname syscall.
>
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
> 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
>
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 33b16f4212f7..281dc58189e0 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -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
> diff --git a/arch/riscv/kernel/vdso/note.S b/arch/riscv/kernel/vdso/note.S
> new file mode 100644
> index 000000000000..2a956c942211
> --- /dev/null
> +++ b/arch/riscv/kernel/vdso/note.S
> @@ -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
Thanks. I've put this on fixes.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-04 21:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27 15:13 [PATCH] riscv: add Linux note to vdso Andreas Schwab
2020-05-04 21:28 ` Palmer Dabbelt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.