All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/vdso: Use proper modifier for len's printf in extract
@ 2021-03-03  6:43 Jiri Slaby
  2021-03-03 15:28 ` Jarkko Sakkinen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jiri Slaby @ 2021-03-03  6:43 UTC (permalink / raw)
  To: bp
  Cc: linux-kernel, Jiri Slaby, Andy Lutomirski, Sean Christopherson,
	Jarkko Sakkinen, Borislav Petkov, Jethro Beekman,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

Commit 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO
functions") added a printf of len which is size_t. Compilers now
complain on 32b:
In file included from arch/x86/entry/vdso/vdso2c.c:162:
arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}

So use proper modifier (%zu) for size_t.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Fixes: 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Jethro Beekman <jethro@fortanix.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/x86/entry/vdso/vdso2c.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index 1c7cfac7e64a..5264daa8859f 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -35,7 +35,7 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
 	if (offset + len > data_len)
 		fail("section to extract overruns input data");
 
-	fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
+	fprintf(outfile, "static const unsigned char %s[%zu] = {", name, len);
 	BITSFUNC(copy)(outfile, data + offset, len);
 	fprintf(outfile, "\n};\n\n");
 }
-- 
2.30.1


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

* Re: [PATCH] x86/vdso: Use proper modifier for len's printf in extract
  2021-03-03  6:43 [PATCH] x86/vdso: Use proper modifier for len's printf in extract Jiri Slaby
@ 2021-03-03 15:28 ` Jarkko Sakkinen
  2021-03-03 18:36 ` Borislav Petkov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Jarkko Sakkinen @ 2021-03-03 15:28 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: bp, linux-kernel, Andy Lutomirski, Sean Christopherson,
	Borislav Petkov, Jethro Beekman, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Wed, Mar 03, 2021 at 07:43:57AM +0100, Jiri Slaby wrote:
> Commit 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO
> functions") added a printf of len which is size_t. Compilers now
> complain on 32b:
> In file included from arch/x86/entry/vdso/vdso2c.c:162:
> arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
> arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}
> 
> So use proper modifier (%zu) for size_t.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Fixes: 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Jethro Beekman <jethro@fortanix.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org


Acked-by: Jarkko Sakkinen <jarkko@kernel.org>

> ---
>  arch/x86/entry/vdso/vdso2c.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
> index 1c7cfac7e64a..5264daa8859f 100644
> --- a/arch/x86/entry/vdso/vdso2c.h
> +++ b/arch/x86/entry/vdso/vdso2c.h
> @@ -35,7 +35,7 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
>  	if (offset + len > data_len)
>  		fail("section to extract overruns input data");
>  
> -	fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> +	fprintf(outfile, "static const unsigned char %s[%zu] = {", name, len);
>  	BITSFUNC(copy)(outfile, data + offset, len);
>  	fprintf(outfile, "\n};\n\n");
>  }
> -- 
> 2.30.1
> 
> 

/Jarkko

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

* Re: [PATCH] x86/vdso: Use proper modifier for len's printf in extract
  2021-03-03  6:43 [PATCH] x86/vdso: Use proper modifier for len's printf in extract Jiri Slaby
  2021-03-03 15:28 ` Jarkko Sakkinen
@ 2021-03-03 18:36 ` Borislav Petkov
  2021-03-04  5:18   ` Jiri Slaby
  2021-03-04 10:54 ` [tip: x86/vdso] x86/vdso: Use proper modifier for len's format specifier in extract() tip-bot2 for Jiri Slaby
  2021-03-06 10:38 ` tip-bot2 for Jiri Slaby
  3 siblings, 1 reply; 9+ messages in thread
From: Borislav Petkov @ 2021-03-03 18:36 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Andy Lutomirski, Sean Christopherson,
	Jarkko Sakkinen, Jethro Beekman, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Wed, Mar 03, 2021 at 07:43:57AM +0100, Jiri Slaby wrote:
> Commit 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO
> functions") added a printf of len which is size_t. Compilers now
> complain on 32b:
> In file included from arch/x86/entry/vdso/vdso2c.c:162:
> arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
> arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}
> 

I know it is obvious but how do you trigger this?

A 32-bit allmodconfig with both debian's gcc-10 and leap15's gcc-7 don't
trigger that warning. Which might answer your question why I haven't
caught it yet. :-)

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH] x86/vdso: Use proper modifier for len's printf in extract
  2021-03-03 18:36 ` Borislav Petkov
@ 2021-03-04  5:18   ` Jiri Slaby
  2021-03-04 10:48     ` Borislav Petkov
  0 siblings, 1 reply; 9+ messages in thread
From: Jiri Slaby @ 2021-03-04  5:18 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: linux-kernel, Andy Lutomirski, Sean Christopherson,
	Jarkko Sakkinen, Jethro Beekman, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On 03. 03. 21, 19:36, Borislav Petkov wrote:
> On Wed, Mar 03, 2021 at 07:43:57AM +0100, Jiri Slaby wrote:
>> Commit 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO
>> functions") added a printf of len which is size_t. Compilers now
>> complain on 32b:
>> In file included from arch/x86/entry/vdso/vdso2c.c:162:
>> arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
>> arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}
>>
> 
> I know it is obvious but how do you trigger this?
> 
> A 32-bit allmodconfig with both debian's gcc-10 and leap15's gcc-7 don't
> trigger that warning. Which might answer your question why I haven't
> caught it yet. :-)

It was caught by suse's build bot while merging the stable branch. But 
it can be also seen in OBS in Kernel:stable:

https://build.opensuse.org/public/build/Kernel:stable/standard/i586/kernel-pae/_log
https://build.opensuse.org/public/build/Kernel:stable/standard/i586/kernel-vanilla/_log

It's built with gcc 10 from tumbleweed and it's a standard config from 
kerncvs:
https://github.com/openSUSE/kernel-source/blob/stable/config/i386/pae

thanks,
-- 
js
suse labs

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

* Re: [PATCH] x86/vdso: Use proper modifier for len's printf in extract
  2021-03-04  5:18   ` Jiri Slaby
@ 2021-03-04 10:48     ` Borislav Petkov
  2021-03-04 10:55       ` Jiri Slaby
  0 siblings, 1 reply; 9+ messages in thread
From: Borislav Petkov @ 2021-03-04 10:48 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Andy Lutomirski, Sean Christopherson,
	Jarkko Sakkinen, Jethro Beekman, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Thu, Mar 04, 2021 at 06:18:25AM +0100, Jiri Slaby wrote:
> It's built with gcc 10 from tumbleweed and it's a standard config from
> kerncvs:
> https://github.com/openSUSE/kernel-source/blob/stable/config/i386/pae

Nope, can't trigger with that one either. :-\

Anyway, it is obvious enough so applied.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* [tip: x86/vdso] x86/vdso: Use proper modifier for len's format specifier in extract()
  2021-03-03  6:43 [PATCH] x86/vdso: Use proper modifier for len's printf in extract Jiri Slaby
  2021-03-03 15:28 ` Jarkko Sakkinen
  2021-03-03 18:36 ` Borislav Petkov
@ 2021-03-04 10:54 ` tip-bot2 for Jiri Slaby
  2021-03-06 10:38 ` tip-bot2 for Jiri Slaby
  3 siblings, 0 replies; 9+ messages in thread
From: tip-bot2 for Jiri Slaby @ 2021-03-04 10:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jiri Slaby, Borislav Petkov, Jarkko Sakkinen, x86, linux-kernel

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

Commit-ID:     6bdbe1760651484b0fe6f6d0cc3a2fe8741e6f87
Gitweb:        https://git.kernel.org/tip/6bdbe1760651484b0fe6f6d0cc3a2fe8741e6f87
Author:        Jiri Slaby <jslaby@suse.cz>
AuthorDate:    Wed, 03 Mar 2021 07:43:57 +01:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Thu, 04 Mar 2021 11:47:01 +01:00

x86/vdso: Use proper modifier for len's format specifier in extract()

Commit

  8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")

prints length "len" which is size_t. Compilers now complain on 32-bit:

  In file included from arch/x86/entry/vdso/vdso2c.c:162:
  arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
  arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of \
	type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}

So use proper modifier (%zu) for size_t.

 [ bp: Massage commit message. ]

Fixes: 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lkml.kernel.org/r/20210303064357.17056-1-jslaby@suse.cz
---
 arch/x86/entry/vdso/vdso2c.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index 1c7cfac..5264daa 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -35,7 +35,7 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
 	if (offset + len > data_len)
 		fail("section to extract overruns input data");
 
-	fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
+	fprintf(outfile, "static const unsigned char %s[%zu] = {", name, len);
 	BITSFUNC(copy)(outfile, data + offset, len);
 	fprintf(outfile, "\n};\n\n");
 }

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

* Re: [PATCH] x86/vdso: Use proper modifier for len's printf in extract
  2021-03-04 10:48     ` Borislav Petkov
@ 2021-03-04 10:55       ` Jiri Slaby
  2021-03-04 11:04         ` Borislav Petkov
  0 siblings, 1 reply; 9+ messages in thread
From: Jiri Slaby @ 2021-03-04 10:55 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: linux-kernel, Andy Lutomirski, Sean Christopherson,
	Jarkko Sakkinen, Jethro Beekman, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On 04. 03. 21, 11:48, Borislav Petkov wrote:
> On Thu, Mar 04, 2021 at 06:18:25AM +0100, Jiri Slaby wrote:
>> It's built with gcc 10 from tumbleweed and it's a standard config from
>> kerncvs:
>> https://github.com/openSUSE/kernel-source/blob/stable/config/i386/pae
> 
> Nope, can't trigger with that one either. :-\

Beware:
HOSTCC  arch/x86/entry/vdso/vdso2c
^^^^^^
You would need to _be_ on i586. Or try with -m32:

> gcc -m32 -Wp,-MMD,arch/x86/entry/vdso/.vdso2c.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89     -I/dev/shm/jslaby/linux/tools/include -I/dev/shm/jslaby/linux/include/uapi -I/dev/shm/jslaby/linux/arch/i386/include/uapi  -I ./arch/x86/entry/vdso   -o /dev/null /dev/shm/jslaby/linux/arch/x86/entry/vdso/vdso2c.c
> In file included from /dev/shm/jslaby/linux/arch/x86/entry/vdso/vdso2c.c:162:0:
> /dev/shm/jslaby/linux/arch/x86/entry/vdso/vdso2c.h: In function ‘extract64’:
> /dev/shm/jslaby/linux/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t {aka unsigned int}’ [-Wformat=]
>   fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
>                                                   ~~^
>                                                   %u
> In file included from /dev/shm/jslaby/linux/arch/x86/entry/vdso/vdso2c.c:166:0:
> /dev/shm/jslaby/linux/arch/x86/entry/vdso/vdso2c.h: In function ‘extract32’:
> /dev/shm/jslaby/linux/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t {aka unsigned int}’ [-Wformat=]
>   fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
>                                                   ~~^
>                                                   %u

regards,
-- 
js
suse labs

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

* Re: [PATCH] x86/vdso: Use proper modifier for len's printf in extract
  2021-03-04 10:55       ` Jiri Slaby
@ 2021-03-04 11:04         ` Borislav Petkov
  0 siblings, 0 replies; 9+ messages in thread
From: Borislav Petkov @ 2021-03-04 11:04 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Andy Lutomirski, Sean Christopherson,
	Jarkko Sakkinen, Jethro Beekman, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Thu, Mar 04, 2021 at 11:55:18AM +0100, Jiri Slaby wrote:
> On 04. 03. 21, 11:48, Borislav Petkov wrote:
> > On Thu, Mar 04, 2021 at 06:18:25AM +0100, Jiri Slaby wrote:
> > > It's built with gcc 10 from tumbleweed and it's a standard config from
> > > kerncvs:
> > > https://github.com/openSUSE/kernel-source/blob/stable/config/i386/pae
> > 
> > Nope, can't trigger with that one either. :-\
> 
> Beware:
> HOSTCC  arch/x86/entry/vdso/vdso2c
> ^^^^^^
> You would need to _be_ on i586. Or try with -m32:

Yah, that is the explanation. I would've never seen because - although I
do the regular 32-bit builds - I don't do them on a 32-bit platform. But
hey, OBS does. :)

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* [tip: x86/vdso] x86/vdso: Use proper modifier for len's format specifier in extract()
  2021-03-03  6:43 [PATCH] x86/vdso: Use proper modifier for len's printf in extract Jiri Slaby
                   ` (2 preceding siblings ...)
  2021-03-04 10:54 ` [tip: x86/vdso] x86/vdso: Use proper modifier for len's format specifier in extract() tip-bot2 for Jiri Slaby
@ 2021-03-06 10:38 ` tip-bot2 for Jiri Slaby
  3 siblings, 0 replies; 9+ messages in thread
From: tip-bot2 for Jiri Slaby @ 2021-03-06 10:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jiri Slaby, Borislav Petkov, Jarkko Sakkinen, x86, linux-kernel

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

Commit-ID:     70c9d959226b7c5c48c119e2c1cfc1424f87b023
Gitweb:        https://git.kernel.org/tip/70c9d959226b7c5c48c119e2c1cfc1424f87b023
Author:        Jiri Slaby <jslaby@suse.cz>
AuthorDate:    Wed, 03 Mar 2021 07:43:57 +01:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Sat, 06 Mar 2021 11:34:07 +01:00

x86/vdso: Use proper modifier for len's format specifier in extract()

Commit

  8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")

prints length "len" which is size_t.

Compilers now complain when building on a 32-bit host:

  HOSTCC  arch/x86/entry/vdso/vdso2c
  ...
  In file included from arch/x86/entry/vdso/vdso2c.c:162:
  arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
  arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of \
	type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}

So use proper modifier (%zu) for size_t.

 [ bp: Massage commit message. ]

Fixes: 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lkml.kernel.org/r/20210303064357.17056-1-jslaby@suse.cz
---
 arch/x86/entry/vdso/vdso2c.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index 1c7cfac..5264daa 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -35,7 +35,7 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
 	if (offset + len > data_len)
 		fail("section to extract overruns input data");
 
-	fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
+	fprintf(outfile, "static const unsigned char %s[%zu] = {", name, len);
 	BITSFUNC(copy)(outfile, data + offset, len);
 	fprintf(outfile, "\n};\n\n");
 }

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

end of thread, other threads:[~2021-03-06 10:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03  6:43 [PATCH] x86/vdso: Use proper modifier for len's printf in extract Jiri Slaby
2021-03-03 15:28 ` Jarkko Sakkinen
2021-03-03 18:36 ` Borislav Petkov
2021-03-04  5:18   ` Jiri Slaby
2021-03-04 10:48     ` Borislav Petkov
2021-03-04 10:55       ` Jiri Slaby
2021-03-04 11:04         ` Borislav Petkov
2021-03-04 10:54 ` [tip: x86/vdso] x86/vdso: Use proper modifier for len's format specifier in extract() tip-bot2 for Jiri Slaby
2021-03-06 10:38 ` tip-bot2 for Jiri Slaby

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.