[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8519812d-b2b5-ec2a-17d5-856c62538810@synopsys.com>
Date: Fri, 11 Jun 2021 00:29:38 +0000
From: Vineet Gupta <Vineet.Gupta1@...opsys.com>
To: Kees Cook <keescook@...omium.org>
CC: "linux-snps-arc@...ts.infradead.org"
<linux-snps-arc@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Evgeniy Didin <Evgeniy.Didin@...opsys.com>
Subject: Re: [PATCH] ARC: fix CONFIG_HARDENED_USERCOPY
On 6/10/21 4:56 PM, Kees Cook wrote:
>>>> |Stack Trace:
>>>> | memfd_fcntl+0x0/0x470
>>>> | usercopy_abort+0x8a/0x8c
>>>> | __check_object_size+0x10e/0x138
>>>> | copy_strings+0x1f4/0x38c
>>>> | __do_execve_file+0x352/0x848
>>>> | EV_Trap+0xcc/0xd0
>>> What was the root cause here? Was it that the init section gets freed
>>> and reused for kmalloc?
>> Right. ARC _stext was encompassing the init section (to cover the init
>> code) so when init gets freed and used by kmalloc,
>> check_kernel_text_object() trips as it thinks the allocated pointer is
>> in kernel .text. Actually I should have added this to changelog.
> Great! Yeah, if you respin it with that added, please consider it:
>
> Reviewed-by: Kees Cook <keescook@...omium.org>
Thx. I added this and pushed to ARC for-curr
--->
The issue is triggered by an allocation in "init reclaimed" region.
ARC _stext emcompasses the init region (for historical reasons we
wanted
the init.text to be under .text as well). This however trips up
__check_object_size()->check_kernel_text_object() which treats this as
object bleedign into kernel text.
Fix that by rezoning _stext to start from regular kernel .text and
leave
out .init altogether.
Powered by blists - more mailing lists