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=1796504586; b=rS2zaoIbsQvSiqi+3/lHSPcqAdnqdMkPABemg687nsWpbiiuRbBJfrRYFuC4MVAkXALd gKbX6fXvciwlV9k01xSuvVBigde+BMcLwOJCL2F5457DEwWEWt+TrVX43dc1mF3VnCPcF 4/BrOOVudfU/E7n8eaqsXjbUgwRs/k0nBZsn4eEEXMGzeEQxDVgp1YmXYbXB+Jfh8/4Hr Iz9mtnGA+wspKVEF+6eI7e4uB38/+I1xDm4DTfc/fGRv6kotmQLzEPngeldM1qcg5Z2B6 7pDUD6sIXmEqyljwlyW+6G6PI2JCLEY+FzZ4oOwUvYoXcsEN7T+YTD2AH8F6D2VMTSg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796504586; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=QIVANsTp/UzYbe+/EykWYUA0+2I+laoYoRZ9zT1cJOk=; b=uRDaduORKNBTQLzpKe/83U8gGG0Ya6311c+HV8NZ4UExCFqTCvfyZUgQbuPYvQunq4Z7 Iai0x+H7YGfqHKaRsXjlQyZXAhg4O0uhmaU8TXKjeMkknhNEJ7YD9I00qEXlIBpjdZm/2 uiPxaRiC+pxAk+NBc+Rt9JVxdnd8TebzrO7hjNUWtra2IDo186VqoImx+kyUW/6OfjbsO bVOuOzMXs4Oxen3Bt7usclaoKVDfuZAb3HNDPMuawjiIvLlS8oGgnEg0Rs4lawt2nTvxh STqfltc1maCK0O9zIXIe3bXSyMXiOASgvZkbiURzJRFo6SBeZE+6oqP2ZyPSQni0ETQ== 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=RIFy4pAN; 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 7FB94606A31F for ; Sat, 5 Dec 2026 21:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RIFy4pAN Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A08F1F00A10; Sat, 5 Dec 2026 21:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796504586; bh=QIVANsTp/UzYbe+/EykWYUA0+2I+laoYoRZ9zT1cJOk=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=RIFy4pANQ5I2xyGh7HmgDY/F+J9ItXndeSZPDwkVjZFrnW+/Ecj0MQ+f0dyzFpHWJ SA7/98Lj8Vq+mkLUI6dINF3uv+gdTJJIBxp+t8YKX2fa0QdHNHHT4dzKj8lz6fRS91 jOydmMEo4GkptsXIecERji5vFhfbcOD+eZJcYQMkB7gp6JopjDja8q7yuY5YfazhHr +vcxdDoV4t8WD/uo6uCSxFBs7mjW75SCYojgYkM4RTRHWO23FFvxJrO96kpKKXIG6+ LlCCrfgIg5r+OvT3MGX9Bt0okIlc8c2LgJGroMdw1OOihjWcZIga4EZF5IT8jAk07w nJXc7GuHoc8FQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH bpf] bpf: Order map writecnt against frozen for read-only maps Reply-To: sashiko-reviews@lists.linux.dev To: "Zhenwen Liang" , bpf@vger.kernel.org In-Reply-To: <20261205204758.954959-1-zhenwenliang@google.com> References: <20261205204758.954959-1-zhenwenliang@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 21:03:05 +0000 X-Mailing-List: bpf@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: - [Low] bpf: inaccurate commit message claim that RWC race needs both reorderings -- commit ac10bb0a7f54106e48572a1161df774277051ed1 Author: Zhenwen Liang bpf: Order map writecnt against frozen for read-only maps This commit adds smp_mb__after_atomic() to bpf_map_write_active_inc() and smp_mb() to bpf_map_is_rdonly() to order accesses to map->writecnt and map->frozen on weakly ordered architectures. Link: https://lore.kernel.org/all/20260707195600.5C2851F000E9@smtp.kernel.o= rg/ [1] > guaranteed to be exactly the same at a later point when the program is > executed". It needs both reorderings at once and was not reproduced. [Severity: Low] Is it accurate that this race requires both reorderings at once? With three CPUs (updater, freezer, verifier), either reordering alone lets the updater see frozen =3D=3D false while the verifier sees frozen =3D=3D t= rue and writecnt =3D=3D 0. For example, if only bpf_map_is_rdonly() reorders its reads while the updater executes in program order: CPU0 (updater) CPU1 (freezer) CPU2 (verifier) read writecnt =3D=3D 0 (reorder= ed) writecnt =3D 1 smp_mb__after_atomic() read frozen =3D=3D false frozen =3D true read frozen =3D=3D true Symmetrically, if only the updater reorders reading frozen before incrementing writecnt, the same outcome occurs even with smp_mb() in bpf_map_is_rdonly(). Because either reordering alone triggers the race, both barriers are strictly needed; saying both reorderings are required could mislead readers into thinking a single barrier on the updater side is enough for other readers such as bpf_prog_verify_signature(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205204758.9549= 59-1-zhenwenliang@google.com?part=3D1