Re: [PATCH 0/9] Kconfig symbol clean-up on ./arch/x86/

Lukas Bulwahn
2021-08-03T15:13:04Z

On Tue, Aug 3, 2021 at 4:32 PM Dave Hansen <dave.hansen@intel.com> wrote:
>
> On 8/3/21 4:35 AM, Lukas Bulwahn wrote:
> > - a reference to STRICT_IOMEM in arch/x86/mm/init.c
> > unclear to me: which exact config this refers to
>
> Are you referring to the reference in this comment?
>
> > + /*
> > + * This must follow RAM test, since System RAM is considered a
> > + * restricted resource under CONFIG_STRICT_IOMEM.
> > + */
> > + if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) {
> > + /* Low 1MB bypasses iomem restrictions. */
> > + if (pagenr < 256)
> > + return 1;
> ...
>

Yes, that is what I referred to.

> That came from here:
>
> > commit a4866aa812518ed1a37d8ea0c881dc946409de94
> > Author: Kees Cook <keescook@chromium.org>
> > Date: Wed Apr 5 09:39:08 2017 -0700
> >
> > mm: Tighten x86 /dev/mem with zeroing reads
>
> Which also added this hunk:
>
> > #ifdef CONFIG_STRICT_DEVMEM
> > +static inline int page_is_allowed(unsigned long pfn)
> > +{
> > + return devmem_is_allowed(pfn);
> > +}
>
> and talks about CONFIG_STRICT_DEVMEM in the changelog:
>
> > mm: Tighten x86 /dev/mem with zeroing reads
> >
> > Under CONFIG_STRICT_DEVMEM, reading System RAM through /dev/mem is
> > disallowed. However, on x86, the first 1MB was always allowed for BIOS
> ...
>
> It's a pretty safe guess that STRICT_IOMEM refers to CONFIG_STRICT_DEVMEM.

Thanks, Dave.

If the maintainers consider updates to comments making them consistent
with the code as worth being picked, I will turn your analysis into a
proper commit message and provide a patch to update that comment.

Lukas