All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ELF, uapi: fixup ELF_ST_TYPE definition
@ 2022-04-29 14:50 Alexey Dobriyan
  2022-04-29 17:25 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2022-04-29 14:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-api

This is very theoretical compile failure:

	ELF_ST_TYPE(st_info = A)

Cast will bind first and st_info will stop being lvalue:

	error: lvalue required as left operand of assignment

Given that the only use of this macro is

	ELF_ST_TYPE(sym->st_info)

where st_info is "unsigned char" I've decided to remove cast especially
given that companion macro ELF_ST_BIND doesn't use cast.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 include/uapi/linux/elf.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -134,7 +134,7 @@ typedef __s64	Elf64_Sxword;
 #define STT_TLS     6
 
 #define ELF_ST_BIND(x)		((x) >> 4)
-#define ELF_ST_TYPE(x)		(((unsigned int) x) & 0xf)
+#define ELF_ST_TYPE(x)		((x) & 0xf)
 #define ELF32_ST_BIND(x)	ELF_ST_BIND(x)
 #define ELF32_ST_TYPE(x)	ELF_ST_TYPE(x)
 #define ELF64_ST_BIND(x)	ELF_ST_BIND(x)

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

* Re: [PATCH] ELF, uapi: fixup ELF_ST_TYPE definition
  2022-04-29 14:50 [PATCH] ELF, uapi: fixup ELF_ST_TYPE definition Alexey Dobriyan
@ 2022-04-29 17:25 ` Kees Cook
  2022-04-29 18:02   ` Alexey Dobriyan
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2022-04-29 17:25 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel, Eric Biederman, linux-api

On Fri, Apr 29, 2022 at 05:50:03PM +0300, Alexey Dobriyan wrote:
> This is very theoretical compile failure:
> 
> 	ELF_ST_TYPE(st_info = A)
> 
> Cast will bind first and st_info will stop being lvalue:
> 
> 	error: lvalue required as left operand of assignment
> 
> Given that the only use of this macro is
> 
> 	ELF_ST_TYPE(sym->st_info)
> 
> where st_info is "unsigned char" I've decided to remove cast especially
> given that companion macro ELF_ST_BIND doesn't use cast.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  include/uapi/linux/elf.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

It looks like akpm already pulled this, so:

Acked-by: Kees Cook <keescook@chromium.org>

Please keep Eric & I CCed on ELF changes; there's a MAINTAINERS entry
now...

-Kees

-- 
Kees Cook

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

* Re: [PATCH] ELF, uapi: fixup ELF_ST_TYPE definition
  2022-04-29 17:25 ` Kees Cook
@ 2022-04-29 18:02   ` Alexey Dobriyan
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Dobriyan @ 2022-04-29 18:02 UTC (permalink / raw)
  To: Kees Cook; +Cc: akpm, linux-kernel, Eric Biederman, linux-api

On Fri, Apr 29, 2022 at 10:25:23AM -0700, Kees Cook wrote:
> Please keep Eric & I CCed on ELF changes; there's a MAINTAINERS entry
> now...

Hah!

I honestly searched for 'ELF' before sending and didn't find anything.

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

end of thread, other threads:[~2022-04-29 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 14:50 [PATCH] ELF, uapi: fixup ELF_ST_TYPE definition Alexey Dobriyan
2022-04-29 17:25 ` Kees Cook
2022-04-29 18:02   ` Alexey Dobriyan

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.