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 907D9C83F22 for ; Wed, 16 Jul 2025 16:44:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 339636B00B0; Wed, 16 Jul 2025 12:44:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3113E6B00B1; Wed, 16 Jul 2025 12:44:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2273F6B00B2; Wed, 16 Jul 2025 12:44:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 11DC66B00B0 for ; Wed, 16 Jul 2025 12:44:42 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CE0E5B9B86 for ; Wed, 16 Jul 2025 16:44:41 +0000 (UTC) X-FDA: 83670701562.27.59D5489 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by imf20.hostedemail.com (Postfix) with ESMTP id F25FB1C001A for ; Wed, 16 Jul 2025 16:44:39 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=niWmLvxT; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of surenb@google.com designates 209.85.160.170 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752684280; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pr8a/nJOVFR57sghJCiLBSkmwBnZhxckE8XZH1omS8M=; b=TxmJn4kstBhLYj/N+QnljNPPXp6SGYRt0KCV4467o199iBKgRWmaL1YEOD5+KyFes7L2Rx 5qU4M7j8h3kA0StEWtxUIVexZ0+Y5iB8oYdsOc/JMSAVppbfg3RKOmCGIGme0souFQVqA2 7LIdGQDc7rtiNn7DSu+/rlf45akTyP8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752684280; a=rsa-sha256; cv=none; b=1bgNIPE6ykZwwp8OzRnK/yMKuizjBaDB/8BlHV0R1uHUjaq5Pzk9iwi0qrlx8rc75Gus5d B4aJRyY4GvRQN4rKfx9PLE0yppF+o2ClKxER1em+lb+4gdYRFU8eMnfjp73p4sXB3G9Quj 1FZhVAHNSJn15jjKJ9URdNF1uYjtyKg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=niWmLvxT; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of surenb@google.com designates 209.85.160.170 as permitted sender) smtp.mailfrom=surenb@google.com Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-4ab86a29c98so9361cf.0 for ; Wed, 16 Jul 2025 09:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1752684279; x=1753289079; darn=kvack.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=pr8a/nJOVFR57sghJCiLBSkmwBnZhxckE8XZH1omS8M=; b=niWmLvxT05qxGMeLbzVd9qIXBKoIvN9xotcZBLZifXNyOJkWAy0YsKTDV5vwClBkGe vdY0rv3ZbIGVQ1viYwHnVh/7GkB81Z0W64HJMyxHScu9L28caDlZvravSbqWAaahj7r+ xSVa0PwopQ2MAtoaYEWKFsizjTGSI3vzWTfcNjW9AmJxSYkq2/RJKQltSubzRlYg+uPj X4byBAbuaFGGTgeWFxBfFSpVGHVv+VEaBQC+1HK1fptg9zJ+Fx3JWc4Ik1Yac8QDw9eM pa4Db6nzOFBhtwFxBAnyBJ7AuAU+YrQ3geg19/ou/rkk4VTntApnIJkIqTLxsdoZZ9ks vvXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752684279; x=1753289079; 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=pr8a/nJOVFR57sghJCiLBSkmwBnZhxckE8XZH1omS8M=; b=oTO+snAR37WrIzf+Om5ahKqn/dD7I3hhQOXbkQzeyzHW3hdpZWyPf8oFCPZNfnxpxA AG0sP9VoqMGkOtuU0Iq7xmNTyNaBoMYIVhwTEvRfhFXLlVQQ3lZNk6NDrgt4W8dBFsdz psgTPZjJWST9Ry69msKXHVbNCE1wL9bVN47OddgVnnz1NORaMCbd4wrF8EIqeDtZtlkQ vx9ArmQzGFrK+5F0o1gfeJhtb2m4rDGE1qP3XYm1fnltRsAeJ8Vr85YS7BmEekq5tqm3 DGx7wr3gy/SKIzsUYYUOxbRcpSkh21i38RahfuPM7ckDetHGVyvvnpk8WNHcE2EHFXa4 k4EA== X-Forwarded-Encrypted: i=1; AJvYcCUcy9dZ7moncOExSBS8PYdzmYfcW5s1+VtvyO0N8QYlMx6v+2zHl5ZOKJWRkl1bLxS7iKbtgRic5A==@kvack.org X-Gm-Message-State: AOJu0Yx4PHoaYwmHLwaeEemeZOfKLYiwyzsgUS2SoBn6oMPETt8XbevS D2o2pD7+CydtMlxnWU1ZDHsdWH+Uh1p8FWEL0ZMsfl38vBxQY6UZ/zfrCrHNoldAXmQxgPNraRj O5Yr6tTr8EyPX1jNUsx4T7I2RK9nl+U7k1MBHctxz X-Gm-Gg: ASbGnctUxlFysoerlXih03tILF+LmlCPRmHAQmiilPOJbveibF75dGOsSmYrfgMXNaO 1Z/iI9/AC9QkduOuBge80xm/uqA6F1h4a7NY1QtKoi5RsZSsVVDkTH+f+Jvd8PwBNtG5Rrk5RB+ ZyevxeSwdjJuzXroZyhfPrkKTAtrcH2YDir/u3dFY6e62jSZRejSEBYFpd71KZ+M8/B5ap1n9Wp 9/Z6S0CLJbL0RaD+8Or3exaBuK8AxtuDTY= X-Google-Smtp-Source: AGHT+IG+ehUHUArWfJVHAp+OzP5yI34RIUIkLr/x2rq0UCqLebrEaMpW3c9cNGLeH/AY19CGqIu0yi2B1KpZNp4PSHU= X-Received: by 2002:a05:622a:a38d:b0:479:1958:d81a with SMTP id d75a77b69052e-4ab953aab8amr3489301cf.6.1752684278667; Wed, 16 Jul 2025 09:44:38 -0700 (PDT) MIME-Version: 1.0 References: <20250716030557.1547501-1-surenb@google.com> <20250716030557.1547501-2-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 16 Jul 2025 09:44:27 -0700 X-Gm-Features: Ac12FXwMqgI_Oz3q7ppzUAq9TXL2qBpNKmPsgpp-I-Bf07X3_mrNGzIRSlP7_bg Message-ID: Subject: Re: [PATCH v7 1/7] selftests/proc: add /proc/pid/maps tearing from vma split test To: Lorenzo Stoakes Cc: David Hildenbrand , akpm@linux-foundation.org, Liam.Howlett@oracle.com, vbabka@suse.cz, peterx@redhat.com, jannh@google.com, hannes@cmpxchg.org, mhocko@kernel.org, paulmck@kernel.org, shuah@kernel.org, adobriyan@gmail.com, brauner@kernel.org, josef@toxicpanda.com, yebin10@huawei.com, linux@weissschuh.net, willy@infradead.org, osalvador@suse.de, andrii@kernel.org, ryan.roberts@arm.com, christophe.leroy@csgroup.eu, tjmercier@google.com, kaleshsingh@google.com, aha310510@gmail.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X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DP647LUrtuG3+3 MDk5UEx2 yhPjWyaioLrkEK1zibM8hGxPHQRDcsdL82PySpR/LfwA3E+Fzl6vNgIEfQVIntRgJM6UW9wyTmHMXKFFNZucBOJFyZq1QZzleG0pPUUkq0x0bK//WdBLFnEAhTwI74MrIlPvZh6ZxDie7q5zsuQbMSyJA1mNgRD5+NcjiiRz8gZ3Ms5FlwLHT5zbW85Yq/BfA+HnhrsRl7/AL8hFNM2VCOj0z1dZBsl6WIvYn0WQ8/jl/8BbjWxOQMD/78g== 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 Wed, Jul 16, 2025 at 7:20=E2=80=AFAM Suren Baghdasaryan wrote: > > On Wed, Jul 16, 2025 at 3:50=E2=80=AFAM Lorenzo Stoakes > wrote: > > > > On Wed, Jul 16, 2025 at 12:44:23PM +0200, David Hildenbrand wrote: > > > On 16.07.25 05:05, Suren Baghdasaryan wrote: > > > > The /proc/pid/maps file is generated page by page, with the mmap_lo= ck > > > > released between pages. This can lead to inconsistent reads if the > > > > underlying vmas are concurrently modified. For instance, if a vma s= plit > > > > or merge occurs at a page boundary while /proc/pid/maps is being re= ad, > > > > the same vma might be seen twice: once before and once after the ch= ange. > > > > This duplication is considered acceptable for userspace handling. > > > > However, observing a "hole" where a vma should be (e.g., due to a v= ma > > > > being replaced and the space temporarily being empty) is unacceptab= le. > > > > > > > > Implement a test that: > > > > 1. Forks a child process which continuously modifies its address sp= ace, > > > > specifically targeting a vma at the boundary between two pages. > > > > 2. The parent process repeatedly reads the child's /proc/pid/maps. > > > > 3. The parent process checks the last vma of the first page and > > > > the first vma of the second page for consistency, looking for the > > > > effects of vma splits or merges. > > > > > > > > The test duration is configurable via the -d command-line parameter > > > > in seconds to increase the likelihood of catching the race conditio= n. > > > > The default test duration is 5 seconds. > > > > > > > > Example Command: proc-maps-race -d 10 > > > > > > > > Signed-off-by: Suren Baghdasaryan > > > > > > Why is this selftest not making use of any kselftest framework? > > > > > > I'm sure there is a very good reason :) > > It used to be a part of proc-pid-vm.c and after the split I kept its > overall structure. I'll look into using the kselftest framework. > Thanks! > > > > > > > Reading assert() feels very weird compared to other selftests. > > > > Sorry to meta-review via your review again David :P > > > > But just to say tools/testing/selftests/kselftest_harness.h is really g= ood, and > > makes life simple. See tools/testing/selftests/mm/guard-regions.c for a= n example > > of how they can be used - pretty straightforward and avoids a lot of ks= elftest > > boilerplate. > > Thanks for the pointers. I need to figure out a way to pass > command-line parameters to my test. Maybe I can use fixtures for > that... Let me read more about it. Ok, I think I'll use environment variables to set verbosity and test duration. That seems like the cleanest approach. > > > > > > > > > -- > > > Cheers, > > > > > > David / dhildenb > > > > > >