Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751978AbbEZPIj (ORCPT ); Tue, 26 May 2015 11:08:39 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:38897 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751255AbbEZPIc (ORCPT ); Tue, 26 May 2015 11:08:32 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-fb-5564344cfce6 Message-id: <5564344A.9060005@samsung.com> Date: Tue, 26 May 2015 11:52:26 +0300 From: Andrey Ryabinin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-version: 1.0 To: Alexander Popov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andrey Konovalov , Denys Vlasenko , Andy Lutomirski , Alexander Kuleshov , Sergey Kovalev , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] x86_64: fix KASan shadow region page tables References: <1432310581-11965-1-git-send-email-alpopov@ptsecurity.com> <5562D989.3030206@samsung.com> <556326EA.10807@ptsecurity.com> In-reply-to: <556326EA.10807@ptsecurity.com> Content-type: text/plain; charset=windows-1251 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeLIzCtJLcpLzFFi42I5/e/4FV0fk5RQg71HmS1+753JajF9Rx+7 xfnvh9gtpm0Ut1i/8zO7xeVdc9gsVq9tYLW4dGABk8XHu/3MFps3TWW2+LHhMasDt8f9N39Z PHbOusvusWlVJ5vHu3Pn2D22P5rK4vF+31U2j8+b5DxOtHxhDeCI4rJJSc3JLEst0rdL4MqY uek0c8FFroq9LVOYGhhvcnQxcnJICJhIXFx/kgXCFpO4cG89WxcjF4eQwFJGifUfmtghnO+M Eo86pzCBVPEKaElsetMO1sEioCrxof0xI4jNJqAn8W/WdjYQW1QgQuLt5ZNQ9YISPybfA6sX EdCR6N3xGWwDs8BbJokl//cygySEBVwkzp5ZxASxrZ1RYtuT/2CTOIE6Wt9PYwWxmYE2fLp3 kx3ClpfYvOYt8wRGgVlIlsxCUjYLSdkCRuZVjKKppckFxUnpuYZ6xYm5xaV56XrJ+bmbGCHx 8mUH4+JjVocYBTgYlXh4LQ4nhwqxJpYVV+YeYpTgYFYS4bVTSwkV4k1JrKxKLcqPLyrNSS0+ xCjNwaIkzjt31/sQIYH0xJLU7NTUgtQimCwTB6dUA2OJ992Wvyw/Mn032qZ0+Sa+bJdsy2Ze LOP8TVdtz2pD19f1Aj5Jcf7LqtOUXef+C/JcOF2or1hRvrppXtnNK0v4nvkmLH34zpj/yXOf ab17437nxR6Y6ViffEnWuy6qa+evN1/PTNZfKfBU/4BRxJP31Qa/o80f5288FJZtcu8bU7LH iYgj9kosxRmJhlrMRcWJALjJCLyTAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1567 Lines: 44 On 05/25/2015 04:43 PM, Alexander Popov wrote: > On 25.05.2015 11:12, Andrey Ryabinin wrote: >> On 05/22/2015 07:03 PM, Alexander Popov wrote: >>> Physical addresses in KASan shadow region page tables need fixup: >>> kernel halts without it if phys_base is not zero. >>> >> >> Indeed. >> Since we have to patch page tables anyway, compile-time created kasan >> page tables become pointless. >> So, I'd suggest to create them in runtime. This could be done in plain C >> in kasan_map_early_shadow(). >> > > Thanks for your reply, Andrey. > > Creating kasan_zero_pud, kasan_zero_pmd and kasan_zero_pte in > kasan_map_early_shadow() doesn't look handy for me because this function > is called twice in x86_64_start_kernel(). > > What do you think about leaving the initialization of KASan shadow region > page tables in arch/x86/kernel/head_64.S and calling something like > kasan_fixup_early_shadow() before calling kasan_map_early_shadow() > for the first time? > Why do we have initialize + fixup later if we could simply initialize page tables properly? Just move everything into kasan_init_64.c kasan_zero_p* could be a normal C arrays (with __page_aligned_bss attribute). Initialize these page tables in something like kasan_early_init() before kasan_map_early_shadow() call. > Best regards, > Alexander > > -- 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/