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: <36673130-7548-4BE5-8E70-ACC100A0BDBF@zytor.com>
Date: Sat, 19 Oct 2024 00:40:04 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>,
        "Mehta, Sohil" <sohil.mehta@...el.com>,
        "Luck, Tony" <tony.luck@...el.com>, "bp@...en8.de" <bp@...en8.de>
CC: "tglx@...utronix.de" <tglx@...utronix.de>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 08/10] x86/mce: Remove the redundant zeroing assignments

On October 19, 2024 12:37:05 AM PDT, "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com> wrote:
>> From: Mehta, Sohil <sohil.mehta@...el.com>
>> [...]
>> > @@ -1284,8 +1282,6 @@ __mc_scan_banks(struct mce *m, struct pt_regs
>> *regs, struct mce *final,
>> >  		if (!mce_banks[i].ctl)
>> >  			continue;
>> >
>> > -		m->misc = 0;
>> > -		m->addr = 0;
>> >  		m->bank = i;
>> >
>> 
>> However, in this case, I am not fully convinced if the misc and addr would
>> already be 0 when we reach here.
>> 
>> There are potentially a lot of things that happen in do_machine_check()
>> between mce_gather_info() and __mc_scan_banks(). Especially,
>> mce_no_way_out() which could theoretically call mce_read_aux() in some
>> cases.
>> 
>> Maybe it doesn't matter, misc and addr would be overwritten anyway. But I
>> feel some more details in the commit message would be useful. It doesn't
>> seem as simple as the brief description makes it sound (at least to me).
>> 
>
>Your concern is reasonable. Thanks!
>
>For both diffs, mce->misc and mce->addr can be guaranteed to be zeroed the first time
>they reach here. However, I didn't notice that both diffs were in a for() loop where 
>mce->misc and mce->addr could retain the old values assigned by mce_read_aux() in 
>the previous iteration. So need to zero mce-misc and mce->addr in each iteration to 
>ensure they don't contain stale values. 
>
> I'll drop this patch in the next version.
>
>-Qiuxu
>

Keep in mind that usually the compiler will remove redundant assignments, and if they are too obscure for the compiler to discover, they are probably too subtle for programmers to not introduce bugs in the future ...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ