linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] x86/vdso: Little clean-ups
@ 2020-04-20 18:32 Dmitry Safonov
  2020-04-20 18:32 ` [PATCH 1/3] x86/vdso2c: Correct err messages on file opening Dmitry Safonov
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Dmitry Safonov @ 2020-04-20 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Safonov, Dmitry Safonov, Andrei Vagin, Andy Lutomirski,
	Borislav Petkov, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	Vincenzo Frascino, x86, Andrei Vagin

Resending some patches those weren't needed after timens series evolved,
but still make sense. Nothing really important, just 3 nits here and
there.

Cc: Andrei Vagin <avagin@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: x86@kernel.org

Dmitry Safonov (3):
  x86/vdso2c: Correct err messages on file opening
  x86/vdso2c: Convert iterators to unsigned
  x86/vdso/Makefile: Add vobjs32

 arch/x86/entry/vdso/Makefile | 15 +++++----------
 arch/x86/entry/vdso/vdso2c.c |  4 ++--
 arch/x86/entry/vdso/vdso2c.h | 16 +++++++---------
 3 files changed, 14 insertions(+), 21 deletions(-)

-- 
2.26.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] x86/vdso2c: Correct err messages on file opening
  2020-04-20 18:32 [PATCH 0/3] x86/vdso: Little clean-ups Dmitry Safonov
@ 2020-04-20 18:32 ` Dmitry Safonov
  2020-04-21 18:37   ` [tip: x86/vdso] x86/vdso/vdso2c: Correct error messages on file open tip-bot2 for Dmitry Safonov
  2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterator to unsigned Dmitry Safonov
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Safonov @ 2020-04-20 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Safonov, Dmitry Safonov, Andrei Vagin, Andy Lutomirski,
	Borislav Petkov, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	Vincenzo Frascino, x86, Andrei Vagin

err() message in main() is misleading: it should print `outfilename`,
which is argv[3], not argv[2].

Correct error messages to be more precise about what failed and for
which file.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 arch/x86/entry/vdso/vdso2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
index 3842873b3ae3..7380908045c7 100644
--- a/arch/x86/entry/vdso/vdso2c.c
+++ b/arch/x86/entry/vdso/vdso2c.c
@@ -187,7 +187,7 @@ static void map_input(const char *name, void **addr, size_t *len, int prot)
 
 	int fd = open(name, O_RDONLY);
 	if (fd == -1)
-		err(1, "%s", name);
+		err(1, "open(%s)", name);
 
 	tmp_len = lseek(fd, 0, SEEK_END);
 	if (tmp_len == (off_t)-1)
@@ -240,7 +240,7 @@ int main(int argc, char **argv)
 	outfilename = argv[3];
 	outfile = fopen(outfilename, "w");
 	if (!outfile)
-		err(1, "%s", argv[2]);
+		err(1, "fopen(%s)", outfilename);
 
 	go(raw_addr, raw_len, stripped_addr, stripped_len, outfile, name);
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] x86/vdso2c: Convert iterator to unsigned
  2020-04-20 18:32 [PATCH 0/3] x86/vdso: Little clean-ups Dmitry Safonov
  2020-04-20 18:32 ` [PATCH 1/3] x86/vdso2c: Correct err messages on file opening Dmitry Safonov
@ 2020-04-20 18:32 ` Dmitry Safonov
  2020-04-20 18:35   ` Dmitry Safonov
  2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterators " Dmitry Safonov
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Safonov @ 2020-04-20 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Safonov, Dmitry Safonov, Andrei Vagin, Andy Lutomirski,
	Borislav Petkov, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	Vincenzo Frascino, x86, Andrei Vagin

i and j are used everywhere with unsigned types.
Cleanup and prettify the code a bit.

Introduce syms_nr for readability and as a preparation for allocating an
array of vDSO entries that will be needed for creating two vdso .so's:
one for host tasks and another for processes inside time namespace.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 arch/x86/entry/vdso/vdso2c.h | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index a20b134de2a8..80be339ee93e 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -13,7 +13,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	unsigned long load_size = -1;  /* Work around bogus warning */
 	unsigned long mapping_size;
 	ELF(Ehdr) *hdr = (ELF(Ehdr) *)raw_addr;
-	int i;
+	unsigned int i, syms_nr;
 	unsigned long j;
 	ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr,
 		*alt_sec = NULL;
@@ -86,11 +86,10 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	strtab_hdr = raw_addr + GET_LE(&hdr->e_shoff) +
 		GET_LE(&hdr->e_shentsize) * GET_LE(&symtab_hdr->sh_link);
 
+	syms_nr = GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
 	/* Walk the symbol table */
-	for (i = 0;
-	     i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
-	     i++) {
-		int k;
+	for (i = 0; i < syms_nr; i++) {
+		unsigned int k;
 		ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
 			GET_LE(&symtab_hdr->sh_entsize) * i;
 		const char *sym_name = raw_addr +
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] x86/vdso2c: Convert iterators to unsigned
  2020-04-20 18:32 [PATCH 0/3] x86/vdso: Little clean-ups Dmitry Safonov
  2020-04-20 18:32 ` [PATCH 1/3] x86/vdso2c: Correct err messages on file opening Dmitry Safonov
  2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterator to unsigned Dmitry Safonov
@ 2020-04-20 18:32 ` Dmitry Safonov
  2020-04-21 18:37   ` [tip: x86/vdso] x86/vdso/vdso2c: " tip-bot2 for Dmitry Safonov
  2020-04-20 18:32 ` [PATCH 3/3] x86/vdso/Makefile: Add vobjs32 Dmitry Safonov
  2020-04-21 17:14 ` [PATCH 0/3] x86/vdso: Little clean-ups Andy Lutomirski
  4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Safonov @ 2020-04-20 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Safonov, Dmitry Safonov, Andrei Vagin, Andy Lutomirski,
	Borislav Petkov, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	Vincenzo Frascino, x86, Andrei Vagin

`i` and `j` are used everywhere with unsigned types.

Convert `i` to unsigned long in order to avoid signed to unsigned
comparisons.  Convert `k` to unsigned int with the same purpose.
Also, drop `j` as `i` could be used in place of it.
Introduce syms_nr for readability.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 arch/x86/entry/vdso/vdso2c.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index a20b134de2a8..6f46e11ce539 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -13,8 +13,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	unsigned long load_size = -1;  /* Work around bogus warning */
 	unsigned long mapping_size;
 	ELF(Ehdr) *hdr = (ELF(Ehdr) *)raw_addr;
-	int i;
-	unsigned long j;
+	unsigned long i, syms_nr;
 	ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr,
 		*alt_sec = NULL;
 	ELF(Dyn) *dyn = 0, *dyn_end = 0;
@@ -86,11 +85,10 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	strtab_hdr = raw_addr + GET_LE(&hdr->e_shoff) +
 		GET_LE(&hdr->e_shentsize) * GET_LE(&symtab_hdr->sh_link);
 
+	syms_nr = GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
 	/* Walk the symbol table */
-	for (i = 0;
-	     i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
-	     i++) {
-		int k;
+	for (i = 0; i < syms_nr; i++) {
+		unsigned int k;
 		ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
 			GET_LE(&symtab_hdr->sh_entsize) * i;
 		const char *sym_name = raw_addr +
@@ -150,11 +148,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	fprintf(outfile,
 		"static unsigned char raw_data[%lu] __ro_after_init __aligned(PAGE_SIZE) = {",
 		mapping_size);
-	for (j = 0; j < stripped_len; j++) {
-		if (j % 10 == 0)
+	for (i = 0; i < stripped_len; i++) {
+		if (i % 10 == 0)
 			fprintf(outfile, "\n\t");
 		fprintf(outfile, "0x%02X, ",
-			(int)((unsigned char *)stripped_addr)[j]);
+			(int)((unsigned char *)stripped_addr)[i]);
 	}
 	fprintf(outfile, "\n};\n\n");
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] x86/vdso/Makefile: Add vobjs32
  2020-04-20 18:32 [PATCH 0/3] x86/vdso: Little clean-ups Dmitry Safonov
                   ` (2 preceding siblings ...)
  2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterators " Dmitry Safonov
@ 2020-04-20 18:32 ` Dmitry Safonov
  2020-04-21 18:37   ` [tip: x86/vdso] " tip-bot2 for Dmitry Safonov
  2020-04-21 17:14 ` [PATCH 0/3] x86/vdso: Little clean-ups Andy Lutomirski
  4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Safonov @ 2020-04-20 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Safonov, Dmitry Safonov, Andrei Vagin, Andy Lutomirski,
	Borislav Petkov, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	Vincenzo Frascino, x86, Andrei Vagin

Treat ia32/i386 objects in array the same as 64-bit vdso objects.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 arch/x86/entry/vdso/Makefile | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index 433a1259f61d..54e03ab26ff3 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -24,6 +24,8 @@ VDSO32-$(CONFIG_IA32_EMULATION)	:= y
 
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
+vobjs32-y := vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
+vobjs32-y += vdso32/vclock_gettime.o
 
 # files to link into kernel
 obj-y				+= vma.o
@@ -37,10 +39,12 @@ vdso_img-$(VDSO32-y)		+= 32
 obj-$(VDSO32-y)			+= vdso32-setup.o
 
 vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
+vobjs32 := $(foreach F,$(vobjs32-y),$(obj)/$F)
 
 $(obj)/vdso.o: $(obj)/vdso.so
 
 targets += vdso.lds $(vobjs-y)
+targets += vdso32/vdso32.lds $(vobjs32-y)
 
 # Build the vDSO image C files and link them in.
 vdso_img_objs := $(vdso_img-y:%=vdso-image-%.o)
@@ -130,10 +134,6 @@ $(obj)/vdsox32.so.dbg: $(obj)/vdsox32.lds $(vobjx32s) FORCE
 CPPFLAGS_vdso32/vdso32.lds = $(CPPFLAGS_vdso.lds)
 VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -soname linux-gate.so.1
 
-targets += vdso32/vdso32.lds
-targets += vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
-targets += vdso32/vclock_gettime.o
-
 KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) -DBUILD_VDSO
 $(obj)/vdso32.so.dbg: KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
 $(obj)/vdso32.so.dbg: asflags-$(CONFIG_X86_64) += -m32
@@ -158,12 +158,7 @@ endif
 
 $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
 
-$(obj)/vdso32.so.dbg: FORCE \
-		      $(obj)/vdso32/vdso32.lds \
-		      $(obj)/vdso32/vclock_gettime.o \
-		      $(obj)/vdso32/note.o \
-		      $(obj)/vdso32/system_call.o \
-		      $(obj)/vdso32/sigreturn.o
+$(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE
 	$(call if_changed,vdso_and_check)
 
 #
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] x86/vdso2c: Convert iterator to unsigned
  2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterator to unsigned Dmitry Safonov
@ 2020-04-20 18:35   ` Dmitry Safonov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry Safonov @ 2020-04-20 18:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Safonov, Andrei Vagin, Andy Lutomirski, Borislav Petkov,
	H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Vincenzo Frascino,
	x86, Andrei Vagin

This one was sent by a mistake, see
> [PATCH 2/3] x86/vdso2c: Convert iterators to unsigned
instead, please.

On 4/20/20 7:32 PM, Dmitry Safonov wrote:
> i and j are used everywhere with unsigned types.
> Cleanup and prettify the code a bit.
> 
> Introduce syms_nr for readability and as a preparation for allocating an
> array of vDSO entries that will be needed for creating two vdso .so's:
> one for host tasks and another for processes inside time namespace.
> 
> Co-developed-by: Andrei Vagin <avagin@openvz.org>
> Signed-off-by: Andrei Vagin <avagin@openvz.org>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
[..]
Thanks,
          Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] x86/vdso: Little clean-ups
  2020-04-20 18:32 [PATCH 0/3] x86/vdso: Little clean-ups Dmitry Safonov
                   ` (3 preceding siblings ...)
  2020-04-20 18:32 ` [PATCH 3/3] x86/vdso/Makefile: Add vobjs32 Dmitry Safonov
@ 2020-04-21 17:14 ` Andy Lutomirski
  4 siblings, 0 replies; 10+ messages in thread
From: Andy Lutomirski @ 2020-04-21 17:14 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: LKML, Dmitry Safonov, Andrei Vagin, Andy Lutomirski,
	Borislav Petkov, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	Vincenzo Frascino, X86 ML, Andrei Vagin

On Mon, Apr 20, 2020 at 11:33 AM Dmitry Safonov <dima@arista.com> wrote:
>
> Resending some patches those weren't needed after timens series evolved,
> but still make sense. Nothing really important, just 3 nits here and
> there.

Acked-by: Andy Lutomirski <luto@kernel.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [tip: x86/vdso] x86/vdso/vdso2c: Convert iterators to unsigned
  2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterators " Dmitry Safonov
@ 2020-04-21 18:37   ` tip-bot2 for Dmitry Safonov
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot2 for Dmitry Safonov @ 2020-04-21 18:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Andrei Vagin, Dmitry Safonov, Thomas Gleixner, Andy Lutomirski,
	x86, LKML

The following commit has been merged into the x86/vdso branch of tip:

Commit-ID:     833e55bb99bce116682efb94870b5c9f8a66f6af
Gitweb:        https://git.kernel.org/tip/833e55bb99bce116682efb94870b5c9f8a66f6af
Author:        Dmitry Safonov <dima@arista.com>
AuthorDate:    Mon, 20 Apr 2020 19:32:55 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 21 Apr 2020 20:33:16 +02:00

x86/vdso/vdso2c: Convert iterators to unsigned

`i` and `j` are used everywhere with unsigned types.

Convert `i` to unsigned long in order to avoid signed to unsigned
comparisons.  Convert `k` to unsigned int with the same purpose.
Also, drop `j` as `i` could be used in place of it.
Introduce syms_nr for readability.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200420183256.660371-4-dima@arista.com

---
 arch/x86/entry/vdso/vdso2c.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index a20b134..6f46e11 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -13,8 +13,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	unsigned long load_size = -1;  /* Work around bogus warning */
 	unsigned long mapping_size;
 	ELF(Ehdr) *hdr = (ELF(Ehdr) *)raw_addr;
-	int i;
-	unsigned long j;
+	unsigned long i, syms_nr;
 	ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr,
 		*alt_sec = NULL;
 	ELF(Dyn) *dyn = 0, *dyn_end = 0;
@@ -86,11 +85,10 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	strtab_hdr = raw_addr + GET_LE(&hdr->e_shoff) +
 		GET_LE(&hdr->e_shentsize) * GET_LE(&symtab_hdr->sh_link);
 
+	syms_nr = GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
 	/* Walk the symbol table */
-	for (i = 0;
-	     i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
-	     i++) {
-		int k;
+	for (i = 0; i < syms_nr; i++) {
+		unsigned int k;
 		ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
 			GET_LE(&symtab_hdr->sh_entsize) * i;
 		const char *sym_name = raw_addr +
@@ -150,11 +148,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	fprintf(outfile,
 		"static unsigned char raw_data[%lu] __ro_after_init __aligned(PAGE_SIZE) = {",
 		mapping_size);
-	for (j = 0; j < stripped_len; j++) {
-		if (j % 10 == 0)
+	for (i = 0; i < stripped_len; i++) {
+		if (i % 10 == 0)
 			fprintf(outfile, "\n\t");
 		fprintf(outfile, "0x%02X, ",
-			(int)((unsigned char *)stripped_addr)[j]);
+			(int)((unsigned char *)stripped_addr)[i]);
 	}
 	fprintf(outfile, "\n};\n\n");
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [tip: x86/vdso] x86/vdso/Makefile: Add vobjs32
  2020-04-20 18:32 ` [PATCH 3/3] x86/vdso/Makefile: Add vobjs32 Dmitry Safonov
@ 2020-04-21 18:37   ` tip-bot2 for Dmitry Safonov
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot2 for Dmitry Safonov @ 2020-04-21 18:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Andrei Vagin, Dmitry Safonov, Thomas Gleixner, Andy Lutomirski,
	x86, LKML

The following commit has been merged into the x86/vdso branch of tip:

Commit-ID:     cd2f45b7514cdddabbf3f81a98a20ae02f99efa1
Gitweb:        https://git.kernel.org/tip/cd2f45b7514cdddabbf3f81a98a20ae02f99efa1
Author:        Dmitry Safonov <dima@arista.com>
AuthorDate:    Mon, 20 Apr 2020 19:32:56 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 21 Apr 2020 20:33:17 +02:00

x86/vdso/Makefile: Add vobjs32

Treat ia32/i386 objects in array the same as 64-bit vdso objects.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200420183256.660371-5-dima@arista.com

---
 arch/x86/entry/vdso/Makefile | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index 433a125..54e03ab 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -24,6 +24,8 @@ VDSO32-$(CONFIG_IA32_EMULATION)	:= y
 
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
+vobjs32-y := vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
+vobjs32-y += vdso32/vclock_gettime.o
 
 # files to link into kernel
 obj-y				+= vma.o
@@ -37,10 +39,12 @@ vdso_img-$(VDSO32-y)		+= 32
 obj-$(VDSO32-y)			+= vdso32-setup.o
 
 vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
+vobjs32 := $(foreach F,$(vobjs32-y),$(obj)/$F)
 
 $(obj)/vdso.o: $(obj)/vdso.so
 
 targets += vdso.lds $(vobjs-y)
+targets += vdso32/vdso32.lds $(vobjs32-y)
 
 # Build the vDSO image C files and link them in.
 vdso_img_objs := $(vdso_img-y:%=vdso-image-%.o)
@@ -130,10 +134,6 @@ $(obj)/vdsox32.so.dbg: $(obj)/vdsox32.lds $(vobjx32s) FORCE
 CPPFLAGS_vdso32/vdso32.lds = $(CPPFLAGS_vdso.lds)
 VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -soname linux-gate.so.1
 
-targets += vdso32/vdso32.lds
-targets += vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
-targets += vdso32/vclock_gettime.o
-
 KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) -DBUILD_VDSO
 $(obj)/vdso32.so.dbg: KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
 $(obj)/vdso32.so.dbg: asflags-$(CONFIG_X86_64) += -m32
@@ -158,12 +158,7 @@ endif
 
 $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
 
-$(obj)/vdso32.so.dbg: FORCE \
-		      $(obj)/vdso32/vdso32.lds \
-		      $(obj)/vdso32/vclock_gettime.o \
-		      $(obj)/vdso32/note.o \
-		      $(obj)/vdso32/system_call.o \
-		      $(obj)/vdso32/sigreturn.o
+$(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE
 	$(call if_changed,vdso_and_check)
 
 #

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [tip: x86/vdso] x86/vdso/vdso2c: Correct error messages on file open
  2020-04-20 18:32 ` [PATCH 1/3] x86/vdso2c: Correct err messages on file opening Dmitry Safonov
@ 2020-04-21 18:37   ` tip-bot2 for Dmitry Safonov
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot2 for Dmitry Safonov @ 2020-04-21 18:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Andrei Vagin, Dmitry Safonov, Thomas Gleixner, Andy Lutomirski,
	x86, LKML

The following commit has been merged into the x86/vdso branch of tip:

Commit-ID:     089ef5579fc1b0b748bfb1600b4392f42db6fd5f
Gitweb:        https://git.kernel.org/tip/089ef5579fc1b0b748bfb1600b4392f42db6fd5f
Author:        Dmitry Safonov <dima@arista.com>
AuthorDate:    Mon, 20 Apr 2020 19:32:53 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 21 Apr 2020 20:33:16 +02:00

x86/vdso/vdso2c: Correct error messages on file open

err() message in main() is misleading: it should print `outfilename`,
which is argv[3], not argv[2].

Correct error messages to be more precise about what failed and for
which file.

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200420183256.660371-2-dima@arista.com

---
 arch/x86/entry/vdso/vdso2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
index 3842873..7380908 100644
--- a/arch/x86/entry/vdso/vdso2c.c
+++ b/arch/x86/entry/vdso/vdso2c.c
@@ -187,7 +187,7 @@ static void map_input(const char *name, void **addr, size_t *len, int prot)
 
 	int fd = open(name, O_RDONLY);
 	if (fd == -1)
-		err(1, "%s", name);
+		err(1, "open(%s)", name);
 
 	tmp_len = lseek(fd, 0, SEEK_END);
 	if (tmp_len == (off_t)-1)
@@ -240,7 +240,7 @@ int main(int argc, char **argv)
 	outfilename = argv[3];
 	outfile = fopen(outfilename, "w");
 	if (!outfile)
-		err(1, "%s", argv[2]);
+		err(1, "fopen(%s)", outfilename);
 
 	go(raw_addr, raw_len, stripped_addr, stripped_len, outfile, name);
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-21 18:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 18:32 [PATCH 0/3] x86/vdso: Little clean-ups Dmitry Safonov
2020-04-20 18:32 ` [PATCH 1/3] x86/vdso2c: Correct err messages on file opening Dmitry Safonov
2020-04-21 18:37   ` [tip: x86/vdso] x86/vdso/vdso2c: Correct error messages on file open tip-bot2 for Dmitry Safonov
2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterator to unsigned Dmitry Safonov
2020-04-20 18:35   ` Dmitry Safonov
2020-04-20 18:32 ` [PATCH 2/3] x86/vdso2c: Convert iterators " Dmitry Safonov
2020-04-21 18:37   ` [tip: x86/vdso] x86/vdso/vdso2c: " tip-bot2 for Dmitry Safonov
2020-04-20 18:32 ` [PATCH 3/3] x86/vdso/Makefile: Add vobjs32 Dmitry Safonov
2020-04-21 18:37   ` [tip: x86/vdso] " tip-bot2 for Dmitry Safonov
2020-04-21 17:14 ` [PATCH 0/3] x86/vdso: Little clean-ups Andy Lutomirski

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 NNTP newsgroup(s).