Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp612867pxb; Thu, 12 Nov 2020 11:42:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPwcg2+zV3oQAjcYv19yY2fONLjBdsdYdxJpK8wYcqoYfDu4Ke5bt46Pz1nAmjHzvMYdve X-Received: by 2002:a17:906:8812:: with SMTP id zh18mr839540ejb.361.1605210154997; Thu, 12 Nov 2020 11:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605210154; cv=none; d=google.com; s=arc-20160816; b=eG3euH2E6P6WC1OV8Ago9fqT94+Lo1bEiktUpWPoaoWZYnWq4JrvUDffhIWpdRBcxH RQcsj0ugGOymNpY6qpUek74sZn941BbrIMBMjQb0cgErjYrGkd7DXSjoei1im3YmaINz WVZaeyo0hygKDG/nA2rgY0gOKYqobKt6hOgfon2LK0df/YSJOWSowHTvLCXqGuYbfijW BsSFgm8fIPeQVFKcjEmvH7qJ+4+rvgeBXSidOZzqZSnENPTCRxe13LIYPLrn6TeD4vm1 q/CNee8ng6xrXfNEnBnWclbJdymYqh3/ZI5iIthj+bvlJcOlZbRUx3k3nRhOZYA5xf/D uf+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wcGaGdNjvzbWsM/1VlFfBlGElmPXvO3Myj4l26gebaE=; b=KIu2b2iWE/D7MkrWNtNoHg17CPYjMZPwX8tA+AAbm0AcohK0IKh0g8pRIcaceGr1JO w8YN0ipIBAJxKUCgK5kJkTKBbpeuziIte3+OoEAfP5veIaRMaE6Jgyqa/tHIzvfWNgAG zMujYcygDgeLhDUhWI/pGvsNyyTmwrM8SUp2bHZyZHrq67CSauAhNvr3PaF8OaViYtAA U0qcbIfzvACH67vWWaq5aL3LEc63Y1dP/hj5WfH2OkoamdHZwq5JdKqQPMX57+9KV9gJ HF+TkSsBhLJ9e77KByMhryGOqLBdQNIDP8O1XLqgYdbEdHIp+Nb/13uU30Kxbn36MiDm IHBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UaHMcC73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 61si4895066edc.400.2020.11.12.11.42.11; Thu, 12 Nov 2020 11:42:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UaHMcC73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbgKLTil (ORCPT + 99 others); Thu, 12 Nov 2020 14:38:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbgKLTil (ORCPT ); Thu, 12 Nov 2020 14:38:41 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9788C0613D1 for ; Thu, 12 Nov 2020 11:38:40 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id g11so3306638pll.13 for ; Thu, 12 Nov 2020 11:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wcGaGdNjvzbWsM/1VlFfBlGElmPXvO3Myj4l26gebaE=; b=UaHMcC73bqlweF20yyhuSOecd8L/pYt6mDoNZhyPNwm7NL0fx2MmHkrQAALHa3Gfk3 3gEYco8Pg+cDJvbeDn/zphQtsjJvI0LFuUldxAOFqhsnzzFt5seRcliywEi4x30idZku HPwPRasVkNMOv92fTjGeR748hRxavgKX8gEniwRKqMGSi6i4WS+TvaGWrrxqQ14Wqayw oa6Uq42hSGMhSDMpECwlt2Ip272K9oIfQ+5OOEBscde11Lb39l+YDOD27zKc+IJY0OG6 H5cTJ72+vuKTarQh/l2uVlrD0oPx9Wwox7PJwUpJ9asm1wqnayztd9ghHK6vmnPzDrMb ZOTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wcGaGdNjvzbWsM/1VlFfBlGElmPXvO3Myj4l26gebaE=; b=apnnPfx5x2ko+be4DfQH8iVtfxkYWRGacSwEVCyRxhSvpEaiIlmznU6NXcydSVQG5G CQTa4W2E4i7aD0VPYLDpB/YGe9yVmFyhTjfvOzWzwc7DdO/w1842vNU/CtOVc1SMQeXe 6UR18BmEXsuyFpyJ8ekP5fX0Td1q0RRe5kb+clWO7tYET7+s3kPkWHVjdm03G0WtQC9M Yel2g5HWHvUIOWWdMYMgrAVj/NGmN2WeStEu3uhqY8XaD3mULGyiHpOi9S2DnxESe1zJ 7uSjKyBA3Lf6KbdCUejHKkKv3EapcD1/xs5aJ+jwK0Mt9DAkUdotEOJKzvuBwjtbJrZd ok3Q== X-Gm-Message-State: AOAM532VD+b7Nzr9pXlkuE4PJqo6fZii9oQgH2sZWQhJyFlHOJr6xf+J cy51W0nOwse68LDLr5ssMqyJdZxVxFy0piNpjE991Q== X-Received: by 2002:a17:902:bb95:b029:d7:db34:2ddb with SMTP id m21-20020a170902bb95b02900d7db342ddbmr742376pls.85.1605209920187; Thu, 12 Nov 2020 11:38:40 -0800 (PST) MIME-Version: 1.0 References: <7e95d4739f5617b2c1acf52f37e01f1ca83750b5.1605046662.git.andreyknvl@google.com> <20201112095134.GI29613@gaia> In-Reply-To: <20201112095134.GI29613@gaia> From: Andrey Konovalov Date: Thu, 12 Nov 2020 20:38:29 +0100 Message-ID: Subject: Re: [PATCH v2 04/20] kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK To: Catalin Marinas Cc: Dmitry Vyukov , Alexander Potapenko , Marco Elver , Will Deacon , Vincenzo Frascino , Evgenii Stepanov , Andrey Ryabinin , Branislav Rankov , Kevin Brodsky , Andrew Morton , kasan-dev , Linux ARM , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 12, 2020 at 10:51 AM Catalin Marinas wrote: > > On Tue, Nov 10, 2020 at 11:20:08PM +0100, Andrey Konovalov wrote: > > There's a config option CONFIG_KASAN_STACK that has to be enabled for > > KASAN to use stack instrumentation and perform validity checks for > > stack variables. > > > > There's no need to unpoison stack when CONFIG_KASAN_STACK is not enabled. > > Only call kasan_unpoison_task_stack[_below]() when CONFIG_KASAN_STACK is > > enabled. > > > > Note, that CONFIG_KASAN_STACK is an option that is currently always > > defined when CONFIG_KASAN is enabled, and therefore has to be tested > > with #if instead of #ifdef. > > > > Signed-off-by: Andrey Konovalov > > Link: https://linux-review.googlesource.com/id/If8a891e9fe01ea543e00b576852685afec0887e3 > > --- > > arch/arm64/kernel/sleep.S | 2 +- > > arch/x86/kernel/acpi/wakeup_64.S | 2 +- > > include/linux/kasan.h | 10 ++++++---- > > mm/kasan/common.c | 2 ++ > > 4 files changed, 10 insertions(+), 6 deletions(-) > > > > diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S > > index ba40d57757d6..bdadfa56b40e 100644 > > --- a/arch/arm64/kernel/sleep.S > > +++ b/arch/arm64/kernel/sleep.S > > @@ -133,7 +133,7 @@ SYM_FUNC_START(_cpu_resume) > > */ > > bl cpu_do_resume > > > > -#ifdef CONFIG_KASAN > > +#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK > > mov x0, sp > > bl kasan_unpoison_task_stack_below > > #endif > > I don't understand why CONFIG_KASAN_STACK is not a bool (do you plan to > add more values to it?) but for arm64: I don't remember if there's an actual reason. Perhaps this is something that can be reworked later, but I don't want to get into this in this series. > Acked-by: Catalin Marinas Thanks!