Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2583652lqb; Tue, 28 May 2024 04:46:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGE8yFn2PYymdOShIumacbVYejJYBQ6khtdHRSMrrutJunFDzcYudNgcRWRKPU1AVUNQ7dzp7MoqVHtgAnsLiusd7DKs+9AW1Wof7d9A== X-Google-Smtp-Source: AGHT+IG9C5MZdX0tP8a5UqgNNcN9cGruQTkAgECQhGC1GH2/okLVIlyAYFN0Ierd63Oc0TjDBR4a X-Received: by 2002:a05:6a00:301c:b0:6f3:eb71:af90 with SMTP id d2e1a72fcca58-6f8e924aa5amr17039284b3a.4.1716896788585; Tue, 28 May 2024 04:46:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716896788; cv=pass; d=google.com; s=arc-20160816; b=btx9QX1tc4aNT9kiKDEai1wi5muwBlz4850Dv0RObnIs8DjXd8CZwOyvaV2w/65lv8 hbFL8bnLjBQKvvqhm2xlBbVBIPjkS2AXuLyMYO/epB4uNXFgOuY41ERrx+7qJGxHeDsO Alr5qXQ4jodEoD99uas2AYHLvaMe1wQxhsjYRpmBgcGNnPkZPsTwYA3WBTglgxwHB98t Ku/2N5Ym1GWIjmyHuboXQNU/yTzRtlf3Ry/yRtbctgbizYrNxbLq+LvIa7DSydYZdezP iiEZvQwHAOmNscxnGeKp9jY4JewrR+Vg66XtsBWiOa0lv45uxlGeNpGAI/RkywQYPFc8 tPvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=Ol7jO+/V1YfPpFVSV5jUah0yPkjfrGrX9WAAgHtbTLo=; fh=IqmLR1w4Sd0i5Z5C4cFGAu2figEizRD9AispfDCV4M4=; b=Pzu0MC88z9ToYHqriFp1KJnCXhEXv8pwdgaDgHC7G6RNnM0yzVwFAPUYm8PW530dvf 9k1Qk82qOGmmsve0ltlhgjX5tacpAFDHACILkCpojySN3m40WjxOFStRn4SZApVMm21T /avhFLC00oHaQ5VBY/WQgGTqdUyhBzJp1SY+t5wexrH5SDtX9B/p2V1SGNpktMoqsf/d +xJVf727jDSfLQa0HyBMfTin89vVVL/auQX7dSeAfDTZx5oC7/t+ZSEC0Osikpz18wSN Q9reS8FV5iAPSC6klvWkTbjpdgJ3Rvc+gLY32euCCRlsEGEonwWwfyDolgDVZ7V0AjDd SSGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=hZ78wS4o; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=LKdIValk; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-192186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192186-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-68229935dc1si8327231a12.632.2024.05.28.04.46.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 04:46:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=hZ78wS4o; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=LKdIValk; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-192186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192186-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 54C11286936 for ; Tue, 28 May 2024 11:36:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A35616C875; Tue, 28 May 2024 11:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="hZ78wS4o"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="LKdIValk" Received: from wfout4-smtp.messagingengine.com (wfout4-smtp.messagingengine.com [64.147.123.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE21016C840; Tue, 28 May 2024 11:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716896161; cv=none; b=sBV+DNm89c5CsMu/UZBvOk9kwbueFO3HRm7rV817xu0BkNzCnCBBVu55btY1Rgq9cati+9Ooq3gPkkNxAt0Z3vRYOiKPWZFeqFIb1DGy2QSdN/LpcvlmvBe7JZiYiCHNnReF9s7ksdW1nWpAs9tPDWxsTuX+slO0kMtQytvJuaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716896161; c=relaxed/simple; bh=jFZXicEE6r2ZgbR45j79punfT8HXTNnMc7smmAivjRA=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=T96+OB4h9FrfN4m67zFff3hCiqI9+aI2eruBtOGAXnl4330WtAMfUamubHsvfLesI1e2iaBW0wOqwn5UZHzGjUFKBnRTFUouuyWPhPQGj6lIT7cNZWawLTOxbo/QO1zyBt5B5pEPjknjid9ugDxIB4rb82c3oWYzD9huxYdvPtA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=hZ78wS4o; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=LKdIValk; arc=none smtp.client-ip=64.147.123.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id B54BD1C00179; Tue, 28 May 2024 07:35:57 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Tue, 28 May 2024 07:35:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1716896157; x=1716982557; bh=Ol7jO+/V1Y fPpFVSV5jUah0yPkjfrGrX9WAAgHtbTLo=; b=hZ78wS4owIYvRnqNcJ9zGfh2iV 29FeERqf3tpc8bFg+119EFqupV4BcHaAixDPQ47HIBf8Va8r8u53824y7iiTbej1 MQ3Ke5XbklsNLFtST6f7l9RTYPqbHEMJDAnZMzX+kGBk2MB4d0k1z23r2WDbgVrg UBwkOCAHYD6SFAULTM/yWP6U78j89HNt7iI/+Y7q2Ql1c161o27u5Yxhmp2v7ARr sDFdO+96dQ225yu/Ii5e1lTtKoyOYwfIHiI0XWKmHqgqj+YGIYByqaYCNfpJ93lc 6ArP5tRztJw096mbCSMpnzOeYGRcjCLM7nqvtXrhnSd9twjdWIjJsh2HIgPg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1716896157; x=1716982557; bh=Ol7jO+/V1YfPpFVSV5jUah0yPkjf rGrX9WAAgHtbTLo=; b=LKdIValkUX29uWFgX5KgpSQVm0yXzqOkReHvvYMzUm+9 ExhSup/6OzeBkUR5DXy+puro6xhfaLxUZNx5kvtYDBYfZpzZohrP2PCuNxR4ajSj Yn8uN3xZrTiaHZTTbtcarB8EATSdnFlQDCsoDm9F4Q6C+GmHBQBddku2wu+j9mMz 80l4SOr4R47zcy1jIrfdPP5IZ0Nv7r+gELqY+vT8cpZr9xUny9sw+a4Kw2Lna5hZ 0u2zN6Hi/VqUTAC2yQ/YYLXNxm4kwQfPFOjMAtvV27r6StED/Snt/kUe/ZjuK49B B6DnjNG/4ycIwMX+mgoY6uhuCE+OaoncVm8mviv19w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdejkedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 116C4B6008D; Tue, 28 May 2024 07:35:56 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-491-g033e30d24-fm-20240520.001-g033e30d2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <0e8dee26-41cc-41ae-9493-10cd1a8e3268@app.fastmail.com> In-Reply-To: <20240506133544.2861555-2-masahiroy@kernel.org> References: <20240506133544.2861555-1-masahiroy@kernel.org> <20240506133544.2861555-2-masahiroy@kernel.org> Date: Tue, 28 May 2024 13:35:10 +0200 From: "Arnd Bergmann" To: "Masahiro Yamada" , linux-kbuild@vger.kernel.org Cc: Linux-Arch , linux-kernel@vger.kernel.org, "Kees Cook" Subject: Re: [PATCH 1/3] kbuild: provide reasonable defaults for tool coverage Content-Type: text/plain On Mon, May 6, 2024, at 15:35, Masahiro Yamada wrote: > The objtool, sanitizers (KASAN, UBSAN, etc.), and profilers (GCOV, etc.) > are intended for kernel space objects. To exclude objects from their > coverage, you need to set variables such as OBJECT_FILES_NON_STNDARD=y, > KASAN_SANITIZE=n, etc. > > For instance, the following are not kernel objects, and therefore should > opt out of coverage: > > - vDSO > - purgatory > - bootloader (arch/*/boot/) > > Kbuild can detect these cases without relying on such variables because > objects not directly linked to vmlinux or modules are considered > "non-standard objects". > > Detecting objects linked to vmlinux or modules is straightforward: > > - objects added to obj-y are linked to vmlinux > - objects added to lib-y are linked to vmlinux > - objects added to obj-m are linked to modules > I noticed new randconfig build warnings and bisected them down to this patch: warning: unsafe memchr_inv() usage lacked '__read_overflow' symbol in lib/test_fortify/read_overflow-memchr_inv.c warning: unsafe memchr() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memchr.c warning: unsafe memscan() usage lacked '__read_overflow' symbol in lib/test_fortify/read_overflow-memscan.c warning: unsafe memcmp() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memcmp.c warning: unsafe memcpy() usage lacked '__read_overflow2' symbol in lib/test_fortify/read_overflow2-memcpy.c warning: unsafe memcmp() usage lacked '__read_overflow2' warning in lib/test_fortify/read_overflow2-memcmp.c warning: unsafe memmove() usage lacked '__read_overflow2' symbol in lib/test_fortify/read_overflow2-memmove.c warning: unsafe memcpy() usage lacked '__read_overflow2_field' symbol in lib/test_fortify/read_overflow2_field-memcpy.c warning: unsafe memmove() usage lacked '__read_overflow2_field' symbol in lib/test_fortify/read_overflow2_field-memmove.c warning: unsafe memcpy() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-memcpy.c warning: unsafe memmove() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-memmove.c warning: unsafe memset() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-memset.c warning: unsafe strcpy() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-strcpy-lit.c warning: unsafe strcpy() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-strcpy.c warning: unsafe strncpy() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-strncpy-src.c warning: unsafe strncpy() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-strncpy.c warning: unsafe strscpy() usage lacked '__write_overflow' symbol in lib/test_fortify/write_overflow-strscpy.c warning: unsafe memcpy() usage lacked '__write_overflow_field' symbol in lib/test_fortify/write_overflow_field-memcpy.c warning: unsafe memmove() usage lacked '__write_overflow_field' symbol in lib/test_fortify/write_overflow_field-memmove.c warning: unsafe memset() usage lacked '__write_overflow_field' symbol in lib/test_fortify/write_overflow_field-memset.c I don't understand the nature of this warning, but I see that your patch ended up dropping -fsanitize=kernel-address from the compiler flags because the lib/test_fortify/*.c files don't match the $(is-kernel-object) rule. Adding back -fsanitize=kernel-address shuts up these warnings. I've applied a local workaround in my randconfig tree diff --git a/lib/Makefile b/lib/Makefile index ddcb76b294b5..d7b8fab64068 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -425,5 +425,7 @@ $(obj)/$(TEST_FORTIFY_LOG): $(addprefix $(obj)/, $(TEST_FORTIFY_LOGS)) FORCE # Fake dependency to trigger the fortify tests. ifeq ($(CONFIG_FORTIFY_SOURCE),y) +ifndef CONFIG_KASAN $(obj)/string.o: $(obj)/$(TEST_FORTIFY_LOG) +endif endif which I don't think we want upstream. Can you and Kees come up with a proper fix instead? Arnd