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  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]
Date:   Thu, 25 Mar 2021 16:17:59 -0700
From:   Sami Tolvanen <samitolvanen@...gle.com>
To:     Mark Rutland <mark.rutland@....com>
Cc:     Christoph Hellwig <hch@...radead.org>,
        Kees Cook <keescook@...omium.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Will Deacon <will@...nel.org>, Jessica Yu <jeyu@...nel.org>,
        Arnd Bergmann <arnd@...db.de>, Tejun Heo <tj@...nel.org>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        bpf <bpf@...r.kernel.org>, linux-hardening@...r.kernel.org,
        linux-arch <linux-arch@...r.kernel.org>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        linux-kbuild <linux-kbuild@...r.kernel.org>,
        PCI <linux-pci@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 03/17] mm: add generic __va_function and __pa_function macros

On Thu, Mar 25, 2021 at 3:17 AM Mark Rutland <mark.rutland@....com> wrote:
>
> On Wed, Mar 24, 2021 at 08:54:18AM -0700, Sami Tolvanen wrote:
> > On Wed, Mar 24, 2021 at 12:14 AM Christoph Hellwig <hch@...radead.org> wrote:
> > >
> > > On Tue, Mar 23, 2021 at 01:39:32PM -0700, Sami Tolvanen wrote:
> > > > With CONFIG_CFI_CLANG, the compiler replaces function addresses
> > > > in instrumented C code with jump table addresses. This means that
> > > > __pa_symbol(function) returns the physical address of the jump table
> > > > entry instead of the actual function, which may not work as the jump
> > > > table code will immediately jump to a virtual address that may not be
> > > > mapped.
> > > >
> > > > To avoid this address space confusion, this change adds generic
> > > > definitions for __va_function and __pa_function, which architectures
> > > > that support CFI can override. The typical implementation of the
> > > > __va_function macro would use inline assembly to take the function
> > > > address, which avoids compiler instrumentation.
> > >
> > > I think these helper are sensible, but shouldn't they have somewhat
> > > less arcane names and proper documentation?
> >
> > Good point, I'll add comments in the next version. I thought
> > __pa_function would be a fairly straightforward replacement for
> > __pa_symbol, but I'm fine with renaming these. Any suggestions for
> > less arcane names?
>
> I think dropping 'nocfi' into the name would be clear enough. I think
> that given the usual fun with {symbol,module,virt}->phys conversions
> it's not worth having the __pa_* form, and we can leave the phys
> conversion to the caller that knows where the function lives.
>
> How about we just add `function_nocfi()` ?
>
> Callers can then do `__pa_symbol(function_nocfi(foo))` and similar.

Sounds reasonable. I'll drop __pa_function() and rename
__va_function() to function_nocfi() in the next version.

Sami

Powered by blists - more mailing lists