[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202406171122.B5FDA6A@keescook>
Date: Mon, 17 Jun 2024 11:22:55 -0700
From: Kees Cook <kees@...nel.org>
To: Mark Rutland <mark.rutland@....com>
Cc: Yuntao Liu <liuyuntao12@...wei.com>, x86@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-s390@...r.kernel.org, linux-hardening@...r.kernel.org,
catalin.marinas@....com, will@...nel.org, hca@...ux.ibm.com,
gor@...ux.ibm.com, agordeev@...ux.ibm.com,
borntraeger@...ux.ibm.com, svens@...ux.ibm.com, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
hpa@...or.com, gustavoars@...nel.org, arnd@...db.de,
leobras@...hat.com, broonie@...nel.org, imbrenda@...ux.ibm.com,
pawan.kumar.gupta@...ux.intel.com
Subject: Re: [PATCH] remove AND operation in choose_random_kstack_offset()
On Mon, Jun 17, 2024 at 04:52:15PM +0100, Mark Rutland wrote:
> On Mon, Jun 17, 2024 at 01:37:21PM +0000, Yuntao Liu wrote:
> > Since the offset would be bitwise ANDed with 0x3FF in
> > add_random_kstack_offset(), so just remove AND operation here.
> >
> > Signed-off-by: Yuntao Liu <liuyuntao12@...wei.com>
>
> The comments in arm64 and x86 say that they're deliberately capping the
> offset at fewer bits than the result of KSTACK_OFFSET_MAX() masking the
> value with 0x3FF.
>
> Maybe it's ok to expand that, but if that's the case the commit message
> needs to explain why it's safe add extra bits (2 on arm64, 3 on s39 and
> x86), and those comments need to be updated accordingly.
>
> As-is, I do not think this patch is ok.
Yeah, I agree: the truncation is intentional and tuned to the
architecture.
--
Kees Cook
Powered by blists - more mailing lists