Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp556853pxv; Thu, 22 Jul 2021 06:56:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIBoeG9YY2TnjOKmFwDisRO1+dyFEoWe5q+TFn5mqmXtBwnf21z7FRQ2cwywygWVYX5cQ3 X-Received: by 2002:a17:906:c110:: with SMTP id do16mr6415ejc.347.1626962190792; Thu, 22 Jul 2021 06:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626962190; cv=none; d=google.com; s=arc-20160816; b=UOyRoxCMRSpJ/3ZdNXeBfVx2IdXz+51FddcRMZJ+XlepK7UOcylgQ53VmWRhASEbH5 OvwlnAqE6uio2nsh3yOOiA4Da1k6MR4o5aYgf9wSl/WxxjbJH/Mtb7l53qCl6Qo+EB+8 wfVEYw90YoF3mI/emyf2vY/Z32RA36Gu4A6kJWW9wILRXVyMxUI1rKfQxh4hx1qcHxF8 egTAPJUhZ3m6TjWAuiDri1VW68GnREn3whoJP2TXZlqtus8DBI1USTfOs8SZ1QK1vET2 0jcCLNj8oeCHxk8AKE5RXb5TivZeG2cOE5q3hZVqZXrdf7mQ/E3vascR5a54Llraeb1h 0RtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=XFcLEzylnNkqNvuqnNb4WHh+ght78BMzZ5jaCLVXsZQ=; b=bOfI8XvetOfx0bGc2oMkQcnBp7RNEYN8TsG0KsmZxvleQD1/329cNAcbJjQW7kYUky WsUhrt55im5K8TTZX/DMduZ8U6SjSTMpI0Gtpg11EqOzoVu7KZHpT6hSIaXEm9tCU8OV +vxr68PeYzxLu/G7XQHUQdkEgsGRjSEOqD7Ba+O/AmFI73xUCqTwWvvRzuWb1rx4k8W3 bpCxX7Z6dUcMja9stJsBlh36cGDI14pybyNS/UFPBx24otrL2cxDsAQDSUMsGUVlXjAV n3hdYaTKzYbuQRIevKymcyDi0AHUjiGsP7MACau5xLWN4E39TTLIhs9q51tcxDhTvD8F QgUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oB7VFHKA; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si28938940ejk.135.2021.07.22.06.56.07; Thu, 22 Jul 2021 06:56:30 -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=@google.com header.s=20161025 header.b=oB7VFHKA; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232118AbhGVNOQ (ORCPT + 99 others); Thu, 22 Jul 2021 09:14:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231925AbhGVNOP (ORCPT ); Thu, 22 Jul 2021 09:14:15 -0400 Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED4CC061757 for ; Thu, 22 Jul 2021 06:54:49 -0700 (PDT) Received: by mail-ua1-x92d.google.com with SMTP id e7so2100108uaj.11 for ; Thu, 22 Jul 2021 06:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=XFcLEzylnNkqNvuqnNb4WHh+ght78BMzZ5jaCLVXsZQ=; b=oB7VFHKAYF2u10xgMegELJG0FkTwPoek8rERNyl5GOibo0ORUXPQOJgZqkvDjyfMpV S5IJ0dTh2emkAScz6nIwMDjbqscYflVMFlfdumYmqB9hUIy4R4rXFXRRGNVQ6Ct9y35L ntZY0kwseDgFbWt8CwD/50YAK7HBIzNjfR4Z8A+ZSmcUhrkZSzg/Ci1ByTADOlk+pdkH VpXncR0JUypyvMD/v162L45DY7zyb1qKIuds/81empaM5XosyAZVHuL1EhXx6SJPFAWj trh1GfZVWZatzJKEUdgTh1m8AcXdDRsNd4yUtvU09EhZ/DLMr0KP8MJufC2n0RBdnj3t ZXVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=XFcLEzylnNkqNvuqnNb4WHh+ght78BMzZ5jaCLVXsZQ=; b=N88sF12A5PM2St1/LFUOe2exwdGTLfPri0cc/EHw/TuZJG3J7Yo/weTgn8tNy9ghJW TuvoFXN0HuJodv87qFCQvhRK5BUParrpcmBBQ7V+6HhDlnkuy58chHVEwa27Cmi5fYYJ 6KcnjqLSEem4ECLbjrBgvBwFH8XaDBib4KWoMxNbmVK1uXpdhCNzwUdUAc+IwKxBTlH5 kLyVSqRoXtKy2PLGuPXxmZsHv+iqAkj9HIFOoZMIYhN4DEDpLWuFE61tXXpXNItNYEDt jdI8rscDvztdV+lDAV2YYOSZy/llaMsKvpRjCLy5V5brbvZLdSRpds2x5x5zq7Zk9c9a iA0g== X-Gm-Message-State: AOAM531KnuqFCAQ+bPDXza62stmBFOuslwEgKVds5CMlaHwj+DJWAyGi 7IKRjymHY8Uxpv88WzNGssK/12wgdZarjdrBa7PCGg== X-Received: by 2002:ab0:45cc:: with SMTP id u70mr41536169uau.85.1626962088661; Thu, 22 Jul 2021 06:54:48 -0700 (PDT) MIME-Version: 1.0 From: Jue Wang Date: Thu, 22 Jul 2021 06:54:37 -0700 Message-ID: Subject: Re: [PATCH 2/3] x86/mce: Avoid infinite loop for copy from user recovery To: "Luck, Tony" Cc: Borislav Petkov , dinghui@sangfor.com.cn, huangcun@sangfor.com.cn, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Oscar Salvador , x86 , "Song, Youquan" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch assumes the UC error consumed in kernel is always the same UC. Yet it's possible two UCs on different pages are consumed in a row. The patch below will panic on the 2nd MCE. How can we make the code works on multiple UC errors? > + int count = ++current->mce_count; > + > + /* First call, save all the details */ > + if (count == 1) { > + current->mce_addr = m->addr; > + current->mce_kflags = m->kflags; > + current->mce_ripv = !!(m->mcgstatus & MCG_STATUS_RIPV); > + current->mce_whole_page = whole_page(m); > + current->mce_kill_me.func = func; > + } > ...... > + /* Second or later call, make sure page address matches the one from first call */ > + if (count > 1 && (current->mce_addr >> PAGE_SHIFT) != (m->addr >> PAGE_SHIFT)) > + mce_panic("Machine checks to different user pages", m, msg);