Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3758362imj; Tue, 12 Feb 2019 04:14:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IZghIr85buG04XAzkBouHgE9HcUZvzh2lqF3TPnU3k0yFm7+CHepsAHZRMg3JUkw4iaJFce X-Received: by 2002:a17:902:1aa:: with SMTP id b39mr3793919plb.244.1549973698682; Tue, 12 Feb 2019 04:14:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549973698; cv=none; d=google.com; s=arc-20160816; b=FH6etFgJYwsI+pqW2ZcyJ3YAAIxG3+Vvg4OfVzxfhR/brdNE0DyuNtQyyto0iqjBGU ez/rtywr+nU4Wux+uTh9isJkmJGRqLymPy/lWf68vt4vD+TSZHaXzUEGqPeeRR/RAuJO yN8eR8i18OgRD5QuZro48Wl8IfI4gF1cXvFv4O3MaOKrllPOrseF4r4tiVBgYA6v0IFc 5rz6olE1D8K2lz+9tCiLQdFgLOOa+XVFySj676+pw1jPUsWiCohqheo1qGolaE2+kOn+ W53MMo2hf8CZKUSE2ADkkstbNSuawwc4MCHJk6cn+y8J9o+DNHwVgynY5rH78bgXlucj Uzaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=l/u2+gdRm2cvDk2NbZLG0vHLqMXF0HF+jEi5Dv4VYIY=; b=T2k2KGOeovvk77867pJ0e698QSxM/RbxIy1BW2hcm1zjV9m608olt5XapRniQq67js ywYqfpumjpH3B+Jjb175s/zQySuSGa5hQUWIlEIAy+1TFOxPBndpKzZngKC6b+kxUvKa MtTAU3W0YhMEHwXnh3x5CpNlOrWpw1F049n+5hwnXJg/2Xr8arBvoZgxrzyrL8wYmbE3 HSO2K8wYFOM9DMslny+zFP2Dqgy5/fAnPQgmxbixLZXbR5KdNmfg2wMJIdRTsDNeZ3kr lE2thWcHvELS/tN/AcL2WqCp3rDNq4TWtU954Dh5HjnSe8ufRHaju9Aa+F3N58wHV/zN F5SQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20si9318064pgm.366.2019.02.12.04.14.41; Tue, 12 Feb 2019 04:14:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728623AbfBLMOX (ORCPT + 99 others); Tue, 12 Feb 2019 07:14:23 -0500 Received: from relay.sw.ru ([185.231.240.75]:36560 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726565AbfBLMOX (ORCPT ); Tue, 12 Feb 2019 07:14:23 -0500 Received: from [172.16.25.12] by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gtWx9-000831-M1; Tue, 12 Feb 2019 15:14:19 +0300 Subject: Re: [PATCH v4 3/3] powerpc/32: Add KASAN support To: Christophe Leroy , Daniel Axtens , Andrey Konovalov Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , "Aneesh Kumar K.V" , Alexander Potapenko , Dmitry Vyukov , Linux Memory Management List , PowerPC , LKML , kasan-dev References: <1f5629e03181d0e30efc603f00dad78912991a45.1548166824.git.christophe.leroy@c-s.fr> <87ef8i45km.fsf@dja-thinkpad.axtens.net> <69720148-fd19-0810-5a1d-96c45e2ec00c@c-s.fr> <805fbf9d-a10f-03e0-aa52-6f6bd16059b9@virtuozzo.com> <87imxpak4r.fsf@linkitivity.dja.id.au> From: Andrey Ryabinin Message-ID: Date: Tue, 12 Feb 2019 15:14:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/12/19 2:38 PM, Christophe Leroy wrote: > > > Le 12/02/2019 à 02:08, Daniel Axtens a écrit : >> Andrey Ryabinin writes: >> >>> >>> Christophe, you can specify KASAN_SHADOW_OFFSET either in Kconfig (e.g. x86_64) or >>> in Makefile (e.g. arm64). And make early mapping writable, because compiler generated code will write >>> to shadow memory in function prologue/epilogue. >> >> Hmm. Is this limitation just that compilers have not implemented >> out-of-line support for stack instrumentation, or is there a deeper >> reason that stack/global instrumentation relies upon inline >> instrumentation? > > No, it looks like as soon as we define KASAN_SHADOW_OFFSET in Makefile in addition to asm/kasan.h, stack instrumentation works with out-of-line. > I think you confusing two different things. CONFIG_KASAN_INLINE/CONFIG_KASAN_OUTLINE affects only generation of code that checks memory accesses, whether we call __asan_loadx()/__asan_storex() or directly insert code, checking shadow memory. But with stack instrumentation we also need to poison redzones around stack variables and unpoison them when we leave the function. That poisoning/unpoisoning thing is always inlined. Currently there is no option to make it out-of-line. So you can have stack instrumentation with KASAN_OUTLINE, but it just means that checking shadow memory on memory access will be outlined, poisoning/unpoisoing stack redzones will remain inlined.