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: <9BE478F9-C700-46C5-80BC-B905FD0AAB17@vmware.com>
Date:   Mon, 27 May 2019 18:59:01 +0000
From:   Nadav Amit <namit@...are.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     Ingo Molnar <mingo@...hat.com>, Andy Lutomirski <luto@...nel.org>,
        Borislav Petkov <bp@...en8.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "H. Peter Anvin" <hpa@...or.com>, "x86@...nel.org" <x86@...nel.org>
Subject: Re: [RFC PATCH 4/6] x86/mm/tlb: Refactor common code into
 flush_tlb_on_cpus()

> On May 27, 2019, at 2:24 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> 
> On Sat, May 25, 2019 at 01:22:01AM -0700, Nadav Amit wrote:
> 
>> There is one functional change, which should not affect correctness:
>> flush_tlb_mm_range compared loaded_mm and the mm to figure out if local
>> flush is needed. Instead, the common code would look at the mm_cpumask()
>> which should give the same result.
> 
>> @@ -786,18 +804,9 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
>> 	info = get_flush_tlb_info(mm, start, end, stride_shift, freed_tables,
>> 				  new_tlb_gen);
>> 
>> -	if (mm == this_cpu_read(cpu_tlbstate.loaded_mm)) {
>> -		lockdep_assert_irqs_enabled();
>> -		local_irq_disable();
>> -		flush_tlb_func_local(info, TLB_LOCAL_MM_SHOOTDOWN);
>> -		local_irq_enable();
>> -	}
>> -
>> -	if (cpumask_any_but(mm_cpumask(mm), cpu) < nr_cpu_ids)
>> -		flush_tlb_others(mm_cpumask(mm), info);
> 
> So if we want to double check that; we'd add:
> 
> 	WARN_ON_ONCE(cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)) ==
> 		     (mm == this_cpu_read(cpu_tlbstate.loaded_mm)));
> 
> right?

Yes, except the condition should be inverted (“!=“ instead of “==“), and I
would prefer to use VM_WARN_ON_ONCE().

Unfortunately, this condition does fire when copy_init_mm() calls dup_mm().
I don’t think there is a correctness issue, and I am tempted just check,
before warning, that (mm != init_mm) .

What do you say?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ