Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3610150pxb; Mon, 24 Jan 2022 13:28:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyB00Cqs+r9AEugQqS7yGimWOcTJKBp0QuawVefD6ql1c0MWc1QO/FaTfNkq+iwEt6qCcvZ X-Received: by 2002:a63:45:: with SMTP id 66mr13137040pga.607.1643059698427; Mon, 24 Jan 2022 13:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059698; cv=none; d=google.com; s=arc-20160816; b=rNQjd0goYfYciwK2UGLl5HaEJ6Az0MJLb1hn7r+iQp41MjLBfyBH88zqsqt6DkMBWJ mHgOCmnB+mXhAPbEDl3e6nziJf0B8ODX/hoD2zyifpUXF0LMmssKK4p6XVnCqJRO4uZM nnw1Lq4Mh93s/IrZAfc62INddQsLK9cKkeX/OBjsLEcyKL2kK/9rR6bET5V0juEhHuem GMEeBWRjg3i0jCjKxQ4TnFy6c4LxN7ZnQp3NGLPLUh4i3dJ64uT8WeSIGO9alugG9jWg MPsRBlygDHoi3O4m0xvUDVVdDtw+omHaJCln/wqg/V7AMKut4VCozrw9Mm1n+rcYcCdl IO2w== 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=MeUjup9IT3xLy+0zRFXrkkumLd99jgXfEm+oalX51Uw=; b=TUAKcYuwMgThgncQQk2REKOubOrvLDm6adNMz7GpeYvkkDWI77sOEILFvOFl5w9EUL lHc5bkxa3+43bpgRFf2m8AkRg+ekcpNqHTZynZzOYKc1393tRgVr7qWIcJMOA9TskTzR kAXIAcidOe6NkrF5VBX3b2sm8hlLaUCRw7J8sNSbfcqpEf3/wmKZ411Lb0caDTr2FrKU f4BxpPvomK4wghjqPLUIFU+HgVrPVbawdIf11eOCEYrszit0+UG0lh0F8omfhbT2vL9r YhqPC9b/W4TKszLfQh8Ox1I+hQsKjsn4jQeKVzOnrLClnva5UEAV19e9igd6C6k4etPu vjLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dwer9x51; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ij15si12352459plb.355.2022.01.24.13.28.06; Mon, 24 Jan 2022 13:28:18 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=dwer9x51; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444935AbiAXVBp (ORCPT + 99 others); Mon, 24 Jan 2022 16:01:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59758 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351042AbiAXUid (ORCPT ); Mon, 24 Jan 2022 15:38:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E03E61540; Mon, 24 Jan 2022 20:38:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FB84C340E5; Mon, 24 Jan 2022 20:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056711; bh=XzhNkZxyer8awJv+RVsKsH09udznovulrHjfciVCME4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dwer9x51lsvtfX1cNjU4B3ksRevVvyI6lUH32Fu1j39sKD8FlW1g3WYR0NOrILUBL GcRVHa+TECmq/oFekO0qVnhb/Z1Lb99ls0Wy4qk1aAMMfs62XgInnrhav5/yxKAPdz vrkxh5R/xujx5fmdR2PxpY9FWT+QuoWvqF1nEBSo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.15 542/846] x86/mce: Allow instrumentation during task work queueing Date: Mon, 24 Jan 2022 19:40:59 +0100 Message-Id: <20220124184119.719790464@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov [ Upstream commit 4fbce464db81a42f9a57ee242d6150ec7f996415 ] Fixes vmlinux.o: warning: objtool: do_machine_check()+0xdb1: call to queue_task_work() leaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-6-bp@alien8.de Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/mce/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 193204aee8801..c8d121085c8f7 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1454,6 +1454,14 @@ noinstr void do_machine_check(struct pt_regs *regs) if (worst != MCE_AR_SEVERITY && !kill_current_task) goto out; + /* + * Enable instrumentation around the external facilities like + * task_work_add() (via queue_task_work()), fixup_exception() etc. + * For now, that is. Fixing this properly would need a lot more involved + * reorganization. + */ + instrumentation_begin(); + /* Fault was in user mode and we need to take some action */ if ((m.cs & 3) == 3) { /* If this triggers there is no way to recover. Die hard. */ @@ -1479,6 +1487,9 @@ noinstr void do_machine_check(struct pt_regs *regs) if (m.kflags & MCE_IN_KERNEL_COPYIN) queue_task_work(&m, msg, kill_current_task); } + + instrumentation_end(); + out: mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); } -- 2.34.1