Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1454412ybk; Thu, 14 May 2020 09:21:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygxgUXoa3Y2w55gchkD8tkwloRRb49nMOK8886MWsT99OxJXLJOBc/5oT4ekZ0y8F6GeTD X-Received: by 2002:a17:906:4e46:: with SMTP id g6mr4501937ejw.36.1589473300553; Thu, 14 May 2020 09:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589473300; cv=none; d=google.com; s=arc-20160816; b=OqCFpFp2uF21SzVVuB/AKVQkAzAWPRbvzm8nQ04zy5LeYxkCZrAcBOathSM1xhcBLI XgixZMLsnVPZpirAf63/JmnbkgnHqCJmbdATJuI9WcYjUhtAywaXOIdTX3+eJIOGsHiL 0uOaZ6Kj1+MBwVl4A+NOgkjgG674CfFf3ImFt0Ydks+wzJtazY3Cd7thZr8/FdK8JRix VJLE0ruDfQHhSxHLj6cD+OWv7BR0PCCiPPSOEEX88A7p4JZBJvRW15WkuRg/mDNwtVCW Es32kE2VyXh+qC2t2lbucvbk69f23Y5KUCimw2n/QYO/hSQBrENBhD/xA9iwkcABcynw n5MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=3+sj8Y+Mzr1j1P1P/nbqTLTnFDHWmPPgkXsU5sEA7Z8=; b=YU94CC/Ehl+/v1vlHSaV8QrZm+d4h5+LjdU9xTvUq4ugBjMwdOI7hy9WPBaLslOyTc iDps9NnRFYdjYiyy3blytb400jTqaEVWn7PMIbRhexIQzM6A7U/hrzeWma7yI8gcD1xU Dl4iUZF3axRvXUX+3VGYI17ZOkBwAkFPMGT9f51EtdWItPixg1Oqm9f9o8dgZPFi19IF aTMXDqK4oZl1Pe8Wk4g/WQhaByVc+lTAkGTVbQbF8L/5TZ6F7RCIRH4MvcwYr/Ih2qCe CCUItaXObXTFwNWeBmRpMFpZ6dVB1h00u2yJcu3V9anTQjZVgLGollQHXQBKu7ukRflN Awdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="N/e/huZ6"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si1950954eds.277.2020.05.14.09.21.16; Thu, 14 May 2020 09:21:40 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="N/e/huZ6"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726017AbgENQTg (ORCPT + 99 others); Thu, 14 May 2020 12:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgENQTg (ORCPT ); Thu, 14 May 2020 12:19:36 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D172C061A0C for ; Thu, 14 May 2020 09:19:36 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id y25so1518458pfn.5 for ; Thu, 14 May 2020 09:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=3+sj8Y+Mzr1j1P1P/nbqTLTnFDHWmPPgkXsU5sEA7Z8=; b=N/e/huZ6btUGYbWK1Tar6juPyELlg9sZ9YtRRal5GmqUMsDO/Mloqv4TFysMyTjTyy 62QCf5P/CY2DJxug8jwaBKL0x9IMlPVit5iQH/1ZudG588GT/6bSjfycVeYHJrLDHF7L 92DrI/LQKeEAF4/QEXTpnyLMUmxQt4b7ibnVrgfCyjshxsQLDYqvSgRivW1oyOOQ2OCz o66caulfTHMSzE1CdY4vORB9FfkbIgllPBI+rfpEKgteFWSrwpcDujCgH8JUdGk8L0J1 7WMAYCuK3DkdQfb7dWsBWdSmzhdTgTq7ufA/Oyblna/o4/Ob055EmiPk3qPOENDlyfrZ 8eOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=3+sj8Y+Mzr1j1P1P/nbqTLTnFDHWmPPgkXsU5sEA7Z8=; b=F6eVnyNBwjueO5x3iKXS631XXDzQvqcqwBT82ofJJNav2dIh9VsOfz2C0EconJSMZn L3bKoeL1tQh3KnTntCPMmB0HIePl047XHwwzwxuE48J5My9aG0othKbDdriiMFbiGIhg aQbTh0ekvvHtT2CrHDJoFetuW8ahS7F+BttmXxdfFdchLLhA00X4i14sUmtew4iTl9Zo pXv3ioFpuJ//N8zcvFvEePjkH87xEMI9OHsUirP6+Yv9Dg0gAC/uVPVJ2GLPj17EbDpb C8N3R7wfGpRUngMXHeekhWpKn5PjjKffy40q0x4a7bz6HVh/ZciZK/TO5BexkAIDptFf UDxQ== X-Gm-Message-State: AOAM533h7MqOkxnuTWGFzEGZD7AtPMsnS1RVbj/UowN7CqMr+64TlONQ 7ICFe8lg8HFO3ZukuIsKYdSkyw== X-Received: by 2002:a62:34c1:: with SMTP id b184mr5032916pfa.73.1589473175462; Thu, 14 May 2020 09:19:35 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:1c47:1b32:8edf:77f5? ([2601:646:c200:1ef2:1c47:1b32:8edf:77f5]) by smtp.gmail.com with ESMTPSA id c2sm2712246pfp.118.2020.05.14.09.19.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 May 2020 09:19:34 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [patch V4 part 1 29/36] x86/mce: Send #MC singal from task work Date: Thu, 14 May 2020 09:19:32 -0700 Message-Id: <19476304-8EA8-4B68-9894-3056308035EE@amacapital.net> References: <1278452779.21179.1589472210183.JavaMail.zimbra@efficios.com> Cc: Borislav Petkov , Thomas Gleixner , linux-kernel , x86 , paulmck , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , rostedt , "Joel Fernandes, Google" , Boris Ostrovsky , Juergen Gross , Brian Gerst , Josh Poimboeuf , Will Deacon , Peter Zijlstra , Tony Luck In-Reply-To: <1278452779.21179.1589472210183.JavaMail.zimbra@efficios.com> To: Mathieu Desnoyers X-Mailer: iPhone Mail (17E262) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 14, 2020, at 9:03 AM, Mathieu Desnoyers wrote: >=20 > =EF=BB=BF----- On May 14, 2020, at 10:17 AM, Borislav Petkov bp@alien8.de w= rote: >=20 >> + Tony. >>=20 >>> On Tue, May 05, 2020 at 03:16:31PM +0200, Thomas Gleixner wrote: >>> From: Peter Zijlstra >>>=20 >>> Convert #MC over to using task_work_add(); it will run the same code >>> slightly later, on the return to user path of the same exception. >>>=20 >>> Signed-off-by: Peter Zijlstra (Intel) >>> Signed-off-by: Thomas Gleixner >>> Reviewed-by: Frederic Weisbecker >>> --- >>> arch/x86/kernel/cpu/mce/core.c | 56 ++++++++++++++++++++++------------= ------- >>> include/linux/sched.h | 6 ++++ >>> 2 files changed, 37 insertions(+), 25 deletions(-) >>=20 >> I like this: >>=20 >> Reviewed-by: Borislav Petkov >=20 > What I am not fully grasping here is whether this patch preserves the inst= ruction > pointer (and possibly other relevant information for siginfo_t) triggering= the > exception in a scenario where we have: >=20 > - #MC triggered, queuing task work, > - unrelated signal happens to be delivered to task, > - exit to usermode loop handles do_signal first, > - then it runs task work. If anyone wants to ponder this, I suspect that we have lots of delightful bu= gs in our handling of cr2, trapnr, and error_code in signals. We should move= them to the sigcontext, at least in kernel, and fix up ucontext when we del= iver the signal. The current code can=E2=80=99t possibly be correct.=