Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757771AbbBFRD2 (ORCPT ); Fri, 6 Feb 2015 12:03:28 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:60159 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753545AbbBFRD0 (ORCPT ); Fri, 6 Feb 2015 12:03:26 -0500 X-AuditID: cbfec7f5-b7fc86d0000066b7-65-54d4f348c6f1 Message-id: <54D4F3D2.3010807@samsung.com> Date: Fri, 06 Feb 2015 20:03:14 +0300 From: Andrey Ryabinin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-version: 1.0 To: Linus Torvalds , Sasha Levin Cc: Raghavendra K T , Thomas Gleixner , Ingo Molnar , Peter Anvin , Peter Zijlstra , Konrad Rzeszutek Wilk , Paolo Bonzini , Paul McKenney , Waiman Long , Dave Jones , Oleg Nesterov , the arch/x86 maintainers , Jeremy Fitzhardinge , Paul Gortmaker , Andi Kleen , Jason Wang , Linux Kernel Mailing List , KVM list , virtualization , xen-devel@lists.xenproject.org, Rik van Riel , Christian Borntraeger , Andrew Morton Subject: Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions References: <1423234148-13886-1-git-send-email-raghavendra.kt@linux.vnet.ibm.com> <54D4DBA1.1030905@oracle.com> In-reply-to: Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02RW0jTYRjG+f6nzdHgr2l+KRUYEphaSYfPSAki+i6KEg1SiFo6prCpbU2y CzFLUUkR1LRhQ5SpTGHpPLSRpynOQ7PaZmmW6GqGwtxynipcOXeRd7/3fZ7nfS5eLhlgpEK4 GZkPhNJMgTiM4VETHuNUFHZbk05OT/GQsSIW1WnaGFTT0kOhzk8FBHreHoyazG4C2ZQ2GjU1 2gGqq76PLPo6BpkH6gnU1V8I0MdeI4kc2k0a9Xd7aGQsGyCQeamRQNtWDYUah2dJpO2oJpGt 3MFBzSYlgxbG49DWq2802uysJC4exIM2A4O1H1oJrO/WEVjbEoE71CUMXpmc5ODR2j8UVo4l 4HmDlsKV080AD7msFP5p/0xhZ98Ug90dh7Gms4vAo0/X6BtsCu9CmlCckSOUnoi/y0t/YaOy l/0eqkxUPnBySoEfF7KnYX5dIe3jA/D9nIYpBTxuAKsCUGc0A9/whIAve9Z3XXw2AtpnVwkv U2w41DUNMF5m2GjoUfTschB7C7rU64zP7w+3KucoLweyKXD811fCe5RkdRy43bVKeoX9bBJ0 VI9yfG16ADd6u3bTfmwiLFY37AjcncQxWFUl8a5J9gjUtjnICsAq9nQo/rsUe1z1gFSDIKE8 NVt2TySJiZYJJDJ5pig6NUvSAXzPX38NVCPnDYDlgrB9/PYla1IALciR5UoMAHLJsED+M9XO ip8myH0klGbdkcrFQpkBEFy/kHzQvnxVVJG7kWA3Fdwuic1uCL1pmQy2jByNywyPfFdjdpUp aH/+iGso+Xt50Izz0Fpov0ZcVOIUEYYvebVZj5WIDGk6m7WgH7tyfLFv5VLuornIE3V5cCLS ZGlJhr89gc3D8Wda5/PWhD/qr9kVM2/n3ZqYxHN/37iuF69v0fIwSpYuOBVBSmWCfxB0oFba AgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1474 Lines: 34 On 02/06/2015 07:15 PM, Linus Torvalds wrote: > On Fri, Feb 6, 2015 at 7:20 AM, Sasha Levin wrote: >> >> Can we modify it slightly to avoid potentially accessing invalid memory: > > So I think there's a race with that. > > And I'll warn you: the kernel does do speculative reads of memory that > might be invalid, not just in places like this. See the comment in > get_user_huge_page() for example, where we knowingly do speculative > reads, but hide it if DEBUG_PAGEALLOC is set. > > More commonly, CONFIG_DCACHE_WORD_ACCESS is very much about doing > speculative reads. Now, that access is hidden inside an asm, so KASan > won't see it, but there might well be others. > > You probably don't see them very much just because they are so rarely > a problem, and most of the time it's not to other processes stack but > to allocated structures where freeing takes long enough to basically > hide any small race.. > > In other words: I suspect it would be good to instead just teach KASan > about "this is a speculative read" and just suppress the warning for > those instead. > We can suppress warnings by wrapping such speculative reads with kasan_disable_current()/kasan_enable_current() calls. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/