From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752751AbdC2P5B (ORCPT ); Wed, 29 Mar 2017 11:57:01 -0400 Received: from foss.arm.com ([217.140.101.70]:35690 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751723AbdC2P5A (ORCPT ); Wed, 29 Mar 2017 11:57:00 -0400 Date: Wed, 29 Mar 2017 16:56:32 +0100 From: Mark Rutland To: Dmitry Vyukov Cc: Peter Zijlstra , Ingo Molnar , Andrew Morton , Will Deacon , Andrey Ryabinin , kasan-dev , LKML , "x86@kernel.org" , "linux-mm@kvack.org" Subject: Re: [PATCH 7/8] asm-generic: add KASAN instrumentation to atomic operations Message-ID: <20170329155631.GA26135@leverpostej> References: <20170329140000.GK23442@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 29, 2017 at 05:52:43PM +0200, Dmitry Vyukov wrote: > On Wed, Mar 29, 2017 at 4:00 PM, Mark Rutland wrote: > > On Tue, Mar 28, 2017 at 06:15:44PM +0200, Dmitry Vyukov wrote: > >> KASAN uses compiler instrumentation to intercept all memory accesses. > >> But it does not see memory accesses done in assembly code. > >> One notable user of assembly code is atomic operations. Frequently, > >> for example, an atomic reference decrement is the last access to an > >> object and a good candidate for a racy use-after-free. > >> > >> Add manual KASAN checks to atomic operations. > >> > >> Signed-off-by: Dmitry Vyukov > >> Cc: Mark Rutland > >> Cc: Peter Zijlstra > >> Cc: Will Deacon , > >> Cc: Andrew Morton , > >> Cc: Andrey Ryabinin , > >> Cc: Ingo Molnar , > >> Cc: kasan-dev@googlegroups.com > >> Cc: linux-mm@kvack.org > >> Cc: linux-kernel@vger.kernel.org > >> Cc: x86@kernel.org > > > > FWIW, I think that structuring the file this way will make it easier to > > add the {acquire,release,relaxed} variants (as arm64 will need), > > so this looks good to me. > > > > As a heads-up, I wanted to have a go at that, but I wasn't able to apply > > patch two onwards on v4.11-rc{3,4} or next-20170329. I was not able to > > cleanly revert the instrumentation patches currently in next-20170329, > > since other patches built atop of them. > > I based it on git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > locking/core Ah; I should have guessed. ;) Thanks for the pointer! I'll give that a go shortly. Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f70.google.com (mail-pg0-f70.google.com [74.125.83.70]) by kanga.kvack.org (Postfix) with ESMTP id C73926B0390 for ; Wed, 29 Mar 2017 11:57:01 -0400 (EDT) Received: by mail-pg0-f70.google.com with SMTP id v21so12359645pgo.22 for ; Wed, 29 Mar 2017 08:57:01 -0700 (PDT) Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id n1si7800631pld.289.2017.03.29.08.57.00 for ; Wed, 29 Mar 2017 08:57:01 -0700 (PDT) Date: Wed, 29 Mar 2017 16:56:32 +0100 From: Mark Rutland Subject: Re: [PATCH 7/8] asm-generic: add KASAN instrumentation to atomic operations Message-ID: <20170329155631.GA26135@leverpostej> References: <20170329140000.GK23442@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Dmitry Vyukov Cc: Peter Zijlstra , Ingo Molnar , Andrew Morton , Will Deacon , Andrey Ryabinin , kasan-dev , LKML , "x86@kernel.org" , "linux-mm@kvack.org" On Wed, Mar 29, 2017 at 05:52:43PM +0200, Dmitry Vyukov wrote: > On Wed, Mar 29, 2017 at 4:00 PM, Mark Rutland wrote: > > On Tue, Mar 28, 2017 at 06:15:44PM +0200, Dmitry Vyukov wrote: > >> KASAN uses compiler instrumentation to intercept all memory accesses. > >> But it does not see memory accesses done in assembly code. > >> One notable user of assembly code is atomic operations. Frequently, > >> for example, an atomic reference decrement is the last access to an > >> object and a good candidate for a racy use-after-free. > >> > >> Add manual KASAN checks to atomic operations. > >> > >> Signed-off-by: Dmitry Vyukov > >> Cc: Mark Rutland > >> Cc: Peter Zijlstra > >> Cc: Will Deacon , > >> Cc: Andrew Morton , > >> Cc: Andrey Ryabinin , > >> Cc: Ingo Molnar , > >> Cc: kasan-dev@googlegroups.com > >> Cc: linux-mm@kvack.org > >> Cc: linux-kernel@vger.kernel.org > >> Cc: x86@kernel.org > > > > FWIW, I think that structuring the file this way will make it easier to > > add the {acquire,release,relaxed} variants (as arm64 will need), > > so this looks good to me. > > > > As a heads-up, I wanted to have a go at that, but I wasn't able to apply > > patch two onwards on v4.11-rc{3,4} or next-20170329. I was not able to > > cleanly revert the instrumentation patches currently in next-20170329, > > since other patches built atop of them. > > I based it on git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > locking/core Ah; I should have guessed. ;) Thanks for the pointer! I'll give that a go shortly. Thanks, Mark. -- 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