From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 929479449 for ; Mon, 5 Feb 2024 03:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707102773; cv=none; b=QEHBJtkEJOyr5FLO2PtQxn1ifhV100E+xVqswd+qBHKGbYwoKLnDB3qSylkuo8Nb709F/PU5XkczG0zwRvsWGOZVU9i8fOxQJQE1skCpRUzb4w6r+HI310jeU+b5Wk/W+Kl2J7NyKjwMzqjfHL58z9hdxWQ6k0ELXx2UBhur6As= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707102773; c=relaxed/simple; bh=j7drw7tN58qOv27MFyGLr1KNJKqcS+zGZDuoiGH+DAo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=C5/I/f/Xaen/fH2VmxB9EP0VSv8s1czA4VYCc+2o7Vjj+4GYffu6K64A/OWiZ+wNhycydsKYdOZjJB7khtAHYEm7F7COzD7Kc1oBpVwnVbpSZ0ZkW5WZt5LM3xW4h9YTMRcEMQPMdpy9ZD55Co+EErQHJaBO7VCtVu6oqBvh/DY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MAylQIpv; arc=none smtp.client-ip=95.215.58.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MAylQIpv" Message-ID: <091fa367-10fa-4380-a0ee-d63a67192c46@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707102769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j7drw7tN58qOv27MFyGLr1KNJKqcS+zGZDuoiGH+DAo=; b=MAylQIpviF4s71LNoJqcTYXzJeyjZKzvPEBWfUisSa2oppu/IF+/Qz8+MgwJL0ZISmVRWd sUILd83nT3KjQBlUYOCr8XBl0qat75OlzdNwlocjT4b1eiw9ZGn0OwKEfYKcQS8wC/CI3G i1+M2cGEa0ErjQUFZFg4pEHpC1I4t54= Date: Sun, 4 Feb 2024 19:12:42 -0800 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v1 1/2] bpf: Transfer RCU lock state between subprog calls Content-Language: en-GB To: Kumar Kartikeya Dwivedi , bpf@vger.kernel.org Cc: David Vernet , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Tejun Heo References: <20240204230231.1013964-1-memxor@gmail.com> <20240204230231.1013964-2-memxor@gmail.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <20240204230231.1013964-2-memxor@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2/4/24 3:02 PM, Kumar Kartikeya Dwivedi wrote: > Allow transferring an imbalanced RCU lock state between subprog calls > during verification. This allows patterns where a subprog call returns > with an RCU lock held, or a subprog call releases an RCU lock held by > the caller. Currently, the verifier would end up complaining if the RCU > lock is not released when processing an exit from a subprog, which is > non-ideal if its execution is supposed to be enclosed in an RCU read > section of the caller. > > Instead, simply only check whether we are processing exit for frame#0 > and do not complain on an active RCU lock otherwise. We only need to > update the check when processing BPF_EXIT insn, as copy_verifier_state > is already set up to do the right thing. > > Suggested-by: David Vernet > Signed-off-by: Kumar Kartikeya Dwivedi Acked-by: Yonghong Song