From nobody Sat Oct 21 04:54:45 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 4SC8JQ1H8Pz4xTDQ; Sat, 21 Oct 2023 04:54:46 +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 4SC8JQ0SVfz4Q9M; Sat, 21 Oct 2023 04:54:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697864086; 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=8N7Bq85wE9SCub5FR4DsKhRQDF9fJ9fgUO71acBagYU=; b=gwWw+vK5l79PXs2kdJSAaLrnZ+j94ZM8AKeuJFX5H7hFJFBIElR4vCSVGJadknEDiITqB/ dk/NCknJ93dENaSvD/lxfCuSxCDuk6FAhB9W4vaKMgwe7vpHVtRUREPVhxobzMKXaLDJE5 trNiyCBMg2WpRag2v7wleceBepYASNdG43WF45CF/dHr+OYihhIzf88HBDO63bX+Hg5gjS junVlk+5hP+4DQJ3lphmd5LKWn9GmXlZqpjTNOa4IXGzO4gLl/cDlQ0hdEXEt49GLWQBbk i+GJ44CHTte3oxfAHbmc851hy/oeC/tsicSY7G6BbQJeYL+Y+2y95WRJ79wNGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697864086; a=rsa-sha256; cv=none; b=R8GpdOWwgmqRZ1UboCaMyVx7oHj+n9Uzzg/fRjtHDhdsmgU79O5zC5pmApUHBb66dFJTkA rpaUFufSg5KqAbuf/KWZN0p1RN1OjXP4U6hJAV+IPsh5FDmyri9aPZxGICsFM5UtwPLxUE C/lp/+Z2tA7FZc7mdWZ00plxymcwfeQNP6ujAPRsXw9qZgjojp9t5eA4o8Iy593kCS8S5J +UMT0foPj8ZQth2rAn7tNzMiMcU7pOk1ygf73rwcOOt1124Td8nkwfoq8iMwkzyD4059tf iRZ7m9z4qyFoOA0cfdOcnZIlZcIuz5XhS6Y3gx1rt4OJcqwxdesam/G+MfjacQ== 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=1697864086; 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=8N7Bq85wE9SCub5FR4DsKhRQDF9fJ9fgUO71acBagYU=; b=YmHm3QMf4o+M7azH6tcbiNpqpP6BPugeZOaHmshNCp5Djekl7kE/855b+ZJ8Nb3krw6zM5 JwoHWdQG6D5RoBnyf9UF3/sio97SDqP/ohs5EbPKuLrZ5AcYJaMgydICMFYMwmQ6oz9swB gIfvOaGSqpdv0S5LS4egu6MYwMM2Lrer/FX6hp6r5pUkz6qq9EGPgoOo6EKmuVV4ClpEjR s6bxGTo1U0zGVX9SjTM0bNwHjqdnKvazFOX4QD/dh+g4FQBKEH7DY9w1t9eeiQ4I3xDr1K v/u0iwMnLzTdoR1AX/VFHyukZ9pa21CuR7HUkGn4uB4vX2tyg/b/RHLm5Cr/HQ== 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 4SC8JP6bsGz127W; Sat, 21 Oct 2023 04:54:45 +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 39L4sjgQ023567; Sat, 21 Oct 2023 04:54:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39L4sjoj023564; Sat, 21 Oct 2023 04:54:45 GMT (envelope-from git) Date: Sat, 21 Oct 2023 04:54:45 GMT Message-Id: <202310210454.39L4sjoj023564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 7a974a649848 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 7a974a649848e1222a49d0d49726d06bd5c1dbd9 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=7a974a649848e1222a49d0d49726d06bd5c1dbd9 commit 7a974a649848e1222a49d0d49726d06bd5c1dbd9 Author: Zhenlei Huang AuthorDate: 2023-10-21 04:52:27 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-21 04:52:27 +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 --- 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 96420b709911..9e135b90614b 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", @@ -3162,7 +3162,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