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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 26191C433B4 for ; Thu, 22 Apr 2021 17:01:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 61684613CC for ; Thu, 22 Apr 2021 17:01:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61684613CC 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 AA8486B006E; Thu, 22 Apr 2021 13:01:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A57206B0070; Thu, 22 Apr 2021 13:01:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D17D6B0071; Thu, 22 Apr 2021 13:01:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6D22D6B006E for ; Thu, 22 Apr 2021 13:01:37 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 17D138248047 for ; Thu, 22 Apr 2021 17:01:37 +0000 (UTC) X-FDA: 78060619434.15.E528A47 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf24.hostedemail.com (Postfix) with ESMTP id AE925A001A96 for ; Thu, 22 Apr 2021 17:01:18 +0000 (UTC) Received: from zn.tnic (p200300ec2f0e2900329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:2900:329c:23ff:fea6:a903]) (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 C35CB1EC0288; Thu, 22 Apr 2021 19:01:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1619110880; 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:in-reply-to:in-reply-to: references:references; bh=+EX3N/gvFrXpHJ1GEsmaOZJTZVcILi5Ui/2IEpF961c=; b=Ruz8oZT5ljaG7POpeRKhqRJ2oTx6qlTGn4bIJR/c6b0WLmknBSxWwgbTFZtQXGdkpj+uk7 qO/oUfLFknqx5c+AYUsLtv3LkuYpfbGSLpiQjKfG+23/p5ld/tzAWfFnnbr0k32BCizy9O pp29t2GrGqwTcZGklOO5O7f2ujufDU4= Date: Thu, 22 Apr 2021 19:01:18 +0200 From: Borislav Petkov To: Naoya Horiguchi Cc: linux-mm@kvack.org, Tony Luck , Aili Yao , Andrew Morton , Oscar Salvador , David Hildenbrand , Andy Lutomirski , Naoya Horiguchi , Jue Wang , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/3] mm/memory-failure: Use a mutex to avoid memory_failure() races Message-ID: <20210422170118.GC7021@zn.tnic> References: <20210421005728.1994268-1-nao.horiguchi@gmail.com> <20210421005728.1994268-2-nao.horiguchi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210421005728.1994268-2-nao.horiguchi@gmail.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: AE925A001A96 X-Stat-Signature: gkhutfi77ob3tjhof19woogiago7mdk7 Received-SPF: none (alien8.de>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mail.skyhub.de; client-ip=5.9.137.197 X-HE-DKIM-Result: invalid/invalid (public key: DNS error: SERVFAIL) X-HE-Tag: 1619110878-64236 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 Wed, Apr 21, 2021 at 09:57:26AM +0900, Naoya Horiguchi wrote: > From: Tony Luck > > There can be races when multiple CPUs consume poison from the same > page. The first into memory_failure() atomically sets the HWPoison > page flag and begins hunting for tasks that map this page. Eventually > it invalidates those mappings and may send a SIGBUS to the affected > tasks. > > But while all that work is going on, other CPUs see a "success" > return code from memory_failure() and so they believe the error > has been handled and continue executing. > > Fix by wrapping most of the internal parts of memory_failure() in > a mutex. > > Signed-off-by: Tony Luck > Signed-off-by: Naoya Horiguchi > --- > mm/memory-failure.c | 37 ++++++++++++++++++++++++------------- > 1 file changed, 24 insertions(+), 13 deletions(-) Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette