Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3344796pxv; Sun, 4 Jul 2021 16:07:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY7Xt+EHPa73FhQCu4y9PvE5eCwVGQ9SJ6Xx5za5Pglp6uZF0hMdMfemH+kN3QXXK35NdL X-Received: by 2002:a05:6602:737:: with SMTP id g23mr9163607iox.49.1625440075605; Sun, 04 Jul 2021 16:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440075; cv=none; d=google.com; s=arc-20160816; b=IL2wy5oRiklKPcLMGstGLgc9h6oQvQnIM1C3yMJP7Ldgg4ef3ywSA1uV12HOUvXvxF QLbPSJBMXh3XsOqWWV4AzmtMC+Sl11c1OZUNOq1Fv8QAsg/T0Mjs+lKPc2h8v52yo1Z0 9/Kwn+oVIjeBLeoP0XxXynSPWyQ66h8Ao9PVsFIRyZ/7rmZXdzZxyEyRsE9zlrurPfZA YyK/zQTa4PYNMltgLrD2UsBIw7Glxz8yABgT7fCinqs02g4iq89aL4QYfBx7xvUnhDjW UChIWadFjdzJuFcrgzz08o4Z7ZuTUOpYRCn79KeMZc4iVFL4XtVB9MSjsHaCDNVpyQAc Mx3w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4TVYwoYAinWjtm9QkeYOS8gD2OYBRkgg/ld3TzaRCKo=; b=kG8GFWX6vgFpTTeBygry5dtmTB/81uEpOOud7UEp9ztPjHHCi59ssyt9j7lCcTIU/i ZAWJuPr4Y4zI9BTMmZfKd+jJayEndAv8bfE1zb3CchSNts/e6dPcjNz9K3HFW4/R5n0s ZK/pJrty+9Z7HZHyJaQDk3wFfVQdM6pwO2Xjtzo2CTuDpcfY6uK78uamX5VP174+l7Hz UgL5xjDerTzV0t+wLK4uKDnU/Xr3q1RWSG3fYyT8WlyXAqxsP+pEgXyaeH2GvAEEDEH3 rtJvAw9LXARQ4cytbTM4RmXJtqfy/zvmSlj6g8/x4wYnWP2qzbelCjeDbZwINgxprBqQ mW0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TTBd2Kb8; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si9935309jar.113.2021.07.04.16.07.43; Sun, 04 Jul 2021 16:07:55 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=TTBd2Kb8; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230527AbhGDXIb (ORCPT + 99 others); Sun, 4 Jul 2021 19:08:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:46010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230312AbhGDXIC (ORCPT ); Sun, 4 Jul 2021 19:08:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D56E36193E; Sun, 4 Jul 2021 23:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439926; bh=YeSgRczbmbSxo4Z5IzaKSbrJnSZG/xkyc9myQMoVzPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTBd2Kb8Jgnep9VP2kNCLtAfK2wJQauTMX3l2pDD7C06HKyCM7qrpqh6GsGcvI6tz s1Ai27YY2ZYEbTMVAans/Uq/we/yVhkU3xdm8lYLJfRNmDxxSWZAIfKD9F72dGIFf9 RKpDN7fr7AvvjbbFWCuan3QHWLBVRYKK62msGfgkHXkihcUMidRv1fubUCU1lcukTx 6KQ7nVXAnt4AkVfm1OKl5b7KQ5ESe63qQKqdDyldnOifd1ylbZKrUrA/7UMBxfSWXb qxWWV3kp99ZAg8/bxdQZt9kiHaA7mhIKZO7otrLEaoYnOFh5YmiQv5tCJgroVXKg5p 34Oy1K9rcJ5rQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mark Rutland , Catalin Marinas , Marc Zyngier , James Morse , Will Deacon , Sasha Levin , linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.13 48/85] arm64: entry: don't instrument entry code with KCOV Date: Sun, 4 Jul 2021 19:03:43 -0400 Message-Id: <20210704230420.1488358-48-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland [ Upstream commit bf6fa2c0dda751863c3446aa64d733013bec4a19 ] The code in entry-common.c runs at exception entry and return boundaries, where portions of the kernel environment aren't available. For example, RCU may not be watching, and lockdep state may be out-of-sync with the hardware. Due to this, it is not sound to instrument this code. We generally avoid instrumentation by marking the entry functions as `noinstr`, but currently this doesn't inhibit KCOV instrumentation. Prevent this by disabling KCOV for the entire compilation unit. Signed-off-by: Mark Rutland Acked-by: Catalin Marinas Acked-by: Marc Zyngier Cc: James Morse Cc: Will Deacon Link: https://lore.kernel.org/r/20210607094624.34689-20-mark.rutland@arm.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/kernel/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 6cc97730790e..787c3c83edd7 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -14,6 +14,11 @@ CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_syscall.o = -fstack-protector -fstack-protector-strong CFLAGS_syscall.o += -fno-stack-protector +# It's not safe to invoke KCOV when portions of the kernel environment aren't +# available or are out-of-sync with HW state. Since `noinstr` doesn't always +# inhibit KCOV instrumentation, disable it for the entire compilation unit. +KCOV_INSTRUMENT_entry.o := n + # Object file lists. obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ entry-common.o entry-fpsimd.o process.o ptrace.o \ -- 2.30.2