From nobody Thu Jun 06 13:46:05 2024 X-Original-To: dev-commits-src-main@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 4Vw5Fn5WPtz5MWKl; Thu, 06 Jun 2024 13:46:05 +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 4Vw5Fn503Yz3yfn; Thu, 6 Jun 2024 13:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717681565; 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=NvYHT2NvLjxpfxmXQFI7gSvSk1K68Jkrax/VPab4Ks8=; b=be1za+o705GMDKb377OfVE1kTIzZ3L8cDPsxEc0CVfN3jdjbCu9FLu/tBEcjD0fYl57qnb uTZrDN82VS8IJRmw2dfjWqfcbLTQlOytvkLp43RWVJ9iCJ43Gvi2tOg14wFknKtXeZuKkc GsgJEGkVZn45mYqWtiwhwjbsBJcTyaQ1WNpmU9MEtp7/fYWxX1Ln6pbyRZtVRRuOHV3Xv1 HIVVNK8BaaNHtVyPYETh/qeUcD8iIfzenxhl6LtcH3ftvUNYTtDyDE1O/TFg56kmPcgtsk jKCRQORLbsRU4KwZ0gI/VPRgNBaf0vfLx9lRECuMP1fRCGyGRyBo2eWstYVFrw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717681565; a=rsa-sha256; cv=none; b=xGMOp+ZlpIFOe3BcfsnM0WkqD59bJtTDeT+r0v6UCHEhXOFLx77+mollZMP7hz+WYltTY5 NRSH8PaZ3aKMV2eDkYrXbL7vielYfGPTUhF89p/wmYW3nXFhKcXCHUoiL7MCI11pfzLQ6Y IP/AmK5WWL0zeRYrv6zHxDriOJZcpbiQpuROikcsjt/69PwMWMcJtga1LiyoqM1r6+fmPv bv63Jq40Z04SRv5ofmEHhMwKXWEBSnxrx5h4Ts2B56wfsl+TA0WvBFxdszMXiQUNjXgA5+ i8Ta039f75liDYGhAvXJ2yVe5c/0jH75URXPRTt7SClWke8rBAjpfFKxtrk/wA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717681565; 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=NvYHT2NvLjxpfxmXQFI7gSvSk1K68Jkrax/VPab4Ks8=; b=pxVQ5i3LJJ9yaCvtKoqbU0nBKGExoFzMFu2uD7kb5f23eGtFcRDIrJoaO8/IwiiAPtTQ1y cKTgW5YelMXLVMsbhR6uyA6qRAyKlfNYseqb1PWZFuQHlXfMI6ni8TIqttUCnIbwv12uzh s+lvvtrQUJxz5ONw5NIFccwvBi2zRQISYuXxvk3mnGkToNPmelu6HWFmPV2fRdmESVNUs5 k+Ld5LGCtwxi/+LSesBGO+sWyW7+YDvKAorkOzdtoQQHrkMWY9BEKKlQ4gwSJ6NjY3EePh /m6T+9q/gchMKtYkB1RbKvDhHNJatNYP1ZbxhRj706cNNMv/8KVQ9U0DhNiF9Q== 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 4Vw5Fn4cTzznn6; Thu, 6 Jun 2024 13:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456Dk5I7010644; Thu, 6 Jun 2024 13:46:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Dk5LO010641; Thu, 6 Jun 2024 13:46:05 GMT (envelope-from git) Date: Thu, 6 Jun 2024 13:46:05 GMT Message-Id: <202406061346.456Dk5LO010641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: f0829825fb9d - main - netlink: pass the correct arguments for SIOCDIFADDR and SIOCDIFADDR_IN6 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0829825fb9dee5381d3b5f52f66d5e9384240e7 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f0829825fb9dee5381d3b5f52f66d5e9384240e7 commit f0829825fb9dee5381d3b5f52f66d5e9384240e7 Author: Kristof Provost AuthorDate: 2024-06-05 17:44:46 +0000 Commit: Kristof Provost CommitDate: 2024-06-06 13:45:30 +0000 netlink: pass the correct arguments for SIOCDIFADDR and SIOCDIFADDR_IN6 These take struct ifreq and struct in6_ifreq respectively. Passing struct in_aliasreq or struct in6_aliasreq means we're supplying a shorter object than expected. While this doesn't actively break things on most architectures other than CHERI it is still wrong. Reported by: CheriBSD Event: Kitchener-Waterloo Hackathon 202406 --- sys/netlink/route/iface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index 19da6aea5f31..81db54ab12d4 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -1204,7 +1204,7 @@ handle_deladdr_inet(struct nlmsghdr *hdr, struct nl_parsed_ifa *attrs, return (EINVAL); } - struct in_aliasreq req = { .ifra_addr = *addr }; + struct ifreq req = { .ifr_addr = *(struct sockaddr *)addr }; return (in_control_ioctl(SIOCDIFADDR, &req, ifp, nlp_get_cred(nlp))); } @@ -1288,7 +1288,7 @@ handle_deladdr_inet6(struct nlmsghdr *hdr, struct nl_parsed_ifa *attrs, return (EINVAL); } - struct in6_aliasreq req = { .ifra_addr = *addr }; + struct in6_ifreq req = { .ifr_addr = *addr }; return (in6_control_ioctl(SIOCDIFADDR_IN6, &req, ifp, nlp_get_cred(nlp))); }