From nobody Thu Nov 10 19:15:14 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N7WkV4qzJz4dnkv; Thu, 10 Nov 2022 19:15:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N7WkV3wCVz41VQ; Thu, 10 Nov 2022 19:15:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668107714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oev1Af8JvYPBdRHv8R5lBL1IcDCtoD0tahKWpdwZmXI=; b=YehSIIIjSeYEfqfrO1DxRF/fOnRbyh1WG2Ulk3yxCpADJQe8KNQQEkdFQVbD+I8uO9YFYp lMuuzG3pQuUwwp8WVlO8aQahWjPRNnwkcK33NAN59P6Iu/PI0hxa6dyDG61Hq+5tMKaeFT nsPjZ0qAegZm7jyQNuNmcHEmAc3OkeihO9qeE+3zAnDYb0YLBrSrVFzpGoZdWWYaTs63Uo zKDc8ZjMYCF+c1OG3rffQoJnF5Y2EoNmJKMh2u3dRoPJvJ84KMe5aoHFhQS1VsK6TsH/c1 cymA6GLNZeOdx+cNasZ7XpKljHd+4P+oCnfXdfiPAYQcx3v2+yoq0ZEiI8ODcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668107714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oev1Af8JvYPBdRHv8R5lBL1IcDCtoD0tahKWpdwZmXI=; b=e7Ux6PN12CnkVKtuO/AwxsiEJ8MEwWZFOrDVPKl76Q+UCX7FJn6xGo3OmgrVZAhx6pG5rd UswNFVWDjfQmi+Nv+ANuprtlMzOfSNRnJFa+CKDL+Z2CkPxEFVoSSNqD3b3VdHWPXSJk9/ lIi583ft+J2JLrl5b0ETRIREs/12Dp7eSprVfsxEry4vKKMgDM2xQxuSYC97f0owpwdphF jxsxPtxv3SQBaShnXzs2eKQy+Dv0z9sDAw/VImRzVOq70OAP7pygHBMi8T6uo+lYG/P9QV VKFkDyQwzDQV2xm1QQCgkM6sBTIejxz6khVF7CSjYViT1QRlyvOZhRY3MuaXMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668107714; a=rsa-sha256; cv=none; b=IcaW+hONMgDWgNPAGo9JkJSPTafODHM/KSfxoUJ/dyKloKqn7ZJ8ruAspQqu9vMYuCInRO ajDV1mBVrOl0EDtJ/5AVpu7jGank7v8SjAeMsMjcNsAj4AziD/TtMBNECfhjU3XUD848Vv WcXyn91DpLqfWkIFT8WqQSXlyzlfzBR3lw3t9zxm9sPWnAgQAeece2A0Z8Hyf9u+jL6Unm A6ukTfCqEhpccmLy6Epg1XyqErTfoZGH9YSCFjk1J73g3X1jPUJW+/TnCvKuwie/oeWOhf UZZV73K+2vq11PWMWnYqj4Qpf8ma4pWZOCVGJif7tusGy7jSXJjM7K44YL31lA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N7WkV2w16z1BtJ; Thu, 10 Nov 2022 19:15:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AAJFEGd000956; Thu, 10 Nov 2022 19:15:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AAJFEpa000955; Thu, 10 Nov 2022 19:15:14 GMT (envelope-from git) Date: Thu, 10 Nov 2022 19:15:14 GMT Message-Id: <202211101915.2AAJFEpa000955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 2de803570472 - stable/13 - Add freebsd32 compat shims for SIOC[GS]DRVSPEC. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2de8035704728d2749705b58866a4eb3f4a5e02d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2de8035704728d2749705b58866a4eb3f4a5e02d commit 2de8035704728d2749705b58866a4eb3f4a5e02d Author: John Baldwin AuthorDate: 2021-05-05 20:58:50 +0000 Commit: John Baldwin CommitDate: 2022-11-10 18:25:58 +0000 Add freebsd32 compat shims for SIOC[GS]DRVSPEC. Reviewed by: brooks, kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29892 (cherry picked from commit d61d98f4ed68c5f6c81586a529057fe51fd50a60) --- sys/net/if.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index 2389969fefd5..eefa0ac93291 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -148,6 +148,15 @@ CTASSERT(sizeof(struct ifreq) == sizeof(struct ifreq32)); CTASSERT(__offsetof(struct ifreq, ifr_ifru) == __offsetof(struct ifreq32, ifr_ifru)); +struct ifdrv32 { + char ifd_name[IFNAMSIZ]; + uint32_t ifd_cmd; + uint32_t ifd_len; + uint32_t ifd_data; +}; +#define SIOCSDRVSPEC32 _IOC_NEWTYPE(SIOCSDRVSPEC, struct ifdrv32) +#define SIOCGDRVSPEC32 _IOC_NEWTYPE(SIOCGDRVSPEC, struct ifdrv32) + struct ifgroupreq32 { char ifgr_name[IFNAMSIZ]; u_int ifgr_len; @@ -2947,11 +2956,13 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) #ifdef COMPAT_FREEBSD32 union { struct ifconf ifc; + struct ifdrv ifd; struct ifmediareq ifmr; } thunk; caddr_t saved_data; u_long saved_cmd; struct ifconf32 *ifc32; + struct ifdrv32 *ifd32; struct ifmediareq32 *ifmr32; #endif struct ifnet *ifp; @@ -2983,6 +2994,17 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) data = (caddr_t)&thunk.ifc; cmd = SIOCGIFCONF; break; + case SIOCGDRVSPEC32: + case SIOCSDRVSPEC32: + ifd32 = (struct ifdrv32 *)data; + memcpy(thunk.ifd.ifd_name, ifd32->ifd_name, + sizeof(thunk.ifd.ifd_name)); + thunk.ifd.ifd_cmd = ifd32->ifd_cmd; + thunk.ifd.ifd_len = ifd32->ifd_len; + thunk.ifd.ifd_data = PTRIN(ifd32->ifd_data); + data = (caddr_t)&thunk.ifd; + cmd = _IOC_NEWTYPE(cmd, struct ifdrv); + break; case SIOCGIFMEDIA32: case SIOCGIFXMEDIA32: ifmr32 = (struct ifmediareq32 *)data; @@ -3103,6 +3125,17 @@ out_noref: case SIOCGIFCONF32: ifc32->ifc_len = thunk.ifc.ifc_len; break; + case SIOCGDRVSPEC32: + /* + * SIOCGDRVSPEC is IOWR, but nothing actually touches + * the struct so just assert that ifd_len (the only + * field it might make sense to update) hasn't + * changed. + */ + KASSERT(thunk.ifd.ifd_len == ifd32->ifd_len, + ("ifd_len was updated %u -> %zu", ifd32->ifd_len, + thunk.ifd.ifd_len)); + break; case SIOCGIFMEDIA32: case SIOCGIFXMEDIA32: ifmr32->ifm_current = thunk.ifmr.ifm_current;