Received: by 10.223.164.202 with SMTP id h10csp4896785wrb; Wed, 29 Nov 2017 13:52:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMYiskolw/+2V1dWpv9J2wZgoCYFSce5oX5niYnHh138721plu9idmBK2mzgJtJMA7qPIovC X-Received: by 10.159.231.15 with SMTP id w15mr308604plq.410.1511992332339; Wed, 29 Nov 2017 13:52:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511992332; cv=none; d=google.com; s=arc-20160816; b=zheV3tsiNCdfwme8RaFolav0pi5p5OBajsl/beJNMjy+eiDePsfT9ULmZReyLy1rGx G2HaiXElS6f3MwJYgPrCP7jFfM/9Kr28PC1SvEYmvBFiyK+DSLWmHS24JmI8PUaDBCcn iIrKwOgrqurYisIPa+NowXGMvYfsXicEGXSvjDGSsAesMt/WDLSGfbc2E6vjH7I112uW /WbzkGSVDSmwnrZPZwHHIMOIi5lDefjHVRZgez2x7SuxI267QSqic1dqeOiXVTMIXjMO 7h3M13fZ6bHEBD6s+d+jomCmoSUB0paFO+BxP5oafJCIOLPEPCjrww9QxDWIgEAkxXby /vww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=uALEXK1OCB77rNJOdDQNIFuDjLYopdvWvj7hsT+gCtA=; b=0dbuRKwvHyBBL+IC+IoTfrGB/85vIpOANZhRJ4Q+KHnnq2A/lBZRUgt48Jkigr6Wae JWgrHWcmkipykVxEgM6EiuP9pLs8Uk++vD3R7D7e/pGsn2+DKdfqBxVIgbELJSkmwdZZ 3rhROlV/LokO2pn6MJkj/WIGNcnv/sn5yGXQkbyiR5QRpPubglJVVUDKijjmBwmqqxSc EVzdX5PYp91O6gyhyQLT/MaFBNc5SlxdhnEAstZnIvVMI63vBEyAeggnPUg1k2A704c1 vXbagkkJdSWo8LBZG72xdmlVs78VtzmcMB4CnWBE9bFXk3wUiqPJf14MI6RYhXwW3NT7 4vIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SqaDTWzz; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10si1940665pli.600.2017.11.29.13.51.59; Wed, 29 Nov 2017 13:52:12 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=SqaDTWzz; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752524AbdK2VvX (ORCPT + 99 others); Wed, 29 Nov 2017 16:51:23 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:40448 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217AbdK2VvT (ORCPT ); Wed, 29 Nov 2017 16:51:19 -0500 Received: by mail-it0-f67.google.com with SMTP id f190so5987245ita.5 for ; Wed, 29 Nov 2017 13:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uALEXK1OCB77rNJOdDQNIFuDjLYopdvWvj7hsT+gCtA=; b=SqaDTWzzrtKNUxc3h6VMEzDlaOTsM9tVJkUgDz8B7BfR+4V6pQwfS3YY0lIBgmjCmP dcVtNyZUiGyAmtXlCdBC4Xzy1g20wtkyMDcBV6Hl7z4A1yl5V00PBu76tqJ+FKIgkBAD 4ybOTdygUjK2bJ4G4oeIdtMMTFVm7vVpZCECabHY4+eFQeLQeGY3gR5gK99kSui4O1Hm l8SN4gDxX92d0bJXtOoa31YqhgeUW3ccKuVxQtbMEDKIrALMEwmCsT2swVVwcpqvjrsQ Vl6QSLxEc6p/wECSI4t6wBGEgll5tkj316b7gcHAB8rp2oM3pvIES8pTYwL/AAYxt2dJ fdCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uALEXK1OCB77rNJOdDQNIFuDjLYopdvWvj7hsT+gCtA=; b=r8cO5ZvwWYcQgqMbE9S3Qy9y32EF/vzUbDkCUZVVIH1cmoGKT5ol2gDMDOnmpD/n2c TZLvZ5CYoRCFkAMYmrBaq4Hzz2uZRs3U6AxaisUVnsBZQNHt9Lm2pMBQqR6xGlf0RLvq vQ0XbJjv6EJc+GguM1X8tRfNgs/wKA67h8bRxTxUI9RLULIuBrZ6+A9lvWVz3nY7ed7Q hM5lJIhbovbyuhH0LfQCGWzYGPFnLteQz2HeC396kYrES9fwEBZ8DZhW+TP1gVAH0qv8 Q1YVXJ7cjZ+JaNMhH8f1x657aPBJVIZzc8sD9xi2+v9dlSr22pXFPngP/1OaASnaGW3I v2+A== X-Gm-Message-State: AJaThX6q2AToRHdI6YLLinpAxJLbQpxk5t2etM+FO4kOjlcKgnBb8Mar M7nVSsPDkc5M06QSYbomQmp/qw== X-Received: by 10.36.117.87 with SMTP id y84mr349898itc.124.1511992278396; Wed, 29 Nov 2017 13:51:18 -0800 (PST) Received: from paullawrence.mtv.corp.google.com ([172.22.120.84]) by smtp.gmail.com with ESMTPSA id x72sm1438438ite.43.2017.11.29.13.51.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 13:51:17 -0800 (PST) From: Paul Lawrence To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Masahiro Yamada , Michal Marek Cc: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kbuild@vger.kernel.org, Matthias Kaehlcke , Michael Davidson , Greg Hackmann , Paul Lawrence Subject: [PATCH v2 3/5] kasan: added functions for unpoisoning stack variables Date: Wed, 29 Nov 2017 13:50:48 -0800 Message-Id: <20171129215050.158653-4-paullawrence@google.com> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171129215050.158653-1-paullawrence@google.com> References: <20171129215050.158653-1-paullawrence@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Potapenko As a code-size optimization, LLVM builds since r279383 may bulk-manipulate the shadow region when (un)poisoning large memory blocks. This requires new callbacks that simply do an uninstrumented memset(). This fixes linking the Clang-built kernel when using KASAN. Signed-off-by: Alexander Potapenko [ghackmann@google.com: fix memset() parameters, and tweak commit message to describe new callbacks] Signed-off-by: Greg Hackmann Signed-off-by: Paul Lawrence --- mm/kasan/kasan.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index f86f862f41f8..89565a1ec417 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c @@ -768,6 +768,21 @@ void __asan_allocas_unpoison(const void *stack_top, const void *stack_bottom) } EXPORT_SYMBOL(__asan_allocas_unpoison); +/* Emitted by the compiler to [un]poison local variables. */ +#define DEFINE_ASAN_SET_SHADOW(byte) \ + void __asan_set_shadow_##byte(const void *addr, size_t size) \ + { \ + __memset((void *)addr, 0x##byte, size); \ + } \ + EXPORT_SYMBOL(__asan_set_shadow_##byte) + +DEFINE_ASAN_SET_SHADOW(00); +DEFINE_ASAN_SET_SHADOW(f1); +DEFINE_ASAN_SET_SHADOW(f2); +DEFINE_ASAN_SET_SHADOW(f3); +DEFINE_ASAN_SET_SHADOW(f5); +DEFINE_ASAN_SET_SHADOW(f8); + #ifdef CONFIG_MEMORY_HOTPLUG static int __meminit kasan_mem_notifier(struct notifier_block *nb, unsigned long action, void *data) -- 2.15.0.531.g2ccb3012c9-goog From 1585334755741559608@xxx Tue Nov 28 18:17:19 +0000 2017 X-GM-THRID: 1585216063813693983 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread