Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5654457img; Wed, 27 Mar 2019 12:31:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzE7sRHy6cFFqzevFn5w6c3MhGHdkChV/XXeVNzwtUs9Nw/gLmaeRdzYRm3RE4FPSc5JT4k X-Received: by 2002:a63:e915:: with SMTP id i21mr36337999pgh.297.1553715117205; Wed, 27 Mar 2019 12:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553715117; cv=none; d=google.com; s=arc-20160816; b=q6G5Ctp7bJbWc7h6nmHQtOw7pbI44EkESyocw/SbP7ZNnFWkERluY1W7sZUMVhQyYf o9zeZ+XPKOcUsNd+VvipORuG3Lk6MNMQev7tbIVzn7q0P7anc5QYZG/8g0KFf6DbyHKv jLhr39mEuLPZgIC10MqVxYbZpnyUezj1kfP/uyUfk4h2PLwRjOOsHCLNR+uMeX2QpCK2 w7etry4wTDyMJj08xlBF2PM90jFNlik+rQRlaZ1NWWozHoulnCc/twBS3IfIP1dIRPlz qbJ95R5+qzuBwtMNHxcGNqlQGvAGC+tkhrTumgS8htz9fuQencElJ91kqOrV6oCCU7BU nVSA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t7SDwrJLdFzHmoE952yAwrB6/dUOEo0V82SWqIjaM/4=; b=O9CF6vJ7vq8ryvo6ncB3n6xJXOLZjwY/aN0ujhg+oGV6+rlFN0GgtWCvqWZW06Y16C roCu65NCMG7Vf8xVX069EPtyrNKMKmtZawh1MDGyl5MI1l8MsLbesWPzU18EW2NBjmEa c01CcBL8wBCG4g0Mj3oNni77XKBJC46Oi7wLxF0MPzRWjnxp0wHZbog6Y6wd6A7lXmC9 bIewdygBOmi7vluRT+vE9efYu0KXCXpni2E5cloetFOXR1aoZED/kA3M389nlAks933I Essq44ygoE3JcheuCzyaTmu7Zx6vXH3kCMJVhcdfjrKsg1vijJKkfLJqFlN5fhpoEFBH TIKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yEf938ID; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si20685860pls.161.2019.03.27.12.31.42; Wed, 27 Mar 2019 12:31:57 -0700 (PDT) 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=@kernel.org header.s=default header.b=yEf938ID; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733148AbfC0TbE (ORCPT + 99 others); Wed, 27 Mar 2019 15:31:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:43586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727569AbfC0SDY (ORCPT ); Wed, 27 Mar 2019 14:03:24 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA8E92177E; Wed, 27 Mar 2019 18:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709803; bh=UNeV/CEiqTpGckZzIp25/uCRYplK5p5pIYBYfUU7yIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yEf938IDBtskcjfTktcRTEC9eFAhYAXHorTLb8XNZGzEpvBD7i5jzUHnTf/5gNsXn VdEsSX7sn+13JF7VO67XhtiyfjUKcy+vCpz0m9QOIUDQFbeqbniIQvQv0mNzVSJMmt 0+lhv4P0Vdjd+mBg4tAkF4b7zxhVQP71VHYMdgQ4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Ard Biesheuvel , Will Deacon , Mark Rutland , Alexander Potapenko , Dmitry Vyukov , Andrey Konovalov , Stephen Rothwell , Andrew Morton , Linus Torvalds , Sasha Levin , kasan-dev@googlegroups.com, linux-mm@kvack.org Subject: [PATCH AUTOSEL 5.0 045/262] kasan: fix kasan_check_read/write definitions Date: Wed, 27 Mar 2019 13:58:20 -0400 Message-Id: <20190327180158.10245-45-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit bcf6f55a0d05eedd8ebb6ecc60ae3f93205ad833 ] Building little-endian allmodconfig kernels on arm64 started failing with the generated atomic.h implementation, since we now try to call kasan helpers from the EFI stub: aarch64-linux-gnu-ld: drivers/firmware/efi/libstub/arm-stub.stub.o: in function `atomic_set': include/generated/atomic-instrumented.h:44: undefined reference to `__efistub_kasan_check_write' I suspect that we get similar problems in other files that explicitly disable KASAN for some reason but call atomic_t based helper functions. We can fix this by checking the predefined __SANITIZE_ADDRESS__ macro that the compiler sets instead of checking CONFIG_KASAN, but this in turn requires a small hack in mm/kasan/common.c so we do see the extern declaration there instead of the inline function. Link: http://lkml.kernel.org/r/20181211133453.2835077-1-arnd@arndb.de Fixes: b1864b828644 ("locking/atomics: build atomic headers as required") Signed-off-by: Arnd Bergmann Reported-by: Anders Roxell Acked-by: Andrey Ryabinin Cc: Ard Biesheuvel Cc: Will Deacon Cc: Mark Rutland Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Konovalov Cc: Stephen Rothwell , Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- include/linux/kasan-checks.h | 2 +- mm/kasan/common.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/kasan-checks.h b/include/linux/kasan-checks.h index d314150658a4..a61dc075e2ce 100644 --- a/include/linux/kasan-checks.h +++ b/include/linux/kasan-checks.h @@ -2,7 +2,7 @@ #ifndef _LINUX_KASAN_CHECKS_H #define _LINUX_KASAN_CHECKS_H -#ifdef CONFIG_KASAN +#if defined(__SANITIZE_ADDRESS__) || defined(__KASAN_INTERNAL) void kasan_check_read(const volatile void *p, unsigned int size); void kasan_check_write(const volatile void *p, unsigned int size); #else diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 09b534fbba17..80bbe62b16cd 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -14,6 +14,8 @@ * */ +#define __KASAN_INTERNAL + #include #include #include -- 2.19.1