From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (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 17BB51B800 for ; Mon, 22 Apr 2024 21:14:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713820479; cv=none; b=bov0+le4Z3StefXw4cFgH+ob7CAckVuyjxoSRQMbWv/byeWOLi2r275DpyKoSVunYWBf1qBgoQlwAEEp0OueBbO2PwUMkW19CikWTWp5oi4IVDq4yH7al06EOkd5ky8t2DTDWQcSeMBViRHmww6JPByIKRQLl7FmNCROqAkkvw8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713820479; c=relaxed/simple; bh=cRWZVwE66IktVunkaU/Js89Orpl0ItQMJLYsLnFC5EI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Qg/6T0dBMTREGKjxvoMDaDPyf2SQGR5U7ncwZpgft498GcMrV7CUK+p/LXIJ7ve23IIe3f9mr/M24g9VbOXBbZQoVMLKMJ+nQAM4sIzKdo+CB42HJNHsanh5BX4TOVrYQ7uyawbl5ipf3XqNHvRaQPLtQLdA0dyjKBS8HNW6n40= 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=USQ/LheI; arc=none smtp.client-ip=91.218.175.176 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="USQ/LheI" Message-ID: <8c9e51b2-5401-4d58-a319-ed620fadcc63@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713820476; 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=id/YHTuxfiovFyVUV8xQXCNmiVtMWYMuhwFovv6HFqU=; b=USQ/LheIMQi2h389U2fetydS4vuPWvPxQCTPTXCiOGyzPogVxgMEdizJ9hUrrDENIDnX/p 6QMONIa69osC/0d0S8Fwj3lpbSL/DrquhSwWkBoviUK0Ldoj9HRwgy2i5tIdxLHHRyupWx efcpyH4+CJUr69ZPnKjRGIM55vFzhfo= Date: Mon, 22 Apr 2024 14:14:26 -0700 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 bpf-next 4/6] selftests/bpf: Add IPv4 and IPv6 sockaddr test cases To: Jordan Rife Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , Kui-Feng Lee , Artem Savkov , Dave Marchevsky , Menglong Dong , Daniel Xu , David Vernet , Daan De Meyer , Willem de Bruijn References: <20240412165230.2009746-1-jrife@google.com> <20240412165230.2009746-5-jrife@google.com> <3df13496-a644-4a3a-9f9b-96ccc070f2a3@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 4/18/24 9:37 AM, Jordan Rife wrote: >> The test_sock_addr.{c,sh} can be retired as long as all its tests are migrated >> to sock_addr.c > > test_sock_addr.c has a few more test dimensions than > prog_tests/sock_addr.c currently does, so it covers a few more > scenarios. > > struct sock_addr_test { > const char *descr; > /* BPF prog properties */ > load_fn loadfn; > enum bpf_attach_type expected_attach_type; > enum bpf_attach_type attach_type; > /* Socket properties */ > int domain; > int type; > /* IP:port pairs for BPF prog to override */ > const char *requested_ip; > unsigned short requested_port; > const char *expected_ip; > unsigned short expected_port; > const char *expected_src_ip; > /* Expected test result */ > enum { > LOAD_REJECT, > ATTACH_REJECT, > ATTACH_OKAY, > SYSCALL_EPERM, > SYSCALL_ENOTSUPP, > SUCCESS, > } expected_result; > }; > > We focus on the "happy path" scenarios currently in > prog_tests/sock_addr.c while test_sock_addr.c has test cases that > cover a range of scenarios where loading or attaching a BPF program > should fail. There are also a few asm tests that use program loader > functions like sendmsg4_rw_asm_prog_load which specifies a series of > BPF instructions directly rather than loading one of the skeletons. > Adding in these test dimensions and migrating the test cases is a > slightly bigger lift for this patch series. Do we want to try to > migrate all of these to prog_tests/sock_addr.c in order to fully > retire it? I don't want to keep this set hostage too much until everything is migrated from test_sock_addr.c. As long as for the tests you find useful in test_sock_addr.c in this patch set and moved them to prog_tests/sock_addr.c, it is heading in the right direction. For the moved test, please remove them from test_sock_addr.c so that it is clear what else needs to be done. [ Side note for future migration attempt, at least for the LOAD_REJECT one, it probably makes sense to write it like progs/verifier_*.c ]