All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/uapi: fix SHADOW_STACK_SET_TOKEN type
@ 2023-10-22 22:21 Dmitry V. Levin
  2023-10-23 16:36 ` Edgecombe, Rick P
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2023-10-22 22:21 UTC (permalink / raw)
  To: Rick Edgecombe, Dave Hansen, Borislav Petkov; +Cc: x86, linux-api, linux-kernel

Fix the type of SHADOW_STACK_SET_TOKEN to match the type of the
corresponding "flags" argument of map_shadow_stack syscall which
is of type "unsigned int".

Fixes: c35559f94ebc3 ("x86/shstk: Introduce map_shadow_stack syscall")
Signed-off-by: Dmitry V. Levin <ldv@strace.io>
---
 arch/x86/include/uapi/asm/mman.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/uapi/asm/mman.h b/arch/x86/include/uapi/asm/mman.h
index 46cdc941f958..8419e25bb617 100644
--- a/arch/x86/include/uapi/asm/mman.h
+++ b/arch/x86/include/uapi/asm/mman.h
@@ -6,7 +6,7 @@
 #define MAP_ABOVE4G	0x80		/* only map above 4GB */
 
 /* Flags for map_shadow_stack(2) */
-#define SHADOW_STACK_SET_TOKEN	(1ULL << 0)	/* Set up a restore token in the shadow stack */
+#define SHADOW_STACK_SET_TOKEN	(1U << 0)	/* Set up a restore token in the shadow stack */
 
 #include <asm-generic/mman.h>
 
-- 
ldv

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

* Re: [PATCH] x86/uapi: fix SHADOW_STACK_SET_TOKEN type
  2023-10-22 22:21 [PATCH] x86/uapi: fix SHADOW_STACK_SET_TOKEN type Dmitry V. Levin
@ 2023-10-23 16:36 ` Edgecombe, Rick P
  2023-10-23 20:11   ` Dmitry V. Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Edgecombe, Rick P @ 2023-10-23 16:36 UTC (permalink / raw)
  To: ldv, dave.hansen, bp; +Cc: linux-kernel, x86, linux-api

On Mon, 2023-10-23 at 01:21 +0300, Dmitry V. Levin wrote:
> Fix the type of SHADOW_STACK_SET_TOKEN to match the type of the
> corresponding "flags" argument of map_shadow_stack syscall which
> is of type "unsigned int".
> 
> Fixes: c35559f94ebc3 ("x86/shstk: Introduce map_shadow_stack
> syscall")
> Signed-off-by: Dmitry V. Levin <ldv@strace.io>
> ---
>  arch/x86/include/uapi/asm/mman.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/uapi/asm/mman.h
> b/arch/x86/include/uapi/asm/mman.h
> index 46cdc941f958..8419e25bb617 100644
> --- a/arch/x86/include/uapi/asm/mman.h
> +++ b/arch/x86/include/uapi/asm/mman.h
> @@ -6,7 +6,7 @@
>  #define MAP_ABOVE4G    0x80            /* only map above 4GB */
>  
>  /* Flags for map_shadow_stack(2) */
> -#define SHADOW_STACK_SET_TOKEN (1ULL << 0)     /* Set up a restore
> token in the shadow stack */
> +#define SHADOW_STACK_SET_TOKEN (1U << 0)       /* Set up a restore
> token in the shadow stack */
>  
>  #include <asm-generic/mman.h>

Good point that they are mismatched. I don't remember why flags is not
an unsigned long though. I wonder if we should quick change it to an
unsigned long, if it's not too late. We probably won't run out of
flags, but maybe some value could get stuffed in the upper bits or
something someday.

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

* Re: [PATCH] x86/uapi: fix SHADOW_STACK_SET_TOKEN type
  2023-10-23 16:36 ` Edgecombe, Rick P
@ 2023-10-23 20:11   ` Dmitry V. Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry V. Levin @ 2023-10-23 20:11 UTC (permalink / raw)
  To: Edgecombe, Rick P; +Cc: dave.hansen, bp, x86, linux-api, linux-kernel

On Mon, Oct 23, 2023 at 04:36:48PM +0000, Edgecombe, Rick P wrote:
> On Mon, 2023-10-23 at 01:21 +0300, Dmitry V. Levin wrote:
> > Fix the type of SHADOW_STACK_SET_TOKEN to match the type of the
> > corresponding "flags" argument of map_shadow_stack syscall which
> > is of type "unsigned int".
> > 
> > Fixes: c35559f94ebc3 ("x86/shstk: Introduce map_shadow_stack
> > syscall")
> > Signed-off-by: Dmitry V. Levin <ldv@strace.io>
> > ---
> >  arch/x86/include/uapi/asm/mman.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/include/uapi/asm/mman.h
> > b/arch/x86/include/uapi/asm/mman.h
> > index 46cdc941f958..8419e25bb617 100644
> > --- a/arch/x86/include/uapi/asm/mman.h
> > +++ b/arch/x86/include/uapi/asm/mman.h
> > @@ -6,7 +6,7 @@
> >  #define MAP_ABOVE4G    0x80            /* only map above 4GB */
> >  
> >  /* Flags for map_shadow_stack(2) */
> > -#define SHADOW_STACK_SET_TOKEN (1ULL << 0)     /* Set up a restore
> > token in the shadow stack */
> > +#define SHADOW_STACK_SET_TOKEN (1U << 0)       /* Set up a restore
> > token in the shadow stack */
> >  
> >  #include <asm-generic/mman.h>
> 
> Good point that they are mismatched. I don't remember why flags is not
> an unsigned long though. I wonder if we should quick change it to an
> unsigned long, if it's not too late. We probably won't run out of
> flags, but maybe some value could get stuffed in the upper bits or
> something someday.

We usually don't use unsigned long for flags because we support 32-bit
architectures.


-- 
ldv

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

end of thread, other threads:[~2023-10-23 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22 22:21 [PATCH] x86/uapi: fix SHADOW_STACK_SET_TOKEN type Dmitry V. Levin
2023-10-23 16:36 ` Edgecombe, Rick P
2023-10-23 20:11   ` Dmitry V. Levin

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.