From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.91 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796203098; b=aK4x3pJ37JDBTQ5z3/lTUDyQnQi95Mm0fWmEF/y7fWeBXSvBfPAX7ADc/i+A+5wuGzWK jktYDcDJT56pgOKwgXCZGa7FUoFzdA7Lk583Ua0Ywd7JTZGPJaNBJlYW95g45VdNi5of+ JeucbSFGK47jqd0rvjNDsFukDMG5LLb6r9JrKifgYHpdzzusbcrz37CKgWXsPI++BJ5wJ iuArSQxc41nzdhiauTCB6C+AtlaahQpJetrDB3XJElrS0etQlt430URhh1+j13zlbsRVZ o6l3RLZ/X01FAE4LmO1k28iLR/2NA1d06fWrt4bpDYpL6T1tVhwGEs4wW5+SuC7LObw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796203098; 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=xAlbYyMCzv3wFzTamac5nMgiTEO1xjj40SHlmDCQUvLiieW/ap0NTKSOFUMNPdU2Cyto 1rbGfcZ+JI5X7cCYTOVXz6dsSXs+BpZq+ZrtpLqiERgDcPzaIG/miWYYeO8BA+DeNwr4J I7ySJivQH+MQHvgj5DQc66GiPdQBZ1I0SkX6JMP09XgTCod2a2V56mO/Bxx7chTdWuZ2m iYRZtzclTmoVtdLtDTkojXdHaGkqMEIp/9fgaYzKMqz/FZmcRjHr5eYo/3HC0N7/9UJqZ WKn504+EKsu6c/wLz0TflibX6NMr+4NH0xBz167AGRHBkuMLMHuGAcpLATdU3Au7Zkg== 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=EVYbtPuw; arc=none smtp.remote-ip=95.215.58.91 Received: from mta1.migadu.com (out-91.mta1.migadu.com [95.215.58.91]) (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 15074606A31A for ; Wed, 2 Dec 2026 09:18:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 15074606A31A 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=EVYbtPuw X-Envelope-To: linux-kselftest@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=1796203095; v=1; x=1796807895; b=EVYbtPuwz/2JwyByqr9hLZa5xb/2jXZ7mbeZ07iaas2vb+R1y29XnM5S91e2ouDTzMuG20r/ jrDLgNiCm16+sC25GAVL9NTw28UsE2LX89ZFVPGsg/TZgYY+je/OmseXlhmN/aU8fogd+0cnO9h vHPQi+Qm3S9eMXQCF99LdoO8= X-Envelope-To: linux-kselftest@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-kselftest@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