From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796128085; b=mXZmHEdPqo0vpZtzeEegQIKzEjY0b43ykUsClJTrpzAElyoLfPRYg54vrfT0NdkLpjlj SC4dgpXB1d+78xVXhWn7QLRUmrp22nbIzsHf4zuV94bVjGd/ohr3gG37Q+YCfLi9xNERi BxY0/XQyM5tcoMpM/I3xAhbeHc9/PuVCW/lPQUHt6f8Cb5JDtPblNydzs4H5nvJyDeByy Xo/y7xeLQzVov8k+Sar+BphKLAqAfeF2mR6QoHOrJiqjqGQC7fIJDKC3mionaU6Z7lE/f +oxOEavXMeBpfnfIxWVu2PWk/dfIZxuKUcLVLkSDCPOj0TP2EEfSGHuoAcWxd/n9/gA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796128085; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Rs7+duUuRM55bCA1KXtlNsObYr/EdSHbUMsbHo6WYfs=; b=PiK2TddMsK/bLjkLmJFSp20U61r/XCBPuZn904bBt4vw4GsU9/wMCZwbw2pWBrb1gjKz 5ZAQutfyTqS310INCik+oU4f83gSJW3ZaagHnis24Z6N3kRpc/b9jEsSVLVpbtJDfAoq0 hMcnnHdTCuJG3SjjOLmpJhxw7Wbze6EYFWMTNVVDcNEc1xgPlSQgzzs3j/XxqcYAJohLj Vnc/k2Jzf7BBcgBOVfjXSQFDnrSob2l1/OmX7gJgQVpTwmFcNVcBtImhq1mzcxvT5Fnus mJFxAY5uKVMmDZVFxAsOiatJlVvFmH9oUKueAgN/wThTp0qwO3BPiyjMtyT+nMf5+Gg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="SmRi9f/A"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DBE4606A331 for ; Tue, 1 Dec 2026 12:28:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SmRi9f/A Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CEB61F00893; Tue, 1 Dec 2026 12:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796128084; bh=Rs7+duUuRM55bCA1KXtlNsObYr/EdSHbUMsbHo6WYfs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=SmRi9f/ACfsgocT4zZJIRdoHqHsW6CXofjb+2AUr/w9mnUGR8wAczzG+HIIaQCcXJ uMKx9fTLEP2jECCCYdbU+iT8ZySN5uo7Bmnkdtvk8AtBKmWcimK+YIn4PqYEGosco7 JjOSIqLvrmm9gG0/I6AfIXMkHijWGHT3jrYhzUXqdbVqZwRir61AcR215mneWdsjzm tgBXCF1uaBEZc1CMDICjX6N6eH+LR7hLf8EZZcgpXxLLrlbzhFhPJzAbt5WVofUN62 68vV/U++7k34+Vmluh+pnem2Dh5RHIsa8rnOIdmDI48nzLICk4TVh7KPGaxHATRro9 thhHlzOjn4Dcw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 3/4] perf bench mem: Add --prot option Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?UGllcnJlLUNsw6ltZW50IFRvc2k=?= Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261201-perf-prot-mte-v1-3-4dc4e1da7460@google.com> References: <20261201-perf-prot-mte-v1-0-4dc4e1da7460@google.com> <20261201-perf-prot-mte-v1-3-4dc4e1da7460@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 12:28:03 +0000 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] perf bench mem: SIGSEGV in do_memcpy() and do_memset() with non-R/W --prot -- commit b56a3ed736613b352b96a30c844d4df11b43ee88 Author: Pierre-Cl=C3=A9ment Tosi perf bench mem: Add --prot option This commit adds a --prot option to the perf bench mem suites to configure the memory protection flags passed to mmap() and gates page loads and stores in mmap_page_touch() on PROT_READ and PROT_WRITE. > diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-func= tions.c > index 92f41820137fb..84247f83da593 100644 > --- a/tools/perf/bench/mem-functions.c > +++ b/tools/perf/bench/mem-functions.c [ ... ] > @@ -63,6 +64,9 @@ static const struct option bench_common_options[] =3D { > OPT_BOOLEAN('c', "cycles", &use_cycles, > "Use a cycles event instead of gettimeofday() to measure performan= ce"), > =20 > + OPT_STRING(0, "prot", &prot_str, "read,write", > + "Memory protection: none, read, write, exec (comma-separated)"), > + > OPT_END() > }; [ ... ] > @@ -376,7 +411,7 @@ static void *bench_mmap(const struct bench_params *p) > if (p->page_shift !=3D PAGE_SHIFT_4KB) > flags |=3D MAP_HUGETLB | (p->page_shift << MAP_HUGE_SHIFT); > =20 > - addr =3D mmap(NULL, p->size, PROT_READ | PROT_WRITE, flags, 0, 0); > + addr =3D mmap(NULL, p->size, p->prot, flags, 0, 0); > =20 > return addr =3D=3D MAP_FAILED ? NULL : addr; > } [Severity: Medium] Does exposing --prot in bench_common_options cause a SIGSEGV in do_memcpy() and do_memset() when the user passes a protection without write (or read) access? mem_alloc() uses bench_mmap() to allocate src and dst for both memcpy and memset, and unlike mmap_page_touch(), memcpy_prefault() and do_memset() unconditionally write to and read from those buffers. Running perf bench mem memcpy or memset with --prot=3Dread (or --prot=3Dnone) faults immediate= ly instead of rejecting incompatible protections or scoping --prot to bench_mmap_options. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-perf-prot-= mte-v1-0-4dc4e1da7460@google.com?part=3D3