From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.155 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796203099; b=AxUwsAy5p44+KJbVTh0hDD99aRULFkp20xBxuBMlHJITivpJgZWqGthiImgMywBoHDnm WJcgYJbCwN0qSF3FKdDEHGGjJ/zhwsI68PyGlxPPnuqZS3otfyi4VnWggw4DIQfAYpmk3 v7SivWSm3/sti+2GAfE8rmVMewwmMm+4MhdCct0fB7Qqt/S5Gv0ff+Fuwzv8npKuxGZPR n3Ga3iInSgLrdSrFfYY9/DOs59jGniP+JkDkDTc87gJMrIJS/wSo0qZEclN/MhOMlZmzb ndGYr4I19vA3lInzosFcOJbQQUiItUbazQen4KPpPhIlqid/iSKiYrIYbnRd5HmPSHQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796203099; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=1dpd+h3v67MuI0pCP5rrVwr/tdG08KcecGCn0XaXchE=; b=wznEsTfVaNS4J/6q/fdwjXiSb31GjVMS0gB0jh77GupU+rY/eUXJcxNJ1qMXSf+Y3PQm nx2zCJL4ZMllYGC5KmT0bNweRVNIhVBOfaN7oMK989yaGjKgHbID2achjPFZuwTgSEeLq HPMFribNAyUe7PaL2ceALB9JgJw3PGQURkFurzHkLL4WRq3MaFueizyv/Bph6i4sHY/jK 0p5kjVd6W+gUGVysqeeHramoLP+ZPX2bHCI/dgMgDE2sE4a0fWb071XA+jQ/zzgB0Lp0p JCoILDFj4lEmqZEyrjSNh2R8GtrdMguackQe87YwKPPgK2nX5tNc/jf8mPkqe99m3zg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OgoyPjhU; arc=none smtp.remote-ip=91.218.175.155 Received: from mta0.migadu.com (out-155.mta0.migadu.com [91.218.175.155]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF615606A333 for ; Wed, 2 Dec 2026 09:18:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EF615606A333 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, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OgoyPjhU X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=IzSZWm7Wsu8iTNABVGK8ZuhxwFuIAf44eIOdZsGemik=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796203092; v=1; x=1796807892; b=OgoyPjhUJro3K4QNaLG0xVslLfFVlbxzXKzLN3QIz/8+QvOcxYIYEm7+fuXqrZycXo9JD2fJ gxKHfCn+NKriN22DRorx2QChtktmB4FM+5DjTBvHiAe8L/E/0djpbGuTAj3hiKOCUnA+GZr/rdv vJ0X+TOia7EwZdfuKBC6yHQs= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id c4356e40bd8d6ec5; Wed, 02 Dec 2026 09:18:11 +0000 X-Mizu-Trace-ID: c4356e40bd8d6ec5 X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Dec 2026 17:17:56 +0800 From: Hangbin Liu To: Murali Krishna Cc: Manivannan Sadhasivam , Shuah Khan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2] selftests: net: add tests for the QRTR socket family Message-ID: References: <20261201104515.45339-1-muralikrishna2444b@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201104515.45339-1-muralikrishna2444b@gmail.com> Hi Murali, On Tue, Dec 01, 2026 at 04:14:15PM +0530, Murali Krishna wrote: > net/qrtr has no test coverage in tools/testing/selftests, although the > behaviour it exposes to userspace is well defined and testable without > Qualcomm hardware: the local node always exists, and CONFIG_QRTR_TUN > lets a test act as a QRTR endpoint. > > Add tools/testing/selftests/net/qrtr with two programs. > > qrtr_sock covers the AF_QIPCRTR socket contract: the ephemeral port > range and the CAP_NET_ADMIN boundary documented above > qrtr_port_assign(), the bind() rule that an address must name the > socket's own node, rebinding (which moves the port and releases the old > one), EADDRINUSE on a taken port, auto-bind on send, and local datagram > delivery including the source address reported to the receiver. > > qrtr_endpoint covers frame validation in qrtr_endpoint_post() by writing > crafted frames to /dev/qrtr-tun: length alignment, unknown protocol > versions, headers truncated below the v1 and v2 minimums, a zero or > over-long declared payload size, a size that disagrees with the frame > length, control types whose payload is too small to hold a struct > qrtr_ctrl_pkt, control types addressed to an ordinary port, and the > legacy 16-bit control port number. Each rejection test malforms the > frame in exactly one way, so a failure names the check that regressed. > > A rejection on its own is weak evidence, though, because > qrtr_endpoint_post() reports every failed validation check as -EINVAL > through a single error path: a frame can be refused for a reason the > test did not intend. control_type_to_normal_port therefore binds a > socket to the destination port, so that qrtr_port_lookup() cannot be > what fails, and data_to_normal_port shows a DATA frame to that same > port being accepted. > > Header fields are written with htole32()/htole16(). > qrtr_endpoint_post() takes the protocol version from the first byte of > the frame and decodes the remaining fields with le32_to_cpu() and > le16_to_cpu(), so frames built in host byte order would be rejected at > the version check on a big-endian host. > > Both programs skip cleanly when CONFIG_QRTR is not available, and > qrtr_endpoint also skips when /dev/qrtr-tun cannot be opened, so the > suite is harmless on non-Qualcomm configurations. > > The tests were written with the help of an LLM coding assistant, from a > prompt asking for selftests covering the AF_QIPCRTR socket contract and > qrtr_endpoint_post() frame validation. Both C files and this changelog > were drafted that way, then reviewed, corrected and run by hand. > Writing them corrected two assumptions about the interface: that bind() > treats sq_node == 0 as "any node", and that rebinding an already bound > socket fails. The commit description is too long, maybe shorter it? > > Signed-off-by: Murali Krishna > --- ... > diff --git a/tools/testing/selftests/net/qrtr/config b/tools/testing/selftests/net/qrtr/config > new file mode 100644 > index 000000000..0bdb8a4c5 > --- /dev/null > +++ b/tools/testing/selftests/net/qrtr/config > @@ -0,0 +1,2 @@ > +CONFIG_QRTR=m > +CONFIG_QRTR_TUN=m We build qrtr-tun as a module. If the user hasn't loaded it, the test skips with: no /dev/qrtr-tun: modprobe qrtr-tun, or CONFIG_QRTR_TUN=n Should we try loading it inside the test script? Thanks Hangbin