Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3644786pxb; Mon, 24 Jan 2022 14:17:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWWsZMw+a/7e5ZwjZCzNMayAHFxbY2v5gGKdfoUtP1OGuQdiugqPflcXzh6HPjLuQ7Bq4E X-Received: by 2002:a17:90a:e387:: with SMTP id b7mr400260pjz.89.1643062624749; Mon, 24 Jan 2022 14:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062624; cv=none; d=google.com; s=arc-20160816; b=PpnUduQthyCBuxuXLuxdfvqIWWez5KsdFNqc0p+B6L6L3WtHlEvyXTTDPropg6H+ib TqZXBQogDtpGthNgNy5FLHONKmvThGvtJ4BUVdxiffFyNzTMiPsZl3Yjum+U/pavw+/M ZgsYm1tPE2FciOIeyJhrsbrs4IRqW7YIjVZdXBDd8xRXqERhL90uWwy2ncTKDsiNov9q IfRzVf1kGN2vW1FXTKrxrDuXW4l4ha/ApJ42ywSUbsgk+Ga8mq07aORKn9Gsw0NO5/MG lytzoSueaMfxeMRIMlmbwZcBybv7sDsKMvOeSFeNKgALPK/qZNsYpiwNPwIL6D2iebXy l2aQ== 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=iiDR+zCVnC2DmknWeuKgYIB5GYdEa29QlIhLM1y2xnk=; b=pQ7wj3W42zY4npp7Mag5CUa9JJn/eJmKPPGeXs/U6F5OJI7Cyj3CtV52ayB2rpWAq0 co+UXFfKM8GAEJzfeD/4M5zlA6TH03cJ0DOcPJXaR215iQyEsvLG6ApfIPT5GatiLGbW uCGDSaSKKV1XUIDzLvTxrD6rQgrZy4c7ypbq9Q9fzzBOiRh514J5UDWJuySYc/V3kWh4 KtSsXZRCfrJCiigjWA9n3j0cGFbI+oi52iKaluzNobTT56u6Rh4K/fRFXuJwMuwYa46g h2hYO8Cjg3c6Y0WH31KsV73dTZnfzJdo0wA+/4PEfLrBA7fAEWw5tLLOhAElQLlK3AvS uWeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=igMRjpDy; 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 v63si6403660pgd.878.2022.01.24.14.16.52; Mon, 24 Jan 2022 14:17:04 -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=igMRjpDy; 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 S1581239AbiAXWL1 (ORCPT + 99 others); Mon, 24 Jan 2022 17:11:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41240 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452346AbiAXVZR (ORCPT ); Mon, 24 Jan 2022 16:25:17 -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 ams.source.kernel.org (Postfix) with ESMTPS id 459ABB811FB; Mon, 24 Jan 2022 21:25:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7276BC340E4; Mon, 24 Jan 2022 21:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059513; bh=DcWAn2JPOmd7HM4LptMNGkIDWokyu5A3HOzLpIINlwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igMRjpDy0dDrG7eYEl2vIOL4kqSnB0PL7LsnLpwUuL6Y4c68Ji2OXuO4toShG2ATN kMyJnbauFhhVkHDWF6Entks63tpoxhWMYAlGNhSG5PNEhjza8mpSvl2gORz3yyf0zI 4Jy9XfgHTiU/Q01wMV/HQI0DYXAx1gcMuWner80c= 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.16 0640/1039] x86/mce: Allow instrumentation during task work queueing Date: Mon, 24 Jan 2022 19:40:29 +0100 Message-Id: <20220124184146.865221335@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 6ed365337a3b1..70ec5685906b2 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. */ @@ -1482,6 +1490,9 @@ noinstr void do_machine_check(struct pt_regs *regs) if (m.kflags & MCE_IN_KERNEL_COPYIN) queue_task_work(&m, msg, kill_me_never); } + + instrumentation_end(); + out: mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); } -- 2.34.1