From nobody Thu Jun 23 08:44:49 2022 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 BEA3F865A41; Thu, 23 Jun 2022 08:44:49 +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 4LTDMj4z4mz3Fq7; Thu, 23 Jun 2022 08:44:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655973889; 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=YG4lcZGtJc8ACcyrhHXsd3hs3EC995z0eSsgv6kKWkY=; b=g16FDR8kGF5It2v8shGUTXSNXzlI20WiIZFs0olODjyziE6nPNUaPcaHXLm7wPECUH+xlV QDD6lNQRR06xTdZjvn1hMwFrfHqGFhdoCzKWmdr1QYPDu2EDd4Teuu0yEjdcJIsC5sEgzx LbR4Yel9TBBQdiQJLZDH1ItqnD/Rgp40rrtWjXz0TTivCP/CuIQTHh/eDjHjAw1mKhIu2m URewrOP8T//uA6iJF5DtWh29uCFY3+ZsJAtE6AqJlWkFPTbaQInF9dzGIA2PjKhismZrA1 3LcG+IG5mCBpKt8qGAQ3r3Zu9kQF18R+zRTvy6aMqVT6ct2+K2MS8mkyDnnXcg== 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 86E6317ABB; Thu, 23 Jun 2022 08:44:49 +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 25N8in5A037242; Thu, 23 Jun 2022 08:44:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25N8inMX037241; Thu, 23 Jun 2022 08:44:49 GMT (envelope-from git) Date: Thu, 23 Jun 2022 08:44:49 GMT Message-Id: <202206230844.25N8inMX037241@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: 488626e55384 - main - pf: copy out rather than m_pullup() in pf_test_eth_rule() 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: 488626e55384e253326b92f7aab1cc62add2f7e7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655973889; 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=YG4lcZGtJc8ACcyrhHXsd3hs3EC995z0eSsgv6kKWkY=; b=yIIMeC30JNUDp4MsBK1IZkVriemkJ4+3vM8m7JuxFLWSClPKCCUJ7X1DJ4AMciNnGPcGj3 KDphlRCv1OKMBZtWch76g4LpoAvJQMNfR6XhRVSpT0kVfiptoq85a6Lg7fUZex1Qsc8hcA qSjfqf3kULJmd3SlJ6NHEdSQ7Y7CJkgD0ZHorOsQG1mQ8tdEuXwSwYZ2vjx4lVJK4ud5WL NWhXfngK3o4B1GB9ddSSEKE45aSZJlcYS7W2c+CoKaXebtQnunA5/hx3f8yXw2uflA08qe JN/OAnggyjhj6XfxXaJZVfZEYGcT49ftu9ToP3fxkijgubu+Fxgq9QhD9nT9Sg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655973889; a=rsa-sha256; cv=none; b=jeorKo6prrgQbdvJgsYkr3v9s0LhNlDOlUD0UiwhPsRD/jT2lZ3VPXuDf6LUJq1w4tqlUe XKxHmCC12ii6G74d+sX21T0f6+Lk3Jj5L2Q1rq1qdx6fFKD1fzA1tfAT1yubTJtxZT0HuO nQ239QJsvJjSHHvfYxjsYtv77YGOpTPEHB6Nm4Iz2cHYYOZY0unODq4Ofsy+MuFzJCZDi2 /x6PJO3+jUK1x5QByyr4eCX3Dqw84yTU0KFNf/ZozsZSZmBRKIXdAcB3nmskt8HfQHjXmj hUU11obZqn+1Z9jGwv2/seIYncaLn13jHG3HS3lVtcLr+XQcdpouX52L9SoOdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=488626e55384e253326b92f7aab1cc62add2f7e7 commit 488626e55384e253326b92f7aab1cc62add2f7e7 Author: Kristof Provost AuthorDate: 2022-06-22 14:52:24 +0000 Commit: Kristof Provost CommitDate: 2022-06-23 07:50:44 +0000 pf: copy out rather than m_pullup() in pf_test_eth_rule() Don't change the mbuf chain layout. We've encountered alignment issues in the tcp syncookie code on armv7, which are triggered by the m_pullup() here. Reviewed by: mjg Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D35551 --- sys/netpfil/pf/pf.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 172ed52dbc03..275e1fcdbeb4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3848,6 +3848,12 @@ pf_match_eth_tag(struct mbuf *m, struct pf_keth_rule *r, int *tag, int mtag) static int pf_test_eth_rule(int dir, struct pfi_kkif *kif, struct mbuf **m0) { +#ifdef INET + struct ip ip; +#endif +#ifdef INET6 + struct ip6_hdr ip6; +#endif struct mbuf *m = *m0; struct ether_header *e; struct pf_keth_rule *r, *rm, *a = NULL; @@ -3893,39 +3899,25 @@ pf_test_eth_rule(int dir, struct pfi_kkif *kif, struct mbuf **m0) switch (proto) { #ifdef INET case ETHERTYPE_IP: { - struct ip *ip; - m = m_pullup(m, sizeof(struct ether_header) + - sizeof(struct ip)); - if (m == NULL) { - *m0 = NULL; - return (PF_DROP); - } af = AF_INET; - ip = mtodo(m, sizeof(struct ether_header)); - src = (struct pf_addr *)&ip->ip_src; - dst = (struct pf_addr *)&ip->ip_dst; + m_copydata(m, sizeof(struct ether_header), sizeof(ip), + (caddr_t)&ip); + src = (struct pf_addr *)&ip.ip_src; + dst = (struct pf_addr *)&ip.ip_dst; break; } #endif /* INET */ #ifdef INET6 case ETHERTYPE_IPV6: { - struct ip6_hdr *ip6; - m = m_pullup(m, sizeof(struct ether_header) + - sizeof(struct ip6_hdr)); - if (m == NULL) { - *m0 = NULL; - return (PF_DROP); - } af = AF_INET6; - ip6 = mtodo(m, sizeof(struct ether_header)); - src = (struct pf_addr *)&ip6->ip6_src; - dst = (struct pf_addr *)&ip6->ip6_dst; + m_copydata(m, sizeof(struct ether_header), sizeof(ip6), + (caddr_t)&ip6); + src = (struct pf_addr *)&ip6.ip6_src; + dst = (struct pf_addr *)&ip6.ip6_dst; break; } #endif /* INET6 */ } - e = mtod(m, struct ether_header *); - *m0 = m; PF_RULES_RLOCK();