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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCF00C54E58 for ; Mon, 11 Mar 2024 14:35:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4F8F6B00A0; Mon, 11 Mar 2024 10:35:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD83D6B00A1; Mon, 11 Mar 2024 10:35:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C78336B00A2; Mon, 11 Mar 2024 10:35:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B5EC26B00A0 for ; Mon, 11 Mar 2024 10:35:36 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 877C680C26 for ; Mon, 11 Mar 2024 14:35:35 +0000 (UTC) X-FDA: 81885006630.16.B861E90 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 378011C000D for ; Mon, 11 Mar 2024 14:35:32 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KIAnqE7I; spf=pass (imf21.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710167733; h=from:from:sender: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:dkim-signature; bh=D8Bn0Qza1gC0R7VtqD/37KxM2U8PNSYbow8rmpoOJHE=; b=mrkWQdQPQboXRmDLi21CaYvPLwqrLp5Qqams8j/dPAr8sC3HfsBTIsMmfCUWn3cT1hPWzK ZI7HrO8KzO0achvAL5K4xSbUaS8eiGgipReZqEVVnUpXjSMkO5DfxMYAogbJayMw8A0afG 9O555CjyyD7me7nBIoRD6R3i5e9n5as= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710167733; a=rsa-sha256; cv=none; b=0YTQsfY7u3deJ5aO5tId885kXYWqctki9NVFlQE/AVN4aR4yStnuJl3qxdSLXQfSISLmhF M317Ns2m+zDh9ovJ/gqRXBUTBghqqxg1mBS2gadfvCSaTxgyYOOHim9Ae9oDmAgjTbj2i2 qC12b0hGyxpRxrfFT2KCjkzKXvgRwV8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KIAnqE7I; spf=pass (imf21.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710167732; 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: in-reply-to:in-reply-to:references:references; bh=D8Bn0Qza1gC0R7VtqD/37KxM2U8PNSYbow8rmpoOJHE=; b=KIAnqE7IlNBWtXS6BQVp1J6OqP3t7FoRY2RwVZ0WJ0flOWRZmUhKrvJ2NszyCj5Z1kiC99 BJJPJgoVr19y8znthO+QoN7GuH2eCUrYtYenrpywmcnQTs6m1SamHNJqf2A7sXhmUAUcLB Gzl1p92WIrd0t6e35gujICE7rMOdajU= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-262-0wqeu5FHPdiiwqn8QNl3PA-1; Mon, 11 Mar 2024 10:35:31 -0400 X-MC-Unique: 0wqeu5FHPdiiwqn8QNl3PA-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-690d3f5af86so3311866d6.0 for ; Mon, 11 Mar 2024 07:35:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710167730; x=1710772530; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=D8Bn0Qza1gC0R7VtqD/37KxM2U8PNSYbow8rmpoOJHE=; b=FxF2VePMdfQ3dQj3/OmBoGDqUCyTKN/DP7eyxxApIY7GsINfCUvl5Jv5UwwwR2ui4r jTJ47misY8q0GdBf9SWGRqf6HUrJVUUQSyqvrnM0nQjNUlkbJh3UVfhc/btTE/CU0SWq cusNXRkgi0lQKtqZ+3Ei1j77E1Q/8yzAYBfMQjY4OSSub7eREwHz5pcWeRq11qRFxRIV NPNqqaa+hVuJng5849F7DjMjyUJPyV8oAaKwzzMCUpT8QBazxBWdd1QS42dfMMq+fp64 WbX1gGajuBkZyUmLmf/nwO0VjPkpNqFR1d6MGD8PLuSwRggtchNZPnw6/MjAQtGjyC6S i9Cg== X-Forwarded-Encrypted: i=1; AJvYcCXNtV+KCN2AlCe556KEGz6c/f2BjQ+1WsjCH8dU0hJdLcFkx/D3lyyHg/ZTrCuelofI39S8kMDfG0K4S4oMbCrBwZw= X-Gm-Message-State: AOJu0YxYJq3vVakreU8R1rxkxT815YCYWi095HqnW5mgMwSUmY9RUU7m t2TMyo4Pv7od7liVIad7v/tf9tkSSuU3oPiAilLvKjAlbrxvc4ezgi8MlEMsM6JRI3C/qnX2L7L emkbOZLyeoQQ0uWQSk4rj71N6JL7XVrmx0nLkBnz39veWNmhP X-Received: by 2002:a05:6214:5817:b0:690:dcc8:6149 with SMTP id mk23-20020a056214581700b00690dcc86149mr878971qvb.4.1710167730553; Mon, 11 Mar 2024 07:35:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDFZwfaCB4HAsZiRTNH9ThEFmAZ+oZRyottgFXIagCv5O/Cci8Kk03bGXgk6z75P4DZjUV5g== X-Received: by 2002:a05:6214:5817:b0:690:dcc8:6149 with SMTP id mk23-20020a056214581700b00690dcc86149mr878939qvb.4.1710167729947; Mon, 11 Mar 2024 07:35:29 -0700 (PDT) Received: from x1n (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id w3-20020a0cf703000000b0068f75622543sm2729017qvn.1.2024.03.11.07.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 07:35:29 -0700 (PDT) Date: Mon, 11 Mar 2024 10:35:27 -0400 From: Peter Xu To: David Hildenbrand Cc: Mirsad Todorovac , linux-mm@kvack.org, Andrew Morton , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Axel Rasmussen Subject: Re: BUG selftests/mm] Message-ID: References: <4a5c8d28-7f73-4c15-b288-641f0ccc91c2@redhat.com> MIME-Version: 1.0 In-Reply-To: <4a5c8d28-7f73-4c15-b288-641f0ccc91c2@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Queue-Id: 378011C000D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 5x5d5ouar7cwjoiw5b9ri9sgcrcbud3y X-HE-Tag: 1710167732-230487 X-HE-Meta: U2FsdGVkX18CsEVVDRZUCHBaWMfgvzI1pN5oyZtU0Tl4U74Kjc0gDCvgeChafA26U7CbpDZ/P8eV+cb4ngNxBt3E6AfsHs5tCW7aSj4laufYR/XngPzcK1bsbGrMvRUbHz37eY1Kx4amRpOgstFxg3mLChppTFloBnF7BZjnY0RuIuGIAfYm56s9q5FD9J22zkhnVlSQLA1pcbLsLAC8zfSYhGlkMU5iUtms/IYfXQrvK1yurwdSlhamgI3UWEmgvFldInvVTIonT/wxU/ZXzjeCBLOkdC+2QpYyVUiepQ7h0OsgHEv22Vui1Bh5tJavYGD5Hdei5EDnLxugscqz18W9Yu5DPkZoc9Zy1+V37Zh1Qo7bGLJ+v+RfkZhCDPPDIdvEhqCpK83UFxEoHfzHmcWMv3f/048+6VE0ypZ6ty8EnZ+HzcCW1XKwLASAmeHC2x0Hq+V1TxfwBEF4m1acDgrWmDWzpjSd5R/xETmw08AyPVabH096cA8+4irOHbYbhPeHBHCNKvfQlADPkVGsGv6Deqrgi2LbLrtt+ZRCvigWVG4F7NlqnqjYfuwWzEPCSqwoUZahQP5KqdV6jAMXZqt04+9xUzc2XeCjYdm11sT0mtm+ZNuPTEJwx38SXjTqfGC8OQjB+NpCTZ6BGikeMNPut3WCHvDa5gmrZeD+4SEN8FfubumZqpfTwPVn+PKEy3tCO1e18caP9S+z8gBFOAopgavvJP8Gesn8Ka080X8y+lgDZiTvOHeilJtKN/WgeR8oCbBTXN55fw7Sqe4rjMB8juFPcgRmwpdMqIX1sAwVm9D8eCG8ttL0INC0P4BJeUnRCXMklZ5x1HqEiHLy0jdjNmgk8VDVvkmxlT6hqd09cwUonS0v/la+czb4JHs9TwfFaXKk7iJxINF5k/vvgHdVxrtnPTRvRY/Bi0Yz/LBvof/IO+N+JI655crNvUgNtydaapMLN1yzMJOgK+f bdJ/agdK jpq47pJZBptZ38UIFhijaF0FYoXho8MtOtDuzTMOFZLuvKuT42TkUwnljA5vWYreogoNsush6nhEg5f5zaW/aWIC9fA== 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: List-Subscribe: List-Unsubscribe: On Mon, Mar 11, 2024 at 10:31:41AM +0100, David Hildenbrand wrote: > On 09.03.24 20:12, Mirsad Todorovac wrote: > > Hi, > > > > Routine run of the test in net-next gave also this mm unit error. > > > > root@defiant:tools/testing/selftests/mm# ./uffd-unit-tests > > Testing UFFDIO_API (with syscall)... done > > Testing UFFDIO_API (with /dev/userfaultfd)... done > > Testing register-ioctls on anon... done > > Testing register-ioctls on shmem... done > > Testing register-ioctls on shmem-private... done > > Testing register-ioctls on hugetlb... skipped [reason: memory allocation failed] > > Testing register-ioctls on hugetlb-private... skipped [reason: memory allocation failed] > > Testing zeropage on anon... done > > Testing zeropage on shmem... done > > Testing zeropage on shmem-private... done > > Testing zeropage on hugetlb... skipped [reason: memory allocation failed] > > Testing zeropage on hugetlb-private... skipped [reason: memory allocation failed] > > Testing move on anon... done > > Testing move-pmd on anon... done > > Testing move-pmd-split on anon... done > > Testing wp-fork on anon... done > > Testing wp-fork on shmem... done > > Testing wp-fork on shmem-private... done > > Testing wp-fork on hugetlb... skipped [reason: memory allocation failed] > > Testing wp-fork on hugetlb-private... skipped [reason: memory allocation failed] > > Testing wp-fork-with-event on anon... done > > Testing wp-fork-with-event on shmem... done > > Testing wp-fork-with-event on shmem-private... done > > Testing wp-fork-with-event on hugetlb... skipped [reason: memory allocation failed] > > Testing wp-fork-with-event on hugetlb-private... skipped [reason: memory allocation failed] > > Testing wp-fork-pin on anon... done > > Testing wp-fork-pin on shmem... done > > Testing wp-fork-pin on shmem-private... done > > Testing wp-fork-pin on hugetlb... skipped [reason: memory allocation failed] > > Testing wp-fork-pin on hugetlb-private... skipped [reason: memory allocation failed] > > Testing wp-fork-pin-with-event on anon... done > > Testing wp-fork-pin-with-event on shmem... done > > Testing wp-fork-pin-with-event on shmem-private... done > > Testing wp-fork-pin-with-event on hugetlb... skipped [reason: memory allocation failed] > > Testing wp-fork-pin-with-event on hugetlb-private... skipped [reason: memory allocation failed] > > Testing wp-unpopulated on anon... done > > Testing minor on shmem... done > > Testing minor on hugetlb... skipped [reason: memory allocation failed] > > Testing minor-wp on shmem... done > > Testing minor-wp on hugetlb... skipped [reason: memory allocation failed] > > Testing minor-collapse on shmem... done > > Testing sigbus on anon... done > > Testing sigbus on shmem... done > > Testing sigbus on shmem-private... done > > Testing sigbus on hugetlb... skipped [reason: memory allocation failed] > > Testing sigbus on hugetlb-private... skipped [reason: memory allocation failed] > > Testing sigbus-wp on anon... done > > Testing sigbus-wp on shmem... done > > Testing sigbus-wp on shmem-private... done > > Testing sigbus-wp on hugetlb... skipped [reason: memory allocation failed] > > Testing sigbus-wp on hugetlb-private... skipped [reason: memory allocation failed] > > Testing events on anon... done > > Testing events on shmem... done > > Testing events on shmem-private... done > > Testing events on hugetlb... skipped [reason: memory allocation failed] > > Testing events on hugetlb-private... skipped [reason: memory allocation failed] > > Testing events-wp on anon... done > > Testing events-wp on shmem... done > > Testing events-wp on shmem-private... done > > Testing events-wp on hugetlb... skipped [reason: memory allocation failed] > > Testing events-wp on hugetlb-private... skipped [reason: memory allocation failed] > > Testing poison on anon... done > > Testing poison on shmem... done > > Testing poison on shmem-private... done > > Testing poison on hugetlb... skipped [reason: memory allocation failed] > > Testing poison on hugetlb-private... skipped [reason: memory allocation failed] > > Userfaults unit tests: pass=42, skip=24, fail=0 (total=66) > > root@defiant:tools/testing/selftests/mm# grep -i huge /proc/meminfo > > > > It resulted in alarming errors in the syslog: > > > > Mar 9 19:48:24 defiant kernel: [77187.055103] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 4631e000 > > Mar 9 19:48:24 defiant kernel: [77187.055132] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46320000 > > Mar 9 19:48:24 defiant kernel: [77187.055160] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46322000 > > Mar 9 19:48:24 defiant kernel: [77187.055189] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46324000 > > Mar 9 19:48:24 defiant kernel: [77187.055218] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46326000 > > Mar 9 19:48:24 defiant kernel: [77187.055250] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46328000 > > Mar 9 19:48:24 defiant kernel: [77187.055278] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 4632a000 > > Mar 9 19:48:24 defiant kernel: [77187.055307] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 4632c000 > > Mar 9 19:48:24 defiant kernel: [77187.055336] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 4632e000 > > Mar 9 19:48:24 defiant kernel: [77187.055366] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46330000 > > Mar 9 19:48:24 defiant kernel: [77187.055395] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46332000 > > Mar 9 19:48:24 defiant kernel: [77187.055423] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46334000 > > Mar 9 19:48:24 defiant kernel: [77187.055452] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46336000 > > Mar 9 19:48:24 defiant kernel: [77187.055480] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46338000 > > Mar 9 19:48:24 defiant kernel: [77187.055509] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 4633a000 > > Mar 9 19:48:24 defiant kernel: [77187.055538] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 4633c000 > > Mar 9 19:48:24 defiant kernel: [77187.055567] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 4633e000 > > Mar 9 19:48:24 defiant kernel: [77187.055597] MCE: Killing uffd-unit-tests:1321817 due to hardware memory corruption fault at 46340000 > > > > At this point, it can be problem with my box's memory chips, or something with HUGETLB. > > > > However, since the "classic" allocations were successful, the problem might be in huge pages, or > > if I understood well, in deliberate poisoning of pages? > > > > Isn't that just the (expected) side effect of UFFDIO_POISON tests? > > IOW, there is no problem here. We are poisoning virtual memory locations > (not actual memory) and expect a SIGBUS on next access. While testing that, > we receive these messages. Correct. > > The "ugly" thing here seems to be that we can trigger repeated pr_err() from > user space. There is no rate-limiting in place. Maybe UFFDIO_POISON requires > root permissions so this cannot be exploited by unprivileged user space to > flood the system log? > > CCing Axel This is pretty unfortunate. I'm not concerned too much on flooding whoever kicks off the selftests, but indeed this seems to be able to be used by anyone to trigger such endless reports in dmesg. The issue with requiring a privilege means any hypervisor that will need to use this to emulate memory errors will also require such privilege, and it can be a problem. Logically such "hwpoison errors" are not real so it is not needed to be reported in dmesg, but now we're leveraging it to be exactly the same as a real hw error to share the code path, iiuc (e.g. on MCE injections). One option is to use a different marker reflecting that such hwpoison error is internal, so we don't need to report in dmesg. That'll also require (besides another bit in pte markers) one extra VM_FAULT_* flag just for such reports. Might be slightly an overkill, but I don't see another better way; not reporting HWPOISON will complicate at least kvm use case even more. Or.. does syslog has its own protection in general for such printk floods? It'll be easier if that's not a concern to flood then, but I'm not sure from that regard. Thanks, -- Peter Xu