From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6660C433E0 for ; Tue, 19 Jan 2021 10:56:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 183C02075F for ; Tue, 19 Jan 2021 10:56:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 183C02075F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 345458D002D; Tue, 19 Jan 2021 05:56:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F4E78D0017; Tue, 19 Jan 2021 05:56:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E3D28D002D; Tue, 19 Jan 2021 05:56:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 044CD8D0017 for ; Tue, 19 Jan 2021 05:56:35 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B7C8D348D for ; Tue, 19 Jan 2021 10:56:35 +0000 (UTC) X-FDA: 77722221150.04.move59_1d0636d27551 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 9A4CF8006429 for ; Tue, 19 Jan 2021 10:56:35 +0000 (UTC) X-HE-Tag: move59_1d0636d27551 X-Filterd-Recvd-Size: 3108 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 10:56:34 +0000 (UTC) Received: from zn.tnic (p200300ec2f0bca00c2aa0e949335efb7.dip0.t-ipconnect.de [IPv6:2003:ec:2f0b:ca00:c2aa:e94:9335:efb7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 91FEF1EC05DD; Tue, 19 Jan 2021 11:56:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1611053792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rCir/nAqMuATcSo3nza+fGR+2FWhLGn2xxPdAjuV8tE=; b=fB0hmIsZJxjjgz1H87jtFUaF+J4zpP0lN4z551FDlWXQWl88afoJXgJdKH8fLaFem1IBAN eCvZJnB/T8SSneqQkPdNpcezGYy7gBbe0PpaR6KvE/EF3lryYyIG47t/HvEhJSCSpi61TJ CwQn7IZ9YkFwV8nipIEOmcQtfKuG5nU= Date: Tue, 19 Jan 2021 11:56:32 +0100 From: Borislav Petkov To: "Luck, Tony" Cc: x86@kernel.org, Andrew Morton , Peter Zijlstra , Darren Hart , Andy Lutomirski , linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v4] x86/mce: Avoid infinite loop for copy from user recovery Message-ID: <20210119105632.GF27433@zn.tnic> References: <20210111214452.1826-1-tony.luck@intel.com> <20210115003817.23657-1-tony.luck@intel.com> <20210115152754.GC9138@zn.tnic> <20210115193435.GA4663@agluck-desk2.amr.corp.intel.com> <20210115205103.GA5920@agluck-desk2.amr.corp.intel.com> <20210115232346.GA7967@agluck-desk2.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210115232346.GA7967@agluck-desk2.amr.corp.intel.com> Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jan 15, 2021 at 03:23:46PM -0800, Luck, Tony wrote: > On Fri, Jan 15, 2021 at 12:51:03PM -0800, Luck, Tony wrote: > > static void kill_me_now(struct callback_head *ch) > > { > > + p->mce_count =3D 0; > > force_sig(SIGBUS); > > } >=20 > Brown paper bag time ... I just pasted that line from kill_me_maybe() > and I thought I did a re-compile ... but obviously not since it gives >=20 > error: =E2=80=98p=E2=80=99 undeclared (first use in this function) >=20 > Option a) (just like kill_me_maybe) >=20 > struct task_struct *p =3D container_of(cb, struct task_struct, mce_kill= _me); >=20 > Option b) (simpler ... not sure why PeterZ did the container_of thing >=20 > current->mce_count =3D 0; Right, he says it is the canonical way to get it out of callback_head. I don't think current will change while the #MC handler runs but we can adhere to the design pattern here and do container_of() ... --=20 Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette