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: Tue, 4 Jun 2024 18:07:58 +0200
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Dave Hansen <dave.hansen@...el.com>
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, 
	dave.hansen@...ux.intel.com, x86@...nel.org, linux-kernel@...r.kernel.org, 
	syzkaller@...glegroups.com, elver@...gle.com, glider@...gle.com, 
	nogikh@...gle.com, tarasmadan@...gle.com, 
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 1/4] x86/entry: Remove unwanted instrumentation in common_interrupt()

On Tue, 4 Jun 2024 at 18:01, Dave Hansen <dave.hansen@...el.com> wrote:
>
> On 6/4/24 06:45, Dmitry Vyukov wrote:
> > The manifestation is that KCOV produces spurious coverage
> > in kvm_set_cpu_l1tf_flush_l1d() in random places because
> > the call happens when preempt count is not yet updated
> > to say that we are in an interrupt.
> >
> > Mark kvm_set_cpu_l1tf_flush_l1d() as __always_inline and move
> > out of instrumentation_begin/end() section.
> > It only calls __this_cpu_write() which is already safe to call
> > in noinstr contexts.
>
> I've internalized the main rules around noinstr to basically be: Only
> call noinstr functions before begin_instrumentation().  Second, try to
> minimize the amount of noinstr code.
>
> This patch seems to be adding another rule which is that all code before
> preempt_count manipulation needs to be noinstr.
>
> _Is_ that a new rule, or was it something I was missing?

Hi Dave,

This is an old rule. KCOV was always intended to not trace interrupts:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5c9a8750a6409c63a0f01d51a9024861022f6593

+void __sanitizer_cov_trace_pc(void)
+{
+         /*
+         * We are interested in code coverage as a function of a
syscall inputs,
+         * so we ignore code executed in interrupts.
+         */
+         if (!t || in_interrupt())
+                 return;

At the time the entry code was in asm and wasn't instrumented by the
compiler, so the in_interrupt() check was enough to avoid all
problems.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ