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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXEqhhMBsYXZOKrj0ycGdFOj++D+MgRR7vsncGQSL7ad6g@mail.gmail.com>
Date:   Fri, 24 Jun 2022 15:09:03 +0200
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Will Deacon <will@...nel.org>
Cc:     Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-hardening@...r.kernel.org, Marc Zyngier <maz@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Kees Cook <keescook@...omium.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Mark Brown <broonie@...nel.org>,
        Anshuman Khandual <anshuman.khandual@....com>
Subject: Re: [PATCH v4 19/26] arm64: kaslr: defer initialization to late
 initcall where permitted

On Fri, 24 Jun 2022 at 15:08, Will Deacon <will@...nel.org> wrote:
>
> On Mon, Jun 13, 2022 at 04:45:43PM +0200, Ard Biesheuvel wrote:
> > The early KASLR init code runs extremely early, and anything that could
> > be deferred until later should be. So let's defer the randomization of
> > the module region until much later - this also simplifies the
> > arithmetic, given that we no longer have to reason about the link time
> > vs load time placement of the core kernel explicitly. Also get rid of
> > the global status variable, and infer the status reported by the
> > diagnostic print from other KASLR related context.
> >
> > While at it, get rid of the special case for KASAN without
> > KASAN_VMALLOC, which never occurs in practice.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
> > ---
> >  arch/arm64/kernel/kaslr.c | 95 +++++++++-----------
> >  1 file changed, 40 insertions(+), 55 deletions(-)
>
> [...]
>
> > @@ -163,33 +169,12 @@ u64 __init kaslr_early_init(void)
> >                * when ARM64_MODULE_PLTS is enabled.
> >                */
> >               module_range = MODULES_VSIZE - (u64)(_etext - _stext);
> > -             module_alloc_base = (u64)_etext + offset - MODULES_VSIZE;
> >       }
> >
> >       /* use the lower 21 bits to randomize the base of the module region */
> >       module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21;
> >       module_alloc_base &= PAGE_MASK;
> >
> > -     return offset;
> > -}
> > -
> > -static int __init kaslr_init(void)
> > -{
> > -     switch (kaslr_status) {
> > -     case KASLR_ENABLED:
> > -             pr_info("KASLR enabled\n");
> > -             break;
> > -     case KASLR_DISABLED_CMDLINE:
> > -             pr_info("KASLR disabled on command line\n");
> > -             break;
> > -     case KASLR_DISABLED_NO_SEED:
> > -             pr_warn("KASLR disabled due to lack of seed\n");
> > -             break;
> > -     case KASLR_DISABLED_FDT_REMAP:
> > -             pr_warn("KASLR disabled due to FDT remapping failure\n");
> > -             break;
> > -     }
> > -
> >       return 0;
> >  }
> > -core_initcall(kaslr_init)
> > +late_initcall(kaslr_init)
>
> Are you sure this isn't too late? I'm nervous that we might have called
> request_module() off the back of all the other initcalls that we've run by
> this point.
>

Yeah, I just realized the other day that this is probably too late.
subsys_initcall() might be more suitable here

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ