lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+KhAHaXHUYs0aXcD9uJQWfwDMFngEE03wapeVwS35OgZO82JA@mail.gmail.com>
Date: Sat, 1 Mar 2025 10:37:40 +0400
From: Keun-O Park <kpark3469@...il.com>
To: Will Deacon <will@...nel.org>
Cc: Ard Biesheuvel <ardb@...nel.org>, linux-arm-kernel@...ts.infradead.org, 
	linux-kernel@...r.kernel.org, catalin.marinas@....com, 
	Keuno Park <keun-o.park@...im.com>
Subject: Re: [PATCH] arm64: kaslr: consider parange is bigger than linear_region_size

On Sat, Mar 1, 2025 at 8:39 AM Will Deacon <will@...nel.org> wrote:
>
> On Fri, Feb 28, 2025 at 02:11:41PM +0100, Ard Biesheuvel wrote:
> > On Fri, 28 Feb 2025 at 06:55, Keun-O Park <kpark3469@...il.com> wrote:
> > >
> > > How about adding a warning message in case of linear region
> > > randomization failure?
> > > And, there might be two options in my mind by now to consider hotplug memory.
> > > Either giving an option for users to override "parange" as kernel
> > > param or providing the legacy way((memblock_end_of_DRAM() -
> > > memblock_start_of_DRAM()) when CONFIG_MEMORY_HOTPLUG is off.
> > > Users believe KASLR will work fine by enabling CONFIG_RANDOMIZE_BASE.
> > > In case of linear region randomization failure, I think at least users
> > > need to know about this failure.
> > > Can you share your thoughts on this please?
> > >
> >
> > Randomization of the linear map has always been a best effort thing,
> > so I don't think this is a big deal.
> >
> > I wouldn't object to the new behavior being conditional on
> > CONFIG_MEMORY_HOTPLUG, and fallback to the old behavior otherwise. But
> > ultimately, it will be up to the maintainers.
>
> Personally, given the confusion that linear map randomization seems to
> cause, I'd rather reduce the number of variables on which it depends.
>
> I also wonder whether it's actually useful at all...
>
> Will

I have thought of reducing parange until it fits into linear_region_size though.
+               if (range < 0) {
+                       pr_warn("parange(%d) does not fit into linear
region size\n", \
+                               id_aa64mmfr0_parange_to_phys_shift(parange));
+                       if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) {
+                               while (range < 0 && parange > 0) {
+                                       range = linear_region_size -
+
BIT(id_aa64mmfr0_parange_to_phys_shift(--parange));
+                               }
+                               pr_warn("smaller parange(%d) is chosen
for linear region randomization\n",
+
id_aa64mmfr0_parange_to_phys_shift(parange));
+                       } else {
+                               pr_warn("falling back to the range
considering on-boot DRAM size\n");
+                               range = linear_region_size -
+                                       (memblock_end_of_DRAM() -
+                                        memblock_start_of_DRAM());
+                       }
+               }

But, in a certain case, hotplug memory may get an address out of the
linear region at some point, as still SoC's parange can cover more
memory(ex. in this case, 1TiB).
So I think leaving a warning message for users might be the best
option. Then users feel it's time to move to a bigger address space to
resolve the issue.

               if (range < 0) {
+                       if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) {
+                               WARN(true, "linear region is not
randomized due to bigger parange\n");
+                       } else {
+                               range = linear_region_size -
+                                       (memblock_end_of_DRAM() -
+                                        memblock_start_of_DRAM());
+                       }
+               }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ