From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f69.google.com (mail-it0-f69.google.com [209.85.214.69]) by kanga.kvack.org (Postfix) with ESMTP id 729D16B0003 for ; Wed, 7 Mar 2018 13:16:07 -0500 (EST) Received: by mail-it0-f69.google.com with SMTP id g195so3141838itg.7 for ; Wed, 07 Mar 2018 10:16:07 -0800 (PST) Received: from resqmta-ch2-02v.sys.comcast.net (resqmta-ch2-02v.sys.comcast.net. [2001:558:fe21:29:69:252:207:34]) by mx.google.com with ESMTPS id z190si12684844ioz.133.2018.03.07.10.16.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 10:16:06 -0800 (PST) Date: Wed, 7 Mar 2018 12:16:02 -0600 (CST) From: Christopher Lameter Subject: Re: [RFC PATCH 07/14] khwasan: add tag related helper functions In-Reply-To: Message-ID: References: <226055ec7c1a01dd8211ca9a8b34c07162be37fa.1520017438.git.andreyknvl@google.com> <20180305143246.o7bass2rhbksneqb@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Konovalov Cc: Mark Rutland , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Jonathan Corbet , Catalin Marinas , Will Deacon , Theodore Ts'o , Jan Kara , Christopher Li , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Masahiro Yamada , Michal Marek , Ard Biesheuvel , Yury Norov , Nick Desaulniers , Marc Zyngier , Bob Picco , Suzuki K Poulose , Kristina Martsenko , Punit Agrawal , Dave Martin , James Morse , Julien Thierry , Michael Weiser , Steve Capper , Ingo Molnar , Thomas Gleixner , Sandipan Das , Paul Lawrence , David Woodhouse , Kees Cook , Geert Uytterhoeven , Josh Poimboeuf , Arnd Bergmann , kasan-dev , linux-doc@vger.kernel.org, LKML , Linux ARM , linux-ext4@vger.kernel.org, linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Kees Cook , Jann Horn , Mark Brand On Tue, 6 Mar 2018, Andrey Konovalov wrote: > >> + u32 state = this_cpu_read(prng_state); > >> + > >> + state = 1664525 * state + 1013904223; > >> + this_cpu_write(prng_state, state); > > > > Have you considered preemption here? Is the assumption that it happens > > sufficiently rarely that cross-contaminating the prng state isn't a > > problem? > > Hi Mark! > > Yes, I have. If a preemption happens between this_cpu_read and > this_cpu_write, the only side effect is that we'll give a few > allocated in different contexts objects the same tag. Sine KHWASAN is > meant to be used a probabilistic bug-detection debug feature, this > doesn't seem to have serious negative impact. > > I'll add a comment about this though. You could use this_cpu_cmpxchg here to make it a bit better but it probably does not matter. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org