From nobody Mon Nov 13 03:59:09 2023 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 4STFzd4cNkz50kyh; Mon, 13 Nov 2023 03:59:09 +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 4STFzd492cz4H7G; Mon, 13 Nov 2023 03:59:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699847949; 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=QowJb3/sgjRJ9tHFeg37gfANfJ46SWRuJbk70ug5DVw=; b=MUHq1J/R68uqXoYCx6YfMacBByjvQQQdtN4NSyq/WlL52Iyq+kjSg7eeUzdrckKGg/giu2 24FyRRVKny0Xq1lUS7U8JDQT6TahDLyI+Fj49OJdK+cxXcwjOXHMXTbpAzZLJK9hriO9IA nxB7U3ul7znW3C9dbtSN54SIi8lnbMlpcVmARExMrEQN6sY1Lw7dbKd2HJkyJRgiNvM1uU H+Fg5j4RI8Wq0pt4T4scLZFkewp9TvyuCj6E47XaEjlEwQjz6jEDnuSEF8lgBZUEynBA10 /OxnI04tkOVpJAD8vqfnqxsDB2JMPqB7yWWODRySb5Janahc0h42yNVD491Vcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699847949; 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=QowJb3/sgjRJ9tHFeg37gfANfJ46SWRuJbk70ug5DVw=; b=cMfczj7G5+nKCuFblC73nCtkPJxvJNwsTf3i2JZ995aOKmFMhxByftFlAitutsaGxZ5s5z nRNpSiuBfcisFTsKv01ARvnchWV1KFfZNAnTnpl/DUDP65IE+UQPVJ8Zozma9WwQinR8Dm MRv9NNALPfBuqlBqQkkfFai7UFcgXRsQhK1PFzg7OX7RmnnZLPhwjbzT6gwjWOGnPnKTAn IXkZh1pS4NInvB6CMzfn19AjOQKZX6Wz+2TxZTs/XJVLis7o/3qWjjIUsgguCjq5VY0KxN JGuGa/7kTUW8N6NJmtoassFGeYNzCl+0ArHyOIWtJQEwFnlzT+HjB8OYXNXx7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699847949; a=rsa-sha256; cv=none; b=iJWOlWEPbT5pDEr8+PlWKO3buwHYfCVSRdhkvWsAadXctcuwmc+jzNVn1+akdjkznU5RAQ zY9FfUFwGTlRq/uatuDAqQc+ryn1+iPVaPRPmT6j76tACIkmoA2YqJeAm9xQgM0kKsQEbJ HWeKjj5XhU4h9Odo+4EbWDGS3bVn6vnBXZ0wOaa8+XQhXaU5NH3FM3aCwfl90aq+2GoH6w RaAi7vjz3JfJF9Rl6nwue9GDgbKpoogWgwAKiIk6/lcN7sKYnWn6iUWPRHesjqyTODOsdC x6AWS0yLjcc2FoH8l1xwFKhUboSlEkdBMPIxzXefhpOsTL+ebKRJd7x0mn18aw== 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 4STFzd3GCszr55; Mon, 13 Nov 2023 03:59:09 +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 3AD3x9Fh009418; Mon, 13 Nov 2023 03:59:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AD3x9nA009415; Mon, 13 Nov 2023 03:59:09 GMT (envelope-from git) Date: Mon, 13 Nov 2023 03:59:09 GMT Message-Id: <202311130359.3AD3x9nA009415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 1e147980497b - stable/13 - bpf: Make dead_bpf_if const 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1e147980497b38d65cd72162c000c88507a7fa76 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=1e147980497b38d65cd72162c000c88507a7fa76 commit 1e147980497b38d65cd72162c000c88507a7fa76 Author: Zhenlei Huang AuthorDate: 2023-10-21 04:52:27 +0000 Commit: Zhenlei Huang CommitDate: 2023-11-13 03:58:34 +0000 bpf: Make dead_bpf_if const The dead_bpf_if is not subjected to be written. Make it const so that on destructive writing to it the kernel will panic instead of silent memory corruption. No functional change intended. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42189 (cherry picked from commit 7a974a649848e1222a49d0d49726d06bd5c1dbd9) (cherry picked from commit 5d031613affa14b3de64f8cf9fed15604fb826d3) --- sys/net/bpf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 20c26892ce7a..7aa1dfd302f4 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -99,7 +99,7 @@ MALLOC_DEFINE(M_BPF, "BPF", "BPF data"); -static struct bpf_if_ext dead_bpf_if = { +static const struct bpf_if_ext dead_bpf_if = { .bif_dlist = CK_LIST_HEAD_INITIALIZER() }; @@ -2796,7 +2796,7 @@ bpfdetach(struct ifnet *ifp) continue; CK_LIST_REMOVE(bp, bif_next); - *bp->bif_bpf = (struct bpf_if *)&dead_bpf_if; + *bp->bif_bpf = __DECONST(struct bpf_if *, &dead_bpf_if); CTR4(KTR_NET, "%s: sheduling free for encap %d (%p) for if %p", @@ -3076,7 +3076,7 @@ void bpfattach2(struct ifnet *ifp, u_int dlt, u_int hdrlen, struct bpf_if **driverp) { - *driverp = (struct bpf_if *)&dead_bpf_if; + *driverp = __DECONST(struct bpf_if *, &dead_bpf_if); } void