From nobody Mon Nov 13 03:57:35 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 4STFxr1P37z50kgk; Mon, 13 Nov 2023 03:57:36 +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 4STFxq62lxz4GPR; Mon, 13 Nov 2023 03:57:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699847855; 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=dqfLkjceUh2lbpyaRsW9dxwZu5RZti+MGVosbIIujFU=; b=wxHBtcm/Z7+9bG09f4Ycf6gQraQBUl+/gqSPeHeaoOP+rld4vky3UXgY1cHt/U3iiaPzs7 Gyy+DYszbrHPGhEaYB1JIEVSCAF4OICPw4TEquXKZl75uiDm/gVpPEfggIvU09AdSUB5sz NcVlft/LLfYJkC8d+mfz09WbWl/tREDloRw5JzJeeGdBI0bYJ4UpfITDSpYgbd99M/5Kvz FRLg4m8Cxk9Q6iwhsZv3gzjOgdUlnqEpYkYY6Xv/aqls2jQ9WwWK25BY++0P9n08Hvpbn7 dogdLX4XWOC8kqytPJXCqyMMH4JOoROITchICP9Yb+vXzmztZz79piLPn6bDSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699847855; 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=dqfLkjceUh2lbpyaRsW9dxwZu5RZti+MGVosbIIujFU=; b=XldtwEeNqTAJwHFwG/X+jPGnhMQOSReXYo8bUDNQ9xlPdw1y7+kwOHCAsWAC4NiCr/t6+D Go1dfGgLJqWReVGffIImq7DxYLJU8Av0EhL8lGlmSISOivpJ6u+9JBDba7ij2naLuSLP+k nfsAwxT/yGW4EVyc8rJc3WYxZwwWyphWC7eUaNHvhLctUTiQa94gPAm0a6jfWpxjp5WfEs UJw0CvzxkezcOm7jjQoFoJphlCtdzTPyq1u8x2LVV9cieSkFM3vwG8z7cHMsl2R6LYusAo QzvRr9/CVkIFwxf/nhPRNn7bOGNgV+kDIyYzmQaOFGuCorf97W+x9chMFCGTLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699847855; a=rsa-sha256; cv=none; b=VcilhbE0aRKe2WElrlXRzrmCzy7iJO882Z6zhZCq2PO7MUhzLxAfcFTyNqk11E5NF3q0KS VttmxD8ihqlTufmb2ndUGrYypIazozHSCS2H6lZDxn2iV43sxjC/7kHBBjiPitgqKOC6Dy qIGnJuzX/UH1jkeUU+Yp9ajFoyHwCUt6p7JQmpFlDj+7GIaR1nN4k9WbVuxw2BFT0WhE5D TX2onZOexoXFYdgrf0Quj4zuUFc1Qc4TmxWiH0wN4p4pDe/fo3OacafNcvgkV9b8Pecl/9 1gjQkIC/x9AaGy62s75KZVhYvRW30J7hYFWKhk1sFAa4sgBgOfy22GjCtQPbYA== 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 4STFxq58BjzqDl; Mon, 13 Nov 2023 03:57:35 +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 3AD3vZNa009022; Mon, 13 Nov 2023 03:57:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AD3vZRB009020; Mon, 13 Nov 2023 03:57:35 GMT (envelope-from git) Date: Mon, 13 Nov 2023 03:57:35 GMT Message-Id: <202311130357.3AD3vZRB009020@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: 5d031613affa - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 5d031613affa14b3de64f8cf9fed15604fb826d3 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=5d031613affa14b3de64f8cf9fed15604fb826d3 commit 5d031613affa14b3de64f8cf9fed15604fb826d3 Author: Zhenlei Huang AuthorDate: 2023-10-21 04:52:27 +0000 Commit: Zhenlei Huang CommitDate: 2023-11-13 03:56:57 +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) --- 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 8ca6e941e646..61eb674a7c0a 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -100,7 +100,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() }; @@ -2859,7 +2859,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", @@ -3154,7 +3154,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