[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202401091501.4EC0C8EAD@keescook>
Date: Tue, 9 Jan 2024 15:01:37 -0800
From: Kees Cook <keescook@...omium.org>
To: Rick Edgecombe <rick.p.edgecombe@...el.com>
Cc: lkp@...el.com, x86@...nel.org, bp@...en8.de,
dave.hansen@...ux.intel.com, linux-kernel@...r.kernel.org,
oe-kbuild-all@...ts.linux.dev, yu-cheng.yu@...el.com
Subject: Re: [PATCH] x86/shstk: Use __force when casting away __user
On Tue, Jan 09, 2024 at 02:46:19PM -0800, Rick Edgecombe wrote:
> In setup_signal_shadow_stack() the kernel needs to push the restorer
> address to the shadow stack. This involves writing the value of the
> restorer pointer to the shadow stack. Since the restorer is defined as a
> __user in struct k_sigaction, the __user needs to be casted away to read
> the value. It is safe to do, because nothing is being dereferenced, and
> the de-__user-ed value is not stashed in an accessible local variable
> where it might accidentally be used for another purpose.
>
> However, sparse warns about casting away __user. So use __force to
> silence sparse and add a comment to explain why it is ok.
>
> Fixes: 05e36022c054 ("x86/shstk: Handle signals for shadow stack")
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202401080003.duO4RmjK-lkp@intel.com/
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
Seems fine to me. Thanks!
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists