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]
Date:   Sat, 28 May 2022 09:30:32 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     LKML <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Jiri Olsa <jolsa@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Peter Zijlstra <peterz@...radead.org>, x86@...nel.org
Subject: Re: [PATCH v6] ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding
 weak function

On Fri, 27 May 2022 23:40:03 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> @@ -6830,6 +6960,10 @@ void ftrace_module_enable(struct module *mod)
>  		if (ftrace_start_up)
>  			cnt += referenced_filters(rec);
>  
> +		/* Weak functions should still be ignored */
> +		if (!test_for_valid_rec(rec))
> +			continue;

This also needs to clear the other flags.

As this is for module load, it does a two stage setup. That is to make the
correct state of the ftrace locations in the module. As the updates to NOP
is done before the text is set to RO, and if tracing is enabled/disabled
during this time, it will trigger a BUG as it detects executable code
running in RW text. To solve that, the initial setting of the records of
the module is done with the DISABLE flag set, so they are ignored by the
enabling and disabling of ftrace. All the module ftrace locations are set to
NOP.

This function is called after the text is set to ro and we enable the
module functions based on the flags set. But if we are ignoring the record
(as kvm has weak functions), we need to not only skip the setting of the
code, but need to clear the flags to state they are not set. Otherwise it
screws up the accounting of ftrace, and ftrace will WARN and disable itself.

-- Steve




> +
>  		rec->flags &= ~FTRACE_FL_DISABLED;
>  		rec->flags += cnt;
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ