linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Kees Cook <keescook@chromium.org>
Cc: "linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Evgeniy Didin <Evgeniy.Didin@synopsys.com>
Subject: Re: [PATCH] ARC: fix CONFIG_HARDENED_USERCOPY
Date: Fri, 11 Jun 2021 00:29:38 +0000	[thread overview]
Message-ID: <8519812d-b2b5-ec2a-17d5-856c62538810@synopsys.com> (raw)
In-Reply-To: <202106101656.C79AEC493@keescook>

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@chromium.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.


      reply	other threads:[~2021-06-11  0:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 22:12 [PATCH] ARC: fix CONFIG_HARDENED_USERCOPY Vineet Gupta
2021-06-10 17:02 ` Kees Cook
2021-06-10 18:56   ` Vineet Gupta
2021-06-10 23:56     ` Kees Cook
2021-06-11  0:29       ` Vineet Gupta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8519812d-b2b5-ec2a-17d5-856c62538810@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=Evgeniy.Didin@synopsys.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).