Skip to contentSkip to conversation

gve: Bug fixes for header-split and PTP

PATCH Applied Harshitha Ramamurthy 4 participants 7 messages Aug 7 – Aug 12

Subsystems (4)
lore
Share & tools
lore

Harshitha Ramamurthy

author maintainer
#0 lore raw

cover gve: Bug fixes for header-split and PTP

This series contains 2 bug fixes for gve.

Patch 1 fixes an issue which causes TX timeouts due to HW detection of an illegal descriptor. This happens when receiving header-only packets with header split enabled - this produces an SKB with a zero-length fragment.

Patch 2 prevents a kernel NULL pointer dereference by stubbing the PTP adjfine callback.

Jordan Rhee (2):
gve: fix zero-length skb frag with header-split
gve: fix NULL dereference due to missing ptp adjfine

 drivers/net/ethernet/google/gve/gve_ptp.c    | 6 ++++++
 drivers/net/ethernet/google/gve/gve_rx_dqo.c | 5 +++++
 2 files changed, 11 insertions(+)
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
author maintainer
#1 lore raw

PATCH 1/2 gve: fix zero-length skb frag with header-split

From: Jordan Rhee <[email protected]>

When header split is enabled and a header-only packet is received such as a pure TCP ACK, GVE will indicate an RX SKB with a zero-length fragment. If this SKB is then hairpinned and sent back out, the GVE TX path will emit a zero-length descriptor. Hardware considers this an illegal descriptor and stops the queue, causing a TX timeout and interface reset.

Fix it by not adding the zero-length skb frag.

---
 drivers/net/ethernet/google/gve/gve_rx_dqo.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/google/gve/gve_rx_dqo.c +5 -0
index 8271f731a91f..0ece2f6fdffb 100644
@@ -886,6 +886,11 @@ static int gve_rx_dqo(struct napi_struct *napi, struct gve_rx_ring *rx,
 		rx->rx_hsplit_unsplit_pkt += unsplit;
 		rx->rx_hsplit_bytes += hdr_len;
 		u64_stats_update_end(&rx->statss);
+
+		if (!buf_len) {
+			gve_free_buffer(rx, buf_state);
+			return 0;
+		}
 	} else if (!rx->ctx.skb_head && rx->dqo.page_pool &&
 		   netmem_is_net_iov(buf_state->page_info.netmem)) {
 		/* when header split is disabled, the header went to the packet
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
author maintainer
#2 lore raw

PATCH 2/2 gve: fix NULL dereference due to missing ptp adjfine

In reply to Harshitha Ramamurthy

From: Jordan Rhee <[email protected]>

Fix NULL dereference due to missing implementation of adjfine, which can be triggered from usermode as follows:

sudo ./testptp -d /dev/ptp0 -f 0

[  551.943697] BUG: kernel NULL pointer dereference, address: 0000000000000000
[...]
[  552.061946] Call Trace:
[  552.064487]  <TASK>
[  552.066681]  ptp_clock_adjtime+0x1c0/0x2c0
[  552.070874]  ? get_clock_desc+0x6b/0xb0
[  552.074825]  pc_clock_adjtime+0x78/0xc0
[  552.078755]  __do_sys_clock_adjtime+0x85/0x110
[  552.083293]  do_syscall_64+0xea/0x610
Fixes acd16380523b ("gve: Add initial PTP device support")
---
 drivers/net/ethernet/google/gve/gve_ptp.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/google/gve/gve_ptp.c +6 -0
index 06b1cf4a5efc..1d6c59f4ead3 100644
@@ -26,6 +26,11 @@ int gve_clock_nic_ts_read(struct gve_priv *priv)
 	return 0;
 }
 
+static int gve_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
+{
+	return -EOPNOTSUPP;
+}
+
 static int gve_ptp_gettimex64(struct ptp_clock_info *info,
 			      struct timespec64 *ts,
 			      struct ptp_system_timestamp *sts)
@@ -60,6 +65,7 @@ static long gve_ptp_do_aux_work(struct ptp_clock_info *info)
 static const struct ptp_clock_info gve_ptp_caps = {
 	.owner          = THIS_MODULE,
 	.name		= "gve clock",
+	.adjfine	= gve_ptp_adjfine,
 	.gettimex64	= gve_ptp_gettimex64,
 	.settime64	= gve_ptp_settime64,
 	.do_aux_work	= gve_ptp_do_aux_work,
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
#3 lore raw

Re: [PATCH net 2/2] gve: fix NULL dereference due to missing ptp adjfine

Quoted 41 lines · Harshitha Ramamurthy

From: Jordan Rhee <[email protected]>

Fix NULL dereference due to missing implementation of adjfine, which can be triggered from usermode as follows:

sudo ./testptp -d /dev/ptp0 -f 0

[  551.943697] BUG: kernel NULL pointer dereference, address: 0000000000000000
[...]
[  552.061946] Call Trace:
[  552.064487]  <TASK>
[  552.066681]  ptp_clock_adjtime+0x1c0/0x2c0
[  552.070874]  ? get_clock_desc+0x6b/0xb0
[  552.074825]  pc_clock_adjtime+0x78/0xc0
[  552.078755]  __do_sys_clock_adjtime+0x85/0x110
[  552.083293]  do_syscall_64+0xea/0x610
Fixes acd16380523b ("gve: Add initial PTP device support")
---
  drivers/net/ethernet/google/gve/gve_ptp.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/net/ethernet/google/gve/gve_ptp.c +5 -0
index 06b1cf4a5efc..1d6c59f4ead3 100644
@@ -26,6 +26,11 @@ int gve_clock_nic_ts_read(struct gve_priv *priv)
  	return 0;
  }
 
+static int gve_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
+{
+	return -EOPNOTSUPP;
+}
+
  static int gve_ptp_gettimex64(struct ptp_clock_info *info,
  			      struct timespec64 *ts,
  			      struct ptp_system_timestamp *sts)

drivers/net/ethernet/google/gve/gve_ptp.c static long gve_ptp_do_aux_work(struct ptp_clock_info *info) · line 71

Quoted 7 lines
drivers/net/ethernet/google/gve/gve_ptp.c +1 -0
@@ -60,6 +65,7 @@ static long gve_ptp_do_aux_work(struct ptp_clock_info *info)
  static const struct ptp_clock_info gve_ptp_caps = {
  	.owner          = THIS_MODULE,
  	.name		= "gve clock",
+	.adjfine	= gve_ptp_adjfine,
  	.gettimex64	= gve_ptp_gettimex64,
  	.settime64	= gve_ptp_settime64,
  	.do_aux_work	= gve_ptp_do_aux_work,

.adjtime has to be implemented as well - neither adjfine nor adjtime are checked within ptp_clock_adjtime()

#4 lore raw

Re: [PATCH net 2/2] gve: fix NULL dereference due to missing ptp adjfine

Quoted 45 lines · Vadim Fedorenko
Quoted 43 lines · Harshitha Ramamurthy

From: Jordan Rhee <[email protected]>

Fix NULL dereference due to missing implementation of adjfine, which can be triggered from usermode as follows:

sudo ./testptp -d /dev/ptp0 -f 0

[  551.943697] BUG: kernel NULL pointer dereference, address: 0000000000000000
[...]
[  552.061946] Call Trace:
[  552.064487]  <TASK>
[  552.066681]  ptp_clock_adjtime+0x1c0/0x2c0
[  552.070874]  ? get_clock_desc+0x6b/0xb0
[  552.074825]  pc_clock_adjtime+0x78/0xc0
[  552.078755]  __do_sys_clock_adjtime+0x85/0x110
[  552.083293]  do_syscall_64+0xea/0x610
Fixes acd16380523b ("gve: Add initial PTP device support")
---
  drivers/net/ethernet/google/gve/gve_ptp.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/net/ethernet/google/gve/gve_ptp.c +5 -0
index 06b1cf4a5efc..1d6c59f4ead3 100644
@@ -26,6 +26,11 @@ int gve_clock_nic_ts_read(struct gve_priv *priv)
      return 0;
  }
 
+static int gve_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
+{
+     return -EOPNOTSUPP;
+}
+
  static int gve_ptp_gettimex64(struct ptp_clock_info *info,
                            struct timespec64 *ts,
                            struct ptp_system_timestamp *sts)
@@ -60,6 +65,7 @@ static long gve_ptp_do_aux_work(struct ptp_clock_info *info)
  static const struct ptp_clock_info gve_ptp_caps = {
      .owner          = THIS_MODULE,
Quoted 8 lines

drivers/net/ethernet/google/gve/gve_ptp.c static long gve_ptp_do_aux_work(struct ptp_clock_info *info) · line 71

Quoted 5 lines
drivers/net/ethernet/google/gve/gve_ptp.c +1 -0
      .name           = "gve clock",
+     .adjfine        = gve_ptp_adjfine,
      .gettimex64     = gve_ptp_gettimex64,
      .settime64      = gve_ptp_settime64,
      .do_aux_work    = gve_ptp_do_aux_work,

.adjtime has to be implemented as well - neither adjfine nor adjtime are checked within ptp_clock_adjtime()

adjtime() can only be reached if gettimex64() succeeds. Since GVE currently returns -EOPNOTSUPP in gettimex64(), ptp_clock_adjtime() will short circuit before calling the driver's adjtime callback. We will need to provide a stub for adjtime() when we implement gettimex64().

My understanding is that fixes should only address real, reproducible issues which is why we only sent adjfine in this patch. If the maintainers would prefer we send adjtime() as well, just let us know. That said, our preference would be not to delay the other patch in this series ("gve: fix zero-length skb frag with header-split").

Reviewed-by
#5 lore raw

Re: [PATCH net 2/2] gve: fix NULL dereference due to missing ptp adjfine

Quoted 62 lines · Jordan Rhee
Quoted 45 lines · Vadim Fedorenko
Quoted 43 lines · Harshitha Ramamurthy

From: Jordan Rhee <[email protected]>

Fix NULL dereference due to missing implementation of adjfine, which can be triggered from usermode as follows:

sudo ./testptp -d /dev/ptp0 -f 0

[  551.943697] BUG: kernel NULL pointer dereference, address: 0000000000000000
[...]
[  552.061946] Call Trace:
[  552.064487]  <TASK>
[  552.066681]  ptp_clock_adjtime+0x1c0/0x2c0
[  552.070874]  ? get_clock_desc+0x6b/0xb0
[  552.074825]  pc_clock_adjtime+0x78/0xc0
[  552.078755]  __do_sys_clock_adjtime+0x85/0x110
[  552.083293]  do_syscall_64+0xea/0x610
Fixes acd16380523b ("gve: Add initial PTP device support")
---
   drivers/net/ethernet/google/gve/gve_ptp.c | 6 ++++++
   1 file changed, 6 insertions(+)
drivers/net/ethernet/google/gve/gve_ptp.c +5 -0
index 06b1cf4a5efc..1d6c59f4ead3 100644
@@ -26,6 +26,11 @@ int gve_clock_nic_ts_read(struct gve_priv *priv)
       return 0;
   }
 
+static int gve_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
+{
+     return -EOPNOTSUPP;
+}
+
   static int gve_ptp_gettimex64(struct ptp_clock_info *info,
                             struct timespec64 *ts,
                             struct ptp_system_timestamp *sts)
@@ -60,6 +65,7 @@ static long gve_ptp_do_aux_work(struct ptp_clock_info *info)
   static const struct ptp_clock_info gve_ptp_caps = {
       .owner          = THIS_MODULE,
Quoted 8 lines

drivers/net/ethernet/google/gve/gve_ptp.c static long gve_ptp_do_aux_work(struct ptp_clock_info *info) · line 71

Quoted 5 lines
drivers/net/ethernet/google/gve/gve_ptp.c +1 -0
       .name           = "gve clock",
+     .adjfine        = gve_ptp_adjfine,
       .gettimex64     = gve_ptp_gettimex64,
       .settime64      = gve_ptp_settime64,
       .do_aux_work    = gve_ptp_do_aux_work,

.adjtime has to be implemented as well - neither adjfine nor adjtime are checked within ptp_clock_adjtime()

adjtime() can only be reached if gettimex64() succeeds. Since GVE currently returns -EOPNOTSUPP in gettimex64(), ptp_clock_adjtime() will short circuit before calling the driver's adjtime callback. We will need to provide a stub for adjtime() when we implement gettimex64().

Quoted 5 lines

My understanding is that fixes should only address real, reproducible issues which is why we only sent adjfine in this patch. If the maintainers would prefer we send adjtime() as well, just let us know. That said, our preference would be not to delay the other patch in this series ("gve: fix zero-length skb frag with header-split").

ah, yeah, I see that gve_ptp_gettimex64 is -EOPNOTSUPP.

#6 lore raw
In reply to Harshitha Ramamurthy
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Fri, 7 Aug 2026 22:43:13 +0000 you wrote:

This series contains 2 bug fixes for gve.

Patch 1 fixes an issue which causes TX timeouts due to HW detection of an illegal descriptor. This happens when receiving header-only packets with header split enabled - this produces an SKB with a zero-length fragment.

[...]

Here is the summary with links:
- [net,1/2] gve: fix zero-length skb frag with header-split

    https://git.kernel.org/netdev/net/c/6bf14575c655
  - [net,2/2] gve: fix NULL dereference due to missing ptp adjfine
    https://git.kernel.org/netdev/net/c/3992ced109c7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html