From patchwork Mon Jul 12 06:03:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 473006 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2696189jao; Mon, 12 Jul 2021 00:44:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLcZPRizS/M6rE7+pGC2GzJQCEzrDnZ+0ufA3DJYGEezkbP1v/BiDd38kr7w8gACIAn9/J X-Received: by 2002:a05:6402:502:: with SMTP id m2mr39139745edv.57.1626075852909; Mon, 12 Jul 2021 00:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626075852; cv=none; d=google.com; s=arc-20160816; b=XxsmQWHhFe0ZNaDeo0sffeiguIhoi8HATvzDbA5t0R8W7KLm+Kl6CcdOE4Xbybz+aJ qNRuJ9qXOJDfDR1jftZNAfp9IDM338zB6+1UOelOQC18hCTcYs0PfYfcd4Qx+xcY4WbG X4LVLIujul9zovxuo/+N/DJR8fe4w/e380r4Y4gYrXal3AIy+s7rGqSjM5YXUbrZruLj d3KQ9Y+txFRQx/Y8BcgKZgagJecunDgkAksWBC21WvIdji+qdg1A5UF4Zg8bNsXoqoaK iVrBQLRIy4dmArHbT9koGiQI4LJxnbvrZ8xoZtssIWjy5WLFYoCmoUtsGYladMXLJezh LZ3A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4TVYwoYAinWjtm9QkeYOS8gD2OYBRkgg/ld3TzaRCKo=; b=KB9koQEuSJ4Xn/UwY5rLb4/x54QXeFif1ZmMExe9d3xvgN4pc50RPqG7sqBFLOoBDK DNmBAL31cVbxlKiVgJ2mvM+L6Rp1w6qpXs7Tet2yGAGkuahvaeeFjY45uUrDAikyHrz1 rYgzuLdQOAVJh9FLopr7TnAmpOBv+jUtzrsjwiZOqy0HaceSjYBpFoPtcXS5/l3AIPvk ovGpIDBp0888YMb4EMj1aA6ua8k5WoWZ3chYoDefk96Tdrz6oTu7Md+V3xpRxQ5xBRZy z7VM7jhW4yZFZenWqkg6o5XUKHX581kCEYBo5laPFZfIkH69EOTnwxENxvBjauJcKCaT nyKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bylC2Tjk; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si13642925eda.13.2021.07.12.00.44.12; Mon, 12 Jul 2021 00:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=bylC2Tjk; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349764AbhGLHom (ORCPT + 12 others); Mon, 12 Jul 2021 03:44:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:46252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347567AbhGLHju (ORCPT ); Mon, 12 Jul 2021 03:39:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C4616613D2; Mon, 12 Jul 2021 07:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626075300; bh=YeSgRczbmbSxo4Z5IzaKSbrJnSZG/xkyc9myQMoVzPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bylC2TjkNONM98IWkgfQfmd+F82BwVzCivwgrSqBiPagfojEoj7JhNDLrg0/oJSHs XJJEcdCfd+vAd8Ur+8iVY3VzHNzu54+YC0ebvPZoK9O8dmqaRYZtH/CNMqHJGu63bR TKw2B53N84oz50hHTGIUzmRl2GfAglyU1asxuoGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Catalin Marinas , Marc Zyngier , James Morse , Will Deacon , Sasha Levin Subject: [PATCH 5.13 173/800] arm64: entry: dont instrument entry code with KCOV Date: Mon, 12 Jul 2021 08:03:16 +0200 Message-Id: <20210712060937.277626458@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060912.995381202@linuxfoundation.org> References: <20210712060912.995381202@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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(+) -- 2.30.2 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 \