From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060401; b=3e+5yK3Pl2r9KvkjLJKMuYXrMf3WZ7s/y55KB4iWLtJRMje8jvkd2IlVuX1MhYhL+vat i27Htw5LOmxVOyZsEC0F/Pv6I4T+veNrrGRTU9CuWRrTo3bq9wRW85bud3fX2sVGMZfyb ym94LOhQXU8XKrN+3N6ZZ4zuMawIZhbHrkdZTUcoH73NJKiINxq6S0a6DxQ0MXlzuty/Y Baf0rMg2PMgvw7+HmpbMedkKIxD2ql03N1k02tftX/30jUhBL4wpA/CXZ9/OEFD2Hk8bj 2OcFa/4fhvX7BrhXBJFOZrjIJkyUcKgehwdqitetmZ5c56dX4bA8YKNxNR8Bb1cl6rg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796060401; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=s0uxmBONXaQ6HzdTtsm0QEWz+ZSOyaWTRDbVi9l5cqM=; b=ugvspzAUC0WWYyxp3VhwZwEbzs4DWPT9FUeUzOPsRrF/M+HAX9Cz/nUYkiFdsl8fCVr+ fsaYZPlGKx7/ssNi2eXaYhewumh6VYFj5lYRHoNWxhGhE7/IhGLh0MYdH6iO1pw+tDNBt xjniCM69ScgahMERXN/BsH3LoLfrTGUChwLOs4uxJQ6pXgMXlMwKG8X7xUX+er1b/EdNi vM6vFYWyS+WDmb5GeF9yxejDiFbUeLxqwQ69X3SLM0tuqrjR5C6bQRsebKKziWwfG6z2I W/qg4koEbKhvDr5g4I45NxfCTFczCANYGQpjLeWqMDE8+w3Y9dkC80p5XcTsconG7Aw== 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=G+DLTSFA; arc=none smtp.remote-ip=209.85.160.172 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (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 2C62A606A333 for ; Mon, 30 Nov 2026 17:40:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2C62A606A333 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=G+DLTSFA Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-53639b8903bso130989991cf.0 for ; Mon, 30 Nov 2026 09:40:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796060400; x=1796665200; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=s0uxmBONXaQ6HzdTtsm0QEWz+ZSOyaWTRDbVi9l5cqM=; b=G+DLTSFA10Vz/k95hRbrq3V9FQS0qqZKc5eJlIFLXzcl5Y5nIDaSpldEuvzEmBg+DQ Xu8HiiGHF5Lujj5VeUVxE467Vnes34rHaKniuOT/Mz7qGqGORXGmTQ1HIDK+rn9wK4wd 3Z3LwORLXa8+vMhiH3+22ot5S+tcJM+IT9Zh0dq1KBwgolt0HHo88FZlYk2d6R8ME+9m Gf/JiCYMBawiYSLyzdFpJhRS7Wqi6ohvh8IDv9gtRzqMW5NJyTlcws6ZNv6zHj9zYHce kcWG+OobQdzeaS6OqCOUjERu4YTlAecfiKCr0PX2rdoQSGJdyyYyw6eFZ6GonU+omQgC d9ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796060400; x=1796665200; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=s0uxmBONXaQ6HzdTtsm0QEWz+ZSOyaWTRDbVi9l5cqM=; b=BGxren9OpanMBWnMzh8oJrGbqM7WGrBNwYrCiBe2jfHWhCuTIbTbqdson0g8LjRp07 L+ygSo/dIpyMAvO0k0E4QsXUspCY+Ut8kgEqCCQ86I3bhO24K4vSReBE9DP01aHsL6uT BxFnAGGQJiUsLWzBBcw7QNNkfSWR7LZIVylH7HcjEFZEtvB6cBosPRrL4SS9Ad8QVOdf 2wGpo0ucbkQd5M3a7BWcQDD4mq2uEIHesq3VYVsytBFE/G2cC3/up6ESsY++AiCOxYQz CDeXZh4Nm+NeJ031qIyG5pB38FezOH7NurZFZieZs3uqN3uGXSuLuMGqOFvGRxRnOT0K xifg== X-Forwarded-Encrypted: i=1; AL+hErF1N5EkJtP0BPdEnWZjcpxH1FJzdEw3PWiZWI6rXJ6H1ON3FhsyIzXeo7+j50Lofv3/KjWGlPqpfCwOJfc=@vger.kernel.org X-Gm-Message-State: APuU4Z8r7Vfom7/H2ZJxqtv0++9IEopzZpLN0York7scNlq5xyeeKpSW gkd7PW89X1jGj/Llq/E5VSuV6UZWplaYTZIjgL9upC6UZPpATbJTa4jo X-Gm-Gg: AZFdTZfr3HYYyypMw6ATTS4uVxtwuUEhrBNRmnZ2GYofLROo4FUmOvQVWU1JOE876iF da6FRUP7MEWrX28dWuWBtGuTCrtn/tzdLls/+vUcKjnJtrp2SFRk6/Zb24qflKVy9g1VDcl6CoA 5iBa8Vr4wPhaLO8EPdFBHqmKseqs9QhPNDphvkPdSvW3VEDYhxhVmM0uJY3E9ZRzvjrqq5jkBwK oxD9yqeqQtQr6sqbW43dyUon3RtPbk4MpNM6oXPKgV8Z4HpNFVz7h/t1KdzyiRw82pYNCfUuLNY nDtY9i88U8NsCG2NMe1gCoWMItZya+s5T0g/jxzcAzSfkmUXizOuhoP6jQDqX+JQpPVzAwiYyxg KWyTU1QnEdVEAqwjL/7aIo3MNvhPO+QgOl15NG45L06hIx06imKCUftZw17oyNL/ofHOKLEyCOf QFRMVGFigZ6dwZC/KkYD1v00LIoQ25llV1T7UfobGpm7mZScoHfV88B9I/ZptZm/c8OkBNoaMNA ViqYnjZOpVAPYtfJpSnYNzKW4PMfPqMFYUD2ArJgRhqOuuDITtE8X82V4+9DNpM4/nGcD23xuk5 K0WdePXDp7PnpYewKW//u97cCVfiLUhhXxmFn+mLBKGTNleeGx4EWVF/QYFzsLabxDbcXhV/xEr GZdxU X-Received: by 2002:ac8:5d0e:0:b0:535:1d5b:a7fa with SMTP id d75a77b69052e-55d769fe4ddmr638921391cf.14.1796060400001; Mon, 30 Nov 2026 09:40:00 -0800 (PST) Received: from localhost ([138.197.109.108]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d7888fb27sm283476251cf.25.2026.11.30.09.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 09:39:59 -0800 (PST) From: Nikolai Dokutovich To: David Hildenbrand , Andrew Morton Cc: Shuah Khan , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Nikolai Dokutovich Subject: [PATCH v3 2/3] selftests/mm: skip the mkdirty ptrace write tests without FOLL_FORCE Date: Mon, 30 Nov 2026 20:39:49 +0300 Message-ID: <20261130173950.41003-3-ndokutovich@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130173950.41003-1-ndokutovich@gmail.com> References: <20261130173950.41003-1-ndokutovich@gmail.com> 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 Content-Transfer-Encoding: 8bit mkdirty writes through /proc/self/mem into read-only PTEs and expects the kernel to force the write. Under the default CONFIG_PROC_MEM_FORCE_PTRACE policy that is only allowed when the writing task is tracing the target task, which is not the case here, so the setup write fails and the test reports a failure instead of skipping: not ok 1 write() failed Check the permission at the entry of the two ptrace write tests and skip them when it is denied. A kernel built with CONFIG_PROC_MEM_ALWAYS_FORCE or booted with proc_mem.force_override=always still runs them for real, so a genuine failure is still reported. Commit a3907a3169d0 ("selftests/mm: specify requirement for PROC_MEM_ALWAYS_FORCE=y") asks for CONFIG_PROC_MEM_ALWAYS_FORCE=y in mm/config, which applies once that fragment is merged into the kernel configuration; this skip additionally keeps an installed binary from failing on a kernel that was not built that way. The remaining subtests do not depend on the forced write and keep running. Signed-off-by: Nikolai Dokutovich --- tools/testing/selftests/mm/mkdirty.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/testing/selftests/mm/mkdirty.c b/tools/testing/selftests/mm/mkdirty.c index 68dd447a5454..333d450d4ff3 100644 --- a/tools/testing/selftests/mm/mkdirty.c +++ b/tools/testing/selftests/mm/mkdirty.c @@ -91,6 +91,11 @@ static void test_ptrace_write(void) ksft_print_msg("[INFO] PTRACE write access\n"); + if (!proc_mem_force_write_allowed()) { + ksft_test_result_skip("FOLL_FORCE write probe returned EIO\n"); + return; + } + mem = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE|MAP_ANON, -1, 0); if (mem == MAP_FAILED) { ksft_test_result_fail("mmap() failed\n"); @@ -128,6 +133,11 @@ static void test_ptrace_write_thp(void) ksft_print_msg("[INFO] PTRACE write access to THP\n"); + if (!proc_mem_force_write_allowed()) { + ksft_test_result_skip("FOLL_FORCE write probe returned EIO\n"); + return; + } + mem = mmap_thp_range(PROT_READ, &mmap_mem, &mmap_size); if (mem == MAP_FAILED) return; -- 2.43.0