[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200121072744.GA7808@zn.tnic>
Date: Tue, 21 Jan 2020 08:27:44 +0100
From: Borislav Petkov <bp@...en8.de>
To: Qian Cai <cai@....pw>
Cc: tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
luto@...nel.org, peterz@...radead.org, elver@...gle.com,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] x86/mm/pat: fix a data race in cpa_inc_4k_install
On Mon, Jan 20, 2020 at 11:12:00PM -0500, Qian Cai wrote:
> diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
> index 20823392f4f2..31e4a73ae70e 100644
> --- a/arch/x86/mm/pat/set_memory.c
> +++ b/arch/x86/mm/pat/set_memory.c
> @@ -128,7 +128,7 @@ static inline void cpa_inc_2m_checked(void)
>
> static inline void cpa_inc_4k_install(void)
> {
> - cpa_4k_install++;
> + WRITE_ONCE(cpa_4k_install, READ_ONCE(cpa_4k_install) + 1);
> }
>
> static inline void cpa_inc_lp_sameprot(int level)
> --
Fix a data race, says your subject?
If it had to be honest, it probably should say "Make the code ugly
because the next tool can't handle it".
Frankly, I'm not a fan of all this "change the kernel to fix the tool"
attitude.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists