From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754122AbbK0IMX (ORCPT ); Fri, 27 Nov 2015 03:12:23 -0500 Received: from relay.parallels.com ([195.214.232.42]:48735 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751553AbbK0IMV (ORCPT ); Fri, 27 Nov 2015 03:12:21 -0500 Subject: Re: [PATCH RFT] arm64: kasan: Make KASAN work with 16K pages + 48 bit VA To: Ard Biesheuvel References: <1448543686-31869-1-git-send-email-aryabinin@virtuozzo.com> CC: Catalin Marinas , Will Deacon , "linux-arm-kernel@lists.infradead.org" , Yury , Alexey Klimov , Arnd Bergmann , "linux-mm@kvack.org" , Linus Walleij , "linux-kernel@vger.kernel.org" , David Keitel , Alexander Potapenko , Dmitry Vyukov , "Suzuki K. Poulose" , Mark Rutland From: Andrey Ryabinin Message-ID: <5658106C.10207@virtuozzo.com> Date: Fri, 27 Nov 2015 11:12:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: US-EXCH2.sw.swsoft.com (10.255.249.46) To MSK-EXCH1.sw.swsoft.com (10.67.48.55) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26/2015 07:40 PM, Ard Biesheuvel wrote: > On 26 November 2015 at 14:14, Andrey Ryabinin wrote: >> Currently kasan assumes that shadow memory covers one or more entire PGDs. >> That's not true for 16K pages + 48bit VA space, where PGDIR_SIZE is bigger >> than the whole shadow memory. >> >> This patch tries to fix that case. >> clear_page_tables() is a new replacement of clear_pgs(). Instead of always >> clearing pgds it clears top level page table entries that entirely belongs >> to shadow memory. >> In addition to 'tmp_pg_dir' we now have 'tmp_pud' which is used to store >> puds that now might be cleared by clear_page_tables. >> >> Reported-by: Suzuki K. Poulose >> Signed-off-by: Andrey Ryabinin > > I would argue that the Kasan code is complicated enough, and we should > avoid complicating it even further for a configuration that is highly > theoretical in nature. > > In a 16k configuration, the 4th level only adds a single bit of VA > space (which is, as I understand it, exactly the issue you need to > address here since the top level page table has only 2 entries and > hence does not divide by 8 cleanly), which means you are better off > using 3 levels unless you *really* need more than 128 TB of VA space. > > So can't we just live with the limitation, and keep the current code? No objections from my side. Let's keep the current code.