public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] arm64: mm: Fix "rodata=on" when CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
Date: Tue, 21 Nov 2023 15:03:50 +0000	[thread overview]
Message-ID: <20231121150349.GA1623@willie-the-truck> (raw)
In-Reply-To: <CAMj1kXHMv1JOWO0_vXfdmtYoqE6WnCvbmxczRvyAc0PJzXEx5w@mail.gmail.com>

On Fri, Nov 17, 2023 at 10:09:04AM -0500, Ard Biesheuvel wrote:
> On Fri, 17 Nov 2023 at 08:14, Will Deacon <will@kernel.org> wrote:
> >
> > When CONFIG_RODATA_FULL_DEFAULT_ENABLED=y, passing "rodata=on" on the
> > kernel command-line (rather than "rodata=full") should turn off the
> > "full" behaviour, leaving writable linear aliases of read-only kernel
> > memory. Unfortunately, the option has no effect in this situation and
> > the only way to disable the "rodata=full" behaviour is to disable rodata
> > protection entirely by passing "rodata=off".
> >
> > Fix this by parsing the "on" and "off" options in the arch code,
> > additionally enforcing that 'rodata_full' cannot be set without also
> > setting 'rodata_enabled', allowing us to simplify a couple of checks
> > in the process.
> >
> 
> I think this got broken when this code was refactored to use the
> generic parsing, which uses strtobool() and so it will match
> rodata=0/1, yes, no etc, and only 'full' is handled as a special case.

strtobool() is such a hack! I don't think the core code uses it anymore
though: set_debug_rodata() uses good ol' strcmp() since 2e8cff0a0eee
("arm64: fix rodata=full").

> Not sure whether this matters, and I'd much prefer supporting only
> 'on', 'off' and 'full' because we'll need to parse rodata= early too
> (for my big head.S / LPA2 refactor).

I think that matches the current behaviour (minus the bug I'm fixing here)
and even the documentation in kernel-parameters.txt only talks about those
three values.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-11-21 15:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 13:14 [PATCH] arm64: mm: Fix "rodata=on" when CONFIG_RODATA_FULL_DEFAULT_ENABLED=y Will Deacon
2023-11-17 14:24 ` Russell King (Oracle)
2023-11-17 15:09 ` Ard Biesheuvel
2023-11-21 15:03   ` Will Deacon [this message]
2023-11-21 15:24     ` Ard Biesheuvel
2023-11-22 18:52 ` Catalin Marinas
2023-11-22 19:15 ` Catalin Marinas

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=20231121150349.GA1623@willie-the-truck \
    --to=will@kernel.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    /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