From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr2-f2.google.com (mail-wr2-f2.google.com [74.125.225.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6663479889 for ; Thu, 6 Aug 2026 15:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786028483; cv=none; b=sZaoFt6w4jgiE2jax1L7Ya22Gr/0FEC3/1NhEZdPK73aXws5BZsGSUK+Q0dVYOgZ4awsuRxes57sxz7UGTFTdIqsa9hrOqXos+QMiRsgT1eZDGv9WVn3N7/oK0M5MjFGt1WirPC8pnrRFFnaM6olKiXtdqKO+43dLZ/KhTK3JBk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786028483; c=relaxed/simple; bh=Y99ilbLrRENRwJW/P4xjAwZSFPBHEC9V6LB/IkSVoe8=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=kOTBgflnxcFlIB6FKD1RW6hHaNgCBGvQG4kr1YLDeof7LA+6/ijz7gSw42hcDRIgCcjNt5H/pvebdBUPXfpqoWVXyGDRNL+KN/h5L2NVfTUPi8NeSXXKU+WeTF14M1xiKI+nl/S9dIo7DgyuRUwnkbJcvUf49nv9CA/90tdeeWM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P+oBtx4j; arc=none smtp.client-ip=74.125.225.66 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.b="P+oBtx4j" Received: by mail-wr2-f2.google.com with SMTP id ffacd0b85a97d-473ba029526so321378f8f.0 for ; Thu, 06 Aug 2026 08:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786028480; x=1786633280; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=dioGFzjSs7KaCLGjqP+oJJAaenl4kyHQ52JQwiLek4Y=; b=P+oBtx4jbjDsnp764e/9NP0YE7aPqkGqrINCFmGDwQf1tKB2guJqb1etCjsWADYoMz Jitx7iSr9hFEX1/Ns5Vovq8cnOBMFM5PYqCPtY8SYTDRmP5/Fhn5oRWCxI+KgknvQcL4 p+bNmEbzVIY6h+PW3qedOqrctG/FAzveTSRElwj+qzRSCDr9EcyYh39BVFYY6/yU6H0I cJCdo9TB0jZZ2uP+i2RuQ7VGG2up/o8HQlt3Oe2mCCiF1U3QbqH3FGpbgJQu5HVFEs2s NsBoB7p5YeLpViQAfDbmLXPnQxGzgaliKhwVLDa3G4xDaSdjhG4+KRD7VwUah7FQwce8 ltZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786028480; x=1786633280; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=dioGFzjSs7KaCLGjqP+oJJAaenl4kyHQ52JQwiLek4Y=; b=KlPRWQYcNbLGDc28JFD3e3h/z1lvT9p/8twoYpbGnlAkVfAJ2De5BqzvXbFoDjrYVP ugcRlXef2ZLpuu41L+wxfMzaPG8zJ0kqmQmmeY1H80pOtSYFCCOEGp9EvU3/hj8ctV1B SXplXinhyWyNTAz7C5FvHvcmgw4Np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1eca with SMTP id ffacd0b85a97d-47ff8584853mr6549157f8f.1.1786028479664; Thu, 06 Aug 2026 08:01:19 -0700 (PDT) Received: from localhost (nat-icclus-192-26-29-3.epfl.ch. [192.26.29.3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47ff79b819dsm7067045f8f.16.2026.08.06.08.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 08:01:19 -0700 (PDT) Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 06 Aug 2026 17:01:18 +0200 Message-Id: Cc: , Subject: Re: [PATCH bpf-next 0/2] bpf: Track overlapping RCU protection From: "Kumar Kartikeya Dwivedi" To: "Ning Ding" , X-Mailer: aerc 0.21.0 References: <20260805233940.3966981-1-dingning04@gmail.com> In-Reply-To: On Thu Aug 6, 2026 at 11:32 AM CEST, Kumar Kartikeya Dwivedi wrote: > On Thu Aug 6, 2026 at 11:13 AM CEST, Kumar Kartikeya Dwivedi wrote: >> On Thu Aug 6, 2026 at 1:39 AM CEST, Ning Ding wrote: >>> Preemption-disabled and IRQ-disabled regions provide RCU protection, bu= t >>> the verifier does not account for them. Current implementation can inva= lidate >>> a task kptr while another RCU source remains active, or keep it valid >>> after the final source ends. >>> >>> Track these regions and invalidate RCU-protected pointers only after th= e >>> last protection ends. Add task kptr tests for overlapping protection an= d >>> final-exit rejection. >>> >>> This follows review of the applied spin-unlock fix series [1]. >>> >>> Tested in QEMU/KVM: >>> ./test_progs -t task_kfunc >>> ./test_progs -t preempt_lock >>> ./test_progs -t irq >>> >> >> Overall, looks good. There are various failures in CI, so you might need= to >> update or adjust existing selftests. >> >> Make sure to include selftest changes for _existing_ tests within the ke= rnel >> commit making changes, so as to preserve bisection. Your extra tests sho= uld >> still go in a separate commit. >> >> Also, do we need that was_in_rcu_cs logic for bpf_spin_lock(). Would it = be >> possible to drop it and do it the same way you've done it for other case= s? >> If that makes sense, I would fold that cleanup in the first patch as wel= l. >> >> https://patchwork.kernel.org/project/netdevbpf/patch/20260805233940.3966= 981-2-dingning04@gmail.com >> >> pw-bot: cr >> > > I think from cursory look, the reason is that we forced any MEM_RCU point= er to > be invalidated before, even when program wasn't sleepable, which does not= happen > now. The failing test used a non-sleepable program. So making it sleepabl= e should > preserve the failure case. In some ways, this is probably an improvement = over > current behavior. > I fixed this up since it was minor and applied the series. Thanks. >>> [1] https://lore.kernel.org/r/20260803112615.3362122-1-dingning04@gmail= .com >>> >>> Ning Ding (2): >>> bpf: Account for preempt and IRQ state in RCU protection >>> selftests/bpf: Test overlapping RCU protection >>> >>> kernel/bpf/verifier.c | 13 +- >>> .../selftests/bpf/prog_tests/task_kfunc.c | 6 + >>> .../selftests/bpf/progs/task_kfunc_common.h | 2 + >>> .../selftests/bpf/progs/task_kfunc_failure.c | 49 ++++++ >>> .../selftests/bpf/progs/task_kfunc_success.c | 147 ++++++++++++++++++ >>> 5 files changed, 214 insertions(+), 3 deletions(-) >>> >>> >>> base-commit: 11c1e836710dcba03e50454a4eedfdbaf8d3050e