From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796377154; b=2Db6QtalY5jfo/B5lJ+dORcbZ5X/o52hXybz7vj/v63tNcke7JYR6fw+UzrgkTJLy0hO jc5yl/MRgBu5IK0ktznPqArocUgEa2YhtSsEo1yitmGsC4wYC9gEadD/MXjCTFA9Gw8V3 FjQPWP1lVg4JCShz24fEEeK8skk3j4HQ1dt+IMY2o959XIf9gOZZ/0fM/boNDSS6upKco wR7f+/OK89QxB0wiubRW+AGHY4OQbH2mHNoTbTmrHcfDaD1skgbPjrrHoSwYEkgXZeuS+ BlMJUhTT7BIeZxp3SjpxNNbN5e9dVrYIT56axruCwg7RYxkK1m9CM53lPHYuUBbahlA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796377154; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=fcTAFNwI9D/bzvGFgxqJ43r3O7QCzr42aQg52hzCWg8=; b=VYQBwsnHae1ovi90c2k2h3av5wd6ltDypOZRkL4tkqIV6L48FKr14YhPC1QduF+jy+dm QlZjHAbm+jK7yu/mai7Rh4d35RF8F9XcZM4n+sU76h1BijtuRt1CLm48qJD0s/zJwnqRE qnCB9txzpIabyiWovFGaGyPG9cy++e7sN4vgIXNiy4YSRLKnBzgIl38bFAW1TYq+P7ftL WTTmS7gNAK4hcXpIVqyJeYZ69oThnNVGccIuKdo/fwbHQ7yd3jnyM2OTTfzuhmR35dTgu 8SqXkqXOX07lmvJ+vpnS9LSTYejgInGUKRcz4X3VRdV4/00fS9FmM5emeYTmpYy9+MQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hn3hVsCW; arc=none smtp.remote-ip=209.85.128.49 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE741606A32F for ; Fri, 4 Dec 2026 09:39:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DE741606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hn3hVsCW Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4bb64ef5a14so5564385e9.1 for ; Fri, 04 Dec 2026 01:39:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796377152; x=1796981952; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=fcTAFNwI9D/bzvGFgxqJ43r3O7QCzr42aQg52hzCWg8=; b=hn3hVsCWPmpqJOzsOKeGEFdKq8XhZWcWe3kgIUbeJXuOfQopglJxYrABP79qIC/MwH JMT+8wlkRF7RJ4jk0zZmEf9IJpsK+qdcwfNNuq2Wk54rngYc57MFwNTsBKPMAYkQ59cd Bg/Vui4DVxZ0vv3+yMn/+6yTsPPs5frJl6c5drPi5jpcotJsHzl5V02wYT5Fh7i7a9Kk vvGiyPDAXCIq78rxLtHrNcewpS+sNgTJoEcpTrV87P2n60uoZFf4jj8cms1oVxWxIi9+ sSheMGbasW0Mtm7mYutoXDxRzDRC+9RtvaaFu2Iz0/XOpGSfLzCgjxc4kMu8ueUwhp2A 7yNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796377152; x=1796981952; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fcTAFNwI9D/bzvGFgxqJ43r3O7QCzr42aQg52hzCWg8=; b=vnqUjW94twAFzHygDWaBhYXhAur1k9xWkpovusKdgZaszOfpsI7zpWh8ktWRl7oWd1 KaWygHPKF8G1xrxCrY0eHH5ZLwF/17Y27fRdtOTZSJK2g952CEYr7NLbOXHaZqDeavSe zzNyDtxUNluz1Dj0zR8VR8/3MEaIbHPxhPGBZ2V+xHc4FXVVodn11TjginGyG+WOfPzP Og/I1xen2GBVCAHg0X1h2nwG5a3rPQAP8xUpBEN9G1AI2eg7QbI+J7sJ+4AQXOXzLIjK 5uRubs4nFDYKWZUNLdAdyp+BizVVWl1ltGvRNcKHjpFpeeEbssOI9DOjf0SxAeQBsPEK OMvA== X-Forwarded-Encrypted: i=1; AL+hErF/xPpH9Nv2vGaSo5R4k/uEjhv/CtUING1vl7DVdRtd/PQz30kRbSO10AhPPCkd4bmRppmEWM1abhKgdok=@vger.kernel.org X-Gm-Message-State: APuU4Z8wckD2lAh6N0osFmZ52b+kMKpCXiLyW2S4EA3Ir1surq1wEksv OuGRvnqUORMOJ7RiF8Cr4DQwmjaIhjaysm5sUfjA8UxE1Vb+kMaxilnq X-Gm-Gg: AZFdTZdNq5R1u1vLyDf/waTfUD/AqZQLs8VQVE2f7RY/MxPMGhv/COkeySt1nz4Goue 0/I21lMuZuDw+GbeuYevCQl8hYGkSF8o3R5VGPfwPehG5zd2rFS7MZ2Lm7dvrbysglBGLIkf5l7 HnHL7Yv9np7luFQFFUYsoiAVa4z1Cvqf/EUwlQcJOIKvUoyv/EdYzyxoZL18WGvnLmKY+8moOF0 Gy9hSr085Wsc5wgJkumWsJVIhc/1iZq+gFXnDS5QfwA1VxP8uREenp7gujWtbLMDXcVmNgI3yxZ M+p7shMnE2ow8CNd28H7oH4LjZcZNNo4Ry8vpZz0eaVoLpGfZm6rSyJtWfNcPxCc3ksBBuFznaV YYR/lSiPFmC9ypvg95v8NBvmoY2yDpzO4Ilec5jdtQlTRAmI3mlukJmcVV3j//g1+EzPThP00vS GDsBvC4082DV7Xz4/AhQdTTHw2r2cspzqOtjLshUuZVEaHootd0HiAed/HcdYQMUdG2lbXo2hhc q1kgpAsrAA1GeQuZCzHtEnfzygOIdT1Wy+h5W5BvEM3U50AjxvvLnBLI7gg37kHzAKt2eiqxHA7 eBN2uEYYXUrRkYa6sW33HMHUKkzzuXruT1zpmvHvkd7CWydLCfhxujM= X-Received: by 2002:a05:600c:4703:b0:4a2:8c5:5e5 with SMTP id 5b1f17b1804b1-4bbeb8bf3efmr27172405e9.7.1796377152201; Fri, 04 Dec 2026 01:39:12 -0800 (PST) Received: from [192.168.1.22] ([83.231.69.9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbea2aa993sm35425105e9.2.2026.12.04.01.39.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 01:39:11 -0800 (PST) Message-ID: Date: Fri, 4 Dec 2026 10:39:10 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 4/4] selftests/mm: free the test context when uffd_test_ctx_init() fails To: "Mike Rapoport (Microsoft)" , Andrew Morton , David Hildenbrand Cc: Peter Xu , Suren Baghdasaryan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, Sashiko References: <20261203-fixes-uffd-sashiko-v2-0-308ce557a7b6@kernel.org> <20261203-fixes-uffd-sashiko-v2-4-308ce557a7b6@kernel.org> Content-Language: en-US From: "Jose A. Perez de Azpillaga" In-Reply-To: <20261203-fixes-uffd-sashiko-v2-4-308ce557a7b6@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/3/26 6:15 PM, Mike Rapoport (Microsoft) wrote: > uffd_test_ctx_init() returns on errors without unmapping the test areas > it has already allocated, and userfaultfd_open() leaves the userfaultfd > open when UFFDIO_API fails. uffd-unit-tests then skips the test and goes > on to the next one in the same process, so everything allocated for the > failed test stays around until the end of the run. > > For hugetlb, the leaked areas keep their huge pages reserved, and the > following hugetlb tests can fail to allocate their areas and get skipped > with a misleading "memory allocation failed". > > Unmap the areas allocated so far when uffd_test_ctx_init() fails and > close the userfaultfd when userfaultfd_open() fails. > > Reported-by: Sashiko > Closes: https://sashiko.dev/bug/linux-3a91f55a-ede8-4950-bbda-cd0b03f9076a > Fixes: 1c8d39fa7b63 ("selftests/mm: call uffd_test_ctx_clear at the end of the test") > Signed-off-by: Mike Rapoport (Microsoft) LGTM: Reviewed-by: Jose A. Perez de Azpillaga -- cheers, jose a. p-a