From nobody Thu Dec 01 02:04:53 2022 X-Original-To: bugs@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 4NMzsy2g18z4jlG0 for ; Thu, 1 Dec 2022 02:04:54 +0000 (UTC) (envelope-from bugzilla-noreply@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 4NMzsy0q6Kz3hJ7 for ; Thu, 1 Dec 2022 02:04:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669860294; 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=5zbP7kDxdtbkcVaRYqD3VTtGXqwMCLJNFuyUrPqocy8=; b=U27Ao1WiiUgBXhC35xXp8Wq0gEy5J3Yz5iHm+JOwqTQABVv8JOGxHpPsA3Tr2OXpjzaq1L BqSuGIsCQQ/k7cOCFRm6H5FnovoYgLkpoySPs+XcsLhq2EeJGw1BJ1YMdsARWtin2nScxc G5Xi8YXZs1Wh5N5uZ51a9rik4vkhGUM8ZnOpB3hkCQQot4MEvrltKdY7UhCX4dMcMGR0SL qZNX+NJhcGsFuNGOyaZMOvTqNYtWDH7+g8qL5/ZK2nF2rMuqWboLER3g87FYGE334V8Kbz BeqqZ3/329WQJsPj0BoWcRk9IjmaXFAZtSTFLqm85JfWlenFVRyek+RNB1QrJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669860294; a=rsa-sha256; cv=none; b=aD2KVqV01vywJ0XEiYXlJz5HjGNBwqDhA38oJl8t4Fl3E5tB3z4/vLOrFmx620zQkpnZuM JvfZ1E2onClQJEWuBFOy/YZwVpGnh+T+zmAcUFmZO6Rc/3wngA6pu2ZqrOyJ4PdHyA/n5d 6WG0BVydI/fHRcxs8L2C2BV//+51tm6tIg7OynvOYrTptdvf29BaeR4FTiRJjm9CxsAHYX OHxXe5KdtQ7SplWqMlkr41tItras2Vkf2gI+0ooLJ9oQYwF/ZG4Ml28y5B3f9OksGu84N1 n2BbFMjZvl1MhaLL9lbGhjUpq0foBQFX+wEkLQdu5u7ESQ2enKStcKr46qy3qQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4NMzsx6qvDzKhn for ; Thu, 1 Dec 2022 02:04:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2B124rR0002998 for ; Thu, 1 Dec 2022 02:04:53 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2B124rHp002997 for bugs@FreeBSD.org; Thu, 1 Dec 2022 02:04:53 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268092] ixgbe: if_ixv driver have mismatched Rx buffer size and rx_mbuf_sz Date: Thu, 01 Dec 2022 02:04:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 12.2-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: nkumarababu@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268092 Bug ID: 268092 Summary: ixgbe: if_ixv driver have mismatched Rx buffer size and rx_mbuf_sz Product: Base System Version: 12.2-STABLE Hardware: amd64 OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: nkumarababu@gmail.com If MTU of the if_ixv VF driver is configured between 1501 and 2030, and if a peer box have bigger MTU and sends a packet bigger than MTU into this guest, kernel could crashes.=20 Here is my understanding : There are 2 buffers involved for Rx process. One for the DMA(bufsz) and another(rx_mbuf_sz) for sending that packet to netstack. In if_ixv driver, bufsz is set to 4096 if MTU is more than the default MTU: 1500. Whereas rx_mbuf_sz is set to 2048, for upto MTU 2030 (Calculation is based on frame size: 18). Because of this, for MTU upto 1500, both rx_mbuf_sz & bufsz is 2048. And for MTU above 2031, both=20 rx_mbuf_sz & bufsz is 4096. Whereas for MTU 1501 to 2030, rx_mbuf_sz=20 will be 2048 and bufsz is 4096.=20 So for MTU between 1501 and 2030, if the peer box have bigger MTU and=20 sends a bigger packet, there is a mismatch between what's written to=20 the Rx buffers and what's sent to netstack. And when that memory beyond allocated 2048 is accessed, kernel crashes.=20 Ideally, bufsz should be based on rx_mbuf_sz (This is calculated right before configuring Rx settings).=20 I could crash the box my setting MTU between 1501 and 2030 and sending send= ing 8k sized ping packet very consistently and with this below fix to match bufsz & rx_mbuf_sz, could verify that no crash occurred.=20 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -1368,7 +1376,7 @@ ixv_initialize_receive_units(if_ctx_t ctx) struct ix_rx_queue *que =3D adapter->rx_queues; u32 bufsz, psrtype; - if (if_getmtu(ifp) > ETHERMTU) + if (adapter->rx_mbuf_sz > 2048) bufsz =3D 4096 >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; else bufsz =3D 2048 >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; --=20 You are receiving this mail because: You are the assignee for the bug.=