Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp713341lql; Mon, 11 Mar 2024 15:28:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/2AaLQJbXg8L4A6Bg5hPyF0cQCsmzn+Z2epEq/XRBRzHeiKDvDWOYz2X0vbPiW7K8cV9PuqtN5jPSwM9x496NDo7IJeY6a/ovv3DPyg== X-Google-Smtp-Source: AGHT+IEFv2DyxQWLQ91SzANYd4jdiI38V1hfuryZiiC7/GUApRocFauLZzxI/A6LsjFerQvUl58M X-Received: by 2002:a50:9993:0:b0:566:fb8d:ed8f with SMTP id m19-20020a509993000000b00566fb8ded8fmr8126084edb.14.1710196133461; Mon, 11 Mar 2024 15:28:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710196133; cv=pass; d=google.com; s=arc-20160816; b=zU4DJRl3Z2AsWmwR7kldhfW2bW9MlvWs9lOcC/3SQf7yIcKy/nt8gwh+zSK8OTrqY5 7/610uTpp11UKjdn+E83tTS2ny9rQExjSSfm0i2BeV5Kxz8njDrjQqHFBHMa23/j3Ddm CgkI12hBOE7iy/tTJ3ppA92XKihVnNqu9BciEyJ04YNPYhf2f+svoAhi5+f2wePkBFnW UoQrBfvxD0ORxKjqL+9zw4OYyeJwYV+l0Psa/VnsDJSqE5SQrYi7/D8+TzK4zEjPosv8 +ANxiMMNO+/ATIWZPFUlQRlMivga+PRTikHSylwktuh/+x6m1yb/yCvIr3cduZufNTF1 Pahw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=a0Txb94OJ7hs7tfFRmMyIrRYkzaZsNZOSHys/hiIups=; fh=ruiDnoMLSBE+4X2rA/RJpVjRVUrZjVw64tp2B34Kp6M=; b=az6YlmuANDLAlibJw6kW5/nYUmHC1NXbMLEl+ShflDFjnjaMBuwvQrLkVhU0aCM9QB hMfNCSeDPFLzNb4BsQpxj4k2ZQmdqIGviuUpUppraOcVmLCGYK3UZ16G4ibeGot8hCfz FQqfbUZjTT8+pkXIXw6gENbErfdVApy84bpyDo87FxfLTM73M1af263XzTWApzzMwVhw 3vHtT2pZKhLA4/Psrtz1GZ0bexJiKkbmLQTmrCrHih3WMzs/PJ++9epuk5T6zNgfj4y6 +PMbwHC5X8ne++zzrhKvtY8VUF4d8d2HNW3agJa4m7Qcpvj1hojh90YNWoBL5+BW/kOv 10Vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cueJJ8Kv; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-99611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c9-20020a0564021f8900b0056864b0336dsi903711edc.228.2024.03.11.15.28.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 15:28:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cueJJ8Kv; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-99611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0365E1F22128 for ; Mon, 11 Mar 2024 22:28:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5988057890; Mon, 11 Mar 2024 22:28:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cueJJ8Kv" Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFE3057306 for ; Mon, 11 Mar 2024 22:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710196124; cv=none; b=VljNUy4JmzcvOx+Ai/CtoPl/dDgc3GpqdugoeiWVDr6tiL71wSb5YF08BMRgkRqHErfzsiEfbjFxd8uSoj6IRV0v6YQA9ipTRtatCnUvyorFF1+Qf+4jmaB4qG5B9Vqu1OTtc8LKGaYjdpfC388Rg0+miU+Tsy6aOVPg5qhkzzI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710196124; c=relaxed/simple; bh=asVmqVidTEc9OS2n8SyaaS+W2FyZ4fww08wr2TcpZ0Q=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UZ4VcVmcsMgajlqLua4EPLb4jMvDZla5Gut3RkxGxDQ4bucTkVKjEpKA7+5zGsdzAHvlz6NhzyKutU6Wr+8xslYXrTvxVfVeZggJH25SOqXwcx+mPcm0dO+JEFDLKagzEL3ceK7XvoCdt0VMAQpeeBPXjqbvwMT1htrxcSTxqq8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cueJJ8Kv; arc=none smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-60a046c5262so31439567b3.2 for ; Mon, 11 Mar 2024 15:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710196122; x=1710800922; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=a0Txb94OJ7hs7tfFRmMyIrRYkzaZsNZOSHys/hiIups=; b=cueJJ8KvhD8VUbXWy0KB1jVBuwp939q/R8CFowGt9YhMSxxvt2XXXkFm73xOjywiKp V0f+NQbZYetaQ/0ZAI53BpxQQKQjJaMKOqTZ/V+iI1ftuDOyzuKoMa8fEe1uhZwIwK6U RjRC+ODvTVpB/TsDP3o0j2DVu1pQazXaox+lp01kdGJjG5o6GgLxCPj5oo1rxNSekDjz HYBoom5Bi7fX0Bl87NC3QcGWucbe0gpTw4aSROicflGuq5dk1utkCDxXDbeEF2F44J4m +oV6UcLPxB8hPpbBJqGKa6XyoJ6s6YDlIResPIuFBWo/FrbzGyJ03wfVU1K1CuGcv/rT AAHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710196122; x=1710800922; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a0Txb94OJ7hs7tfFRmMyIrRYkzaZsNZOSHys/hiIups=; b=w1munPwINjnO7KpwUMno8jXDcmKlz+wcdOb9+jsMVF/A9pF2GBCgrCRU6Qi6+5oElu dCm5MxQUDCVFm8lSEHjtSr9XyGH025EbX8eVDfX5fFHTLXcqg0g83YkZJiNFiSVDtfqK LgyMjnBrg11du6lS0/p4Dc2SnipcQKgf7NWLdth+EVB07wXpzTBtgNwjecjZ0rSiqhGZ Wjr8BAsoHlevhSmqLpS9Hm2aGCiHt0sF+2PjiJZrOUdkf7PGiEn3sNA/LB6M7OvatO+9 4/Kw9q14YqIt8HTxL+d+A86XCmY7hSp4KFVjtxSIoYE344MHmkMTcYIWjydS9h07NWdV jrCg== X-Forwarded-Encrypted: i=1; AJvYcCWmRvmO9SS9Fh5VZsw2UO+gDVfywiYngsb+AXZcAyGujNiNYweMTQe4EiMc/42mPgt1Ao7UABfXD1j1oUzXayh3gL76t0zVDB9jBKdF X-Gm-Message-State: AOJu0YwYjjrIwJk0dOjHiUsxK2Hs0d+nVVclmgmzKda39Pw7XaVwgQaS DXFPgEs4DeeV3RImDY4wRrFFQ4owS/lSXisj8iKNDnfx3rKz0V3GxT+ps8P8aOrlHrfGsKBhIPl FKs1Yu5U8BTFPwh4YTZb9BaZT7iieewV+Aoyi X-Received: by 2002:a0d:ca84:0:b0:60a:2143:1b0e with SMTP id m126-20020a0dca84000000b0060a21431b0emr6505096ywd.13.1710196121755; Mon, 11 Mar 2024 15:28:41 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <4a5c8d28-7f73-4c15-b288-641f0ccc91c2@redhat.com> In-Reply-To: From: Jiaqi Yan Date: Mon, 11 Mar 2024 15:28:28 -0700 Message-ID: Subject: Re: BUG selftests/mm] To: James Houghton Cc: Peter Xu , Axel Rasmussen , David Hildenbrand , Mirsad Todorovac , linux-mm@kvack.org, Andrew Morton , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 11, 2024 at 2:27=E2=80=AFPM James Houghton wrote: > > On Mon, Mar 11, 2024 at 12:28=E2=80=AFPM Peter Xu wro= te: > > > > On Mon, Mar 11, 2024 at 11:59:59AM -0700, Axel Rasmussen wrote: > > > I'd prefer not to require root or CAP_SYS_ADMIN or similar for > > > UFFDIO_POISON, because those control access to lots more things > > > besides, which we don't necessarily want the process using UFFD to be > > > able to do. :/ > > I agree; UFFDIO_POISON should not require CAP_SYS_ADMIN. +1. > > > > > > > Ratelimiting seems fairly reasonable to me. I do see the concern abou= t > > > dropping some addresses though. > > > > Do you know how much could an admin rely on such addresses? How freque= nt > > would MCE generate normally in a sane system? > > I'm not sure about how much admins rely on the address themselves. +cc > Jiaqi Yan I think admins mostly care about MCEs from **real** hardware. For example they may choose to perform some maintenance if the number of hardware DIMM errors, keyed by PFN, exceeds some threshold. And I think mcelog or /sys/devices/system/node/node${X}/memory_failure are better tools than dmesg. In the case all memory errors are emulated by hypervisor after a live migration, these dmesgs may confuse admins to think there is dimm error on host but actually it is not the case. In this sense, silencing these emulated by UFFDIO_POISON makes sense (if not too complicated to do). SIGBUS (and logged "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n") emit by fault handler due to UFFDIO_POISON are less useful to admins AFAIK. They are for sure crucial to userspace / vmm / hypervisor, but the SIGBUS sent already contains the poisoned address (in si_addr from force_sig_mceerr). > > It's possible for a sane hypervisor dealing with a buggy guest / guest > userspace to trigger lots of these pr_errs. Consider the case where a > guest userspace uses HugeTLB-1G, finds poison (which HugeTLB used to > ignore), and then ignores SIGBUS. It will keep getting MCEs / > SIGBUSes. > > The sane hypervisor will use UFFDIO_POISON to prevent the guest from > re-accessing *real* poison, but we will still get the pr_err, and we > still keep injecting MCEs into the guest. We have observed scenarios > like this before. > > > > > > Perhaps we can mitigate that concern by defining our own ratelimit > > > interval/burst configuration? > > > > Any details? > > > > > Another idea would be to only ratelimit it if !CONFIG_DEBUG_VM or > > > similar. Not sure if that's considered valid or not. :) > > > > This, OTOH, sounds like an overkill.. > > > > I just checked again on the detail of ratelimit code, where we by defau= lt > > it has: > > > > #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) > > #define DEFAULT_RATELIMIT_BURST 10 > > > > So it allows a 10 times burst rather than 2.. IIUC it means even if > > there're continous 10 MCEs it won't get suppressed, until the 11th came= , in > > 5 seconds interval. I think it means it's possibly even less of a conc= ern > > to directly use pr_err_ratelimited(). > > I'm okay with any rate limiting everyone agrees on. IMO, silencing > these pr_errs if they came from UFFDIO_POISON (or, perhaps, if they > did not come from real hardware MCE events) sounds like the most > correct thing to do, but I don't mind. Just don't make UFFDIO_POISON > require CAP_SYS_ADMIN. :) > > Thanks.