mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Brad Hawthorne" <brad@sim.vu>,
	"Russell King" <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org
Cc: "Kees Cook" <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: xip: end _etext before the read-only data
Date: Wed, 25 Nov 2026 08:51:38 +0100	[thread overview]
Message-ID: <92686f21-9c49-4cdd-ba39-25c163fa3183@app.fastmail.com> (raw)
In-Reply-To: <20261125025650.1159785-1-brad@sim.vu>

On Wed, Nov 25, 2026, at 03:56, Brad Hawthorne wrote:
> The XIP linker script sets _etext after the read-only data, while
> vmlinux.lds.S sets it at the end of the text. Hardened usercopy
> refuses any copy to user space from _stext to _etext, so with
> XIP_KERNEL=y and HARDENED_USERCOPY=y, copying a const string from
> .rodata to user space ends in BUG(). The first readdir() of /dev is
> enough:
>
>   usercopy: Kernel memory exposure attempt detected from kernel text 
> (offset 2955300, size 1)!
>    __check_object_size from filldir+0xd6/0xfc
>    filldir from dir_emit_dots+0x34/0x80
>
> Commit 14c4a533e099 ("ARM: 8583/1: mm: fix location of _etext") moved
> _etext in vmlinux.lds.S for the same reason; the XIP script was
> missed. Set _etext at the end of the text there too.
>
> Tested under QEMU (mps2-an385) and on an RP2350 board, both XIP: the
> BUG is gone and directories list normally.
>
> This patch was written with an AI coding assistant (Claude Opus 5.5,
> Anthropic): it found the cause of the usercopy report, wrote the fix
> and this changelog, and ran the QEMU and board tests; I reviewed the
> reasoning and the test results.
>
> Fixes: dfd45b6103c9 ("ARM: uaccess: Enable hardened usercopy")
> Cc: stable@vger.kernel.org
> Signed-off-by: Brad Hawthorne <brad@sim.vu>

Looks good to me,

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

      reply	other threads:[~2026-11-25  7:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  2:56 Brad Hawthorne
2026-11-25  7:51 ` Arnd Bergmann [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=92686f21-9c49-4cdd-ba39-25c163fa3183@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=brad@sim.vu \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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

all inboxes | Powered by JetHome®