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]
Date:   Thu, 31 Oct 2019 12:42:23 +0100
From:   Torsten Duwe <duwe@...e.de>
To:     Mark Rutland <mark.rutland@....com>
Cc:     linux-arm-kernel@...ts.infradead.org, Jessica Yu <jeyu@...nel.org>,
        Helge Deller <deller@....de>,
        "James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
        linux-kernel@...r.kernel.org, amit.kachhap@....com,
        catalin.marinas@....com, james.morse@....com, jpoimboe@...hat.com,
        jthierry@...hat.com, linux-parisc@...r.kernel.org,
        mingo@...hat.com, peterz@...radead.org, rostedt@...dmis.org,
        svens@...ckframe.org, takahiro.akashi@...aro.org, will@...nel.org
Subject: Re: [PATCHv2 2/8] module/ftrace: handle patchable-function-entry

On Thu, Oct 31, 2019 at 09:02:32AM +0000, Mark Rutland wrote:
> On Wed, Oct 30, 2019 at 04:03:02PM +0100, Torsten Duwe wrote:
> > On Tue, Oct 29, 2019 at 04:58:26PM +0000, Mark Rutland wrote:
> > > 
> > > I built parisc generic-{32,64}bit_defconfig with DYNAMIC_FTRACE enabled,
> > > and verified that the section made it into the .ko files for modules.
> > 
> > This is because of remaining #ifdeffery in include/asm-generic/vmlinux.lds.h:
> > 
> > #ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
> > #define MCOUNT_REC()    . = ALIGN(8);                           \
> >                         __start_mcount_loc = .;                 \
> >                         KEEP(*(__patchable_function_entries))   \
> >                         __stop_mcount_loc = .;
> > #else
> > #define MCOUNT_REC()    . = ALIGN(8);                           \
> >                         __start_mcount_loc = .;                 \
> >                         KEEP(*(__mcount_loc))                   \
> >                         __stop_mcount_loc = .;
> > #endif
> 
> For modules we use a combination of scripts/module-common.lds and an
> architecture's own module.lds, not vmlinux.lds.h. So I don't think the above is
> relevant for modules.

Sure, this is only loosely related,...

> I agree that the CC_USING_PATCHABLE_FUNCTION_ENTRY ifdeffery could be
> simplified, and that it would be nice to consistently use
> FTRACE_CALLSITE_SECTION if we can. However, the generic linker script doesn't
> include anything, and I don't see a good location for that to live.
> 
> What I could do is add an explicit comment:
> 
> /*
>  * The ftrace call sites are logged to a section whose name depends on the
>  * compiler option used. A given kernel image will only use one, AKA
>  * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
>  * dependencies.
>  */
> #define MCOUNT_REC()						\
> 			. = ALIGN(8);				\
> 			__start_mcount_loc = .;			\
> 			KEEP(*(__patchable_function_entries))   \
> 			KEEP(*(__mcount_loc))                   \
> 			__stop_mcount_loc = .;			
> 
> ... which should make the dependency clear. Does that sound good to you?

Beautiful. I just didn't want to miss the opportunity to have this cleaned
up as well, and deemed this patch "closest" because of the definition of 
FTRACE_CALLSITE_SECTION. Put it where you see it fit best.

Thanks,

	Torsten

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ