Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp210057pxm; Wed, 2 Mar 2022 13:37:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcTNYMZ8yGvUuPIc/7npMD1Q9bzRq/Rif01vdYzNMrZfrUo7Hk6+PzNyt9hNCje0Hi+G55 X-Received: by 2002:a17:902:aa05:b0:14f:18b7:f0b4 with SMTP id be5-20020a170902aa0500b0014f18b7f0b4mr32967186plb.171.1646257061709; Wed, 02 Mar 2022 13:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646257061; cv=none; d=google.com; s=arc-20160816; b=MDkZttqzEc1f2r3QR3eDO5TSeYMAvXGpEQrlu/IL9koUk7nDi3krXMYxaeUrVet7iA D4pBgDpNx6Ka/TWXVd5IaIpks23scXHsixM6MZglkAJeslxYbZSRRXbcGOcJgByui6C6 iT13CmYMIwjfr6wHJfpX8J7X1EsmdwlYeKmd6KMg50CaxiWLo0YqBlgczUzAZzrghVjL jRlNO8AZJhfUMfyfdwMbhT2z+vvA+7dUYXwN/MnQ2YnXmkNLTrWbEgQBiocrvaqvtFzq ky4+eSqUcNTi4CvmY07lZ/SSSD+S8zn0N8BUMDTZQ2su4T03FB+xGj3yyFfyTJG0DMCM 2fbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yvhkHe8ffV7l7JQy8kWEX/L6d0v7GNlMNTEjcsXtnAI=; b=cWmEoPd4cPsKGRDQIAjxqvdrXlM75Hy6txq5VqmmcPGUZmtC57QxMhFT6nzlmlCvJD 6Ezttn58HgolEbkkYk579sixL0AoFFtiS7WbnZiuKFoYCktqpm11Cpe/NbDIG6SB5bta EVKZjfWfxsAiM2BQ8Bf4dSNIDnhnK/gDX7h7m3TMze2db90CsGcsUG8FtKqXrDvU3m92 lPHe3CTSrSGvO5qL1IjBmKrYH1/e91dczT0bOIe/Ma7oJW1TIxQdswDo7QSZv799Arod yqztbb2w6HXElewFCWIku8wkphDcBRFpZWTZ7iwqr1aCdb9EwZvfsXpU7RfKu//Tx2zt qRPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="pf//kUiq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a170903248100b0014d5024ea16si156715plw.488.2022.03.02.13.37.25; Wed, 02 Mar 2022 13:37:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="pf//kUiq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243407AbiCBPOZ (ORCPT + 99 others); Wed, 2 Mar 2022 10:14:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243393AbiCBPOY (ORCPT ); Wed, 2 Mar 2022 10:14:24 -0500 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD1D479C63 for ; Wed, 2 Mar 2022 07:13:40 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1646234017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=yvhkHe8ffV7l7JQy8kWEX/L6d0v7GNlMNTEjcsXtnAI=; b=pf//kUiq5UreQmNoe4O7ZsvF78erL2mztEQ2l5rSDlszRje9RmOReAttOq4tgQdKAT0DLl VJwX4JW6HEzyj28mIrTJsP4nryvL+dEeHxdk7CC3Rcy2Azt/Q/zoIAlvtBPdHAEyo+QJA+ YvKCnSEN8ESN95bQJppuNyQ4S6XcJZY= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Will Deacon , Sami Tolvanen , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 1/2] fix for "kasan, vmalloc: only tag normal vmalloc allocations" Date: Wed, 2 Mar 2022 16:13:30 +0100 Message-Id: <9230ca3d3e40ffca041c133a524191fd71969a8d.1646233925.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov Pass KASAN_VMALLOC_PROT_NORMAL to kasan_unpoison_vmalloc() in the custom KASAN instrumentation for Shadow Call Stack, as Shadow Call Stack mappings are not executable and thus can be poisoned. Signed-off-by: Andrey Konovalov --- kernel/scs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/scs.c b/kernel/scs.c index b83bc9251f99..1033a76a3284 100644 --- a/kernel/scs.c +++ b/kernel/scs.c @@ -32,7 +32,8 @@ static void *__scs_alloc(int node) for (i = 0; i < NR_CACHED_SCS; i++) { s = this_cpu_xchg(scs_cache[i], NULL); if (s) { - kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_NONE); + kasan_unpoison_vmalloc(s, SCS_SIZE, + KASAN_VMALLOC_PROT_NORMAL); memset(s, 0, SCS_SIZE); return s; } @@ -78,7 +79,7 @@ void scs_free(void *s) if (this_cpu_cmpxchg(scs_cache[i], 0, s) == NULL) return; - kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_NONE); + kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_PROT_NORMAL); vfree_atomic(s); } -- 2.25.1