* [PATCH net] net: stmmac: Complete meta data only when enabled
@ 2024-02-22 9:45 Kurt Kanzenbach
2024-02-22 19:53 ` Stanislav Fomichev
0 siblings, 1 reply; 4+ messages in thread
From: Kurt Kanzenbach @ 2024-02-22 9:45 UTC (permalink / raw)
To: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin
Cc: Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Song Yoong Siang, Stanislav Fomichev,
Maciej Fijalkowski, Serge Semin, Sebastian Andrzej Siewior,
netdev, linux-stm32, linux-arm-kernel, bpf, Kurt Kanzenbach
Currently using XDP/ZC sockets on stmmac results in a kernel crash:
|[ 255.822584] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
|[...]
|[ 255.822764] Call trace:
|[ 255.822766] stmmac_tx_clean.constprop.0+0x848/0xc38
The program counter indicates xsk_tx_metadata_complete(). However, this
function shouldn't be called unless metadata is actually enabled.
Tested on imx93 without XDP, with XDP and with XDP/ZC.
Fixes: 1347b419318d ("net: stmmac: Add Tx HWTS support to XDP ZC")
Suggested-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/netdev/87r0h7wg8u.fsf@kurt.kurt.home/
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e80d77bd9f1f..8b77c0952071 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2672,7 +2672,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue,
}
if (skb) {
stmmac_get_tx_hwtstamp(priv, p, skb);
- } else {
+ } else if (tx_q->xsk_pool &&
+ xp_tx_metadata_enabled(tx_q->xsk_pool)) {
struct stmmac_xsk_tx_complete tx_compl = {
.priv = priv,
.desc = p,
---
base-commit: 603ead96582d85903baec2d55f021b8dac5c25d2
change-id: 20240222-stmmac_xdp-585ebf1680b3
Best regards,
--
Kurt Kanzenbach <kurt@linutronix.de>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: stmmac: Complete meta data only when enabled
2024-02-22 9:45 [PATCH net] net: stmmac: Complete meta data only when enabled Kurt Kanzenbach
@ 2024-02-22 19:53 ` Stanislav Fomichev
2024-02-23 16:45 ` Maciej Fijalkowski
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Fomichev @ 2024-02-22 19:53 UTC (permalink / raw)
To: Kurt Kanzenbach
Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Song Yoong Siang, Maciej Fijalkowski, Serge Semin,
Sebastian Andrzej Siewior, netdev, linux-stm32, linux-arm-kernel,
bpf
On Thu, Feb 22, 2024 at 1:45 AM Kurt Kanzenbach <kurt@linutronix.de> wrote:
>
> Currently using XDP/ZC sockets on stmmac results in a kernel crash:
>
> |[ 255.822584] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> |[...]
> |[ 255.822764] Call trace:
> |[ 255.822766] stmmac_tx_clean.constprop.0+0x848/0xc38
>
> The program counter indicates xsk_tx_metadata_complete(). However, this
> function shouldn't be called unless metadata is actually enabled.
>
> Tested on imx93 without XDP, with XDP and with XDP/ZC.
>
> Fixes: 1347b419318d ("net: stmmac: Add Tx HWTS support to XDP ZC")
> Suggested-by: Serge Semin <fancer.lancer@gmail.com>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> Tested-by: Serge Semin <fancer.lancer@gmail.com>
> Link: https://lore.kernel.org/netdev/87r0h7wg8u.fsf@kurt.kurt.home/
Acked-by: Stanislav Fomichev <sdf@google.com>
LGTM, thanks!
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e80d77bd9f1f..8b77c0952071 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2672,7 +2672,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue,
> }
> if (skb) {
> stmmac_get_tx_hwtstamp(priv, p, skb);
> - } else {
> + } else if (tx_q->xsk_pool &&
> + xp_tx_metadata_enabled(tx_q->xsk_pool)) {
> struct stmmac_xsk_tx_complete tx_compl = {
> .priv = priv,
> .desc = p,
>
> ---
> base-commit: 603ead96582d85903baec2d55f021b8dac5c25d2
> change-id: 20240222-stmmac_xdp-585ebf1680b3
>
> Best regards,
> --
> Kurt Kanzenbach <kurt@linutronix.de>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: stmmac: Complete meta data only when enabled
2024-02-22 19:53 ` Stanislav Fomichev
@ 2024-02-23 16:45 ` Maciej Fijalkowski
2024-02-25 10:55 ` Kurt Kanzenbach
0 siblings, 1 reply; 4+ messages in thread
From: Maciej Fijalkowski @ 2024-02-23 16:45 UTC (permalink / raw)
To: Stanislav Fomichev
Cc: Kurt Kanzenbach, Alexandre Torgue, Jose Abreu, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Song Yoong Siang, Serge Semin,
Sebastian Andrzej Siewior, netdev, linux-stm32, linux-arm-kernel,
bpf
On Thu, Feb 22, 2024 at 11:53:14AM -0800, Stanislav Fomichev wrote:
> On Thu, Feb 22, 2024 at 1:45 AM Kurt Kanzenbach <kurt@linutronix.de> wrote:
> >
> > Currently using XDP/ZC sockets on stmmac results in a kernel crash:
> >
> > |[ 255.822584] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
would be good to explain where it comes from, no?
xsk_tx_metadata_to_compl() works on meta == NULL, it does not set
compl->tx_timestamp and later on xsk_tx_metadata_complete() tries to
dereference that.
> > |[...]
> > |[ 255.822764] Call trace:
> > |[ 255.822766] stmmac_tx_clean.constprop.0+0x848/0xc38
> >
> > The program counter indicates xsk_tx_metadata_complete(). However, this
> > function shouldn't be called unless metadata is actually enabled.
> >
> > Tested on imx93 without XDP, with XDP and with XDP/ZC.
> >
> > Fixes: 1347b419318d ("net: stmmac: Add Tx HWTS support to XDP ZC")
> > Suggested-by: Serge Semin <fancer.lancer@gmail.com>
> > Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> > Tested-by: Serge Semin <fancer.lancer@gmail.com>
> > Link: https://lore.kernel.org/netdev/87r0h7wg8u.fsf@kurt.kurt.home/
>
> Acked-by: Stanislav Fomichev <sdf@google.com>
>
> LGTM, thanks!
>
> > ---
> > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index e80d77bd9f1f..8b77c0952071 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -2672,7 +2672,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue,
> > }
> > if (skb) {
> > stmmac_get_tx_hwtstamp(priv, p, skb);
> > - } else {
> > + } else if (tx_q->xsk_pool &&
> > + xp_tx_metadata_enabled(tx_q->xsk_pool)) {
> > struct stmmac_xsk_tx_complete tx_compl = {
> > .priv = priv,
> > .desc = p,
> >
> > ---
> > base-commit: 603ead96582d85903baec2d55f021b8dac5c25d2
> > change-id: 20240222-stmmac_xdp-585ebf1680b3
> >
> > Best regards,
> > --
> > Kurt Kanzenbach <kurt@linutronix.de>
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: stmmac: Complete meta data only when enabled
2024-02-23 16:45 ` Maciej Fijalkowski
@ 2024-02-25 10:55 ` Kurt Kanzenbach
0 siblings, 0 replies; 4+ messages in thread
From: Kurt Kanzenbach @ 2024-02-25 10:55 UTC (permalink / raw)
To: Maciej Fijalkowski, Stanislav Fomichev
Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Song Yoong Siang, Serge Semin, Sebastian Andrzej Siewior, netdev,
linux-stm32, linux-arm-kernel, bpf
[-- Attachment #1: Type: text/plain, Size: 504 bytes --]
Hello Maciej,
On Fri Feb 23 2024, Maciej Fijalkowski wrote:
> On Thu, Feb 22, 2024 at 11:53:14AM -0800, Stanislav Fomichev wrote:
>> On Thu, Feb 22, 2024 at 1:45 AM Kurt Kanzenbach <kurt@linutronix.de> wrote:
>> >
>> > Currently using XDP/ZC sockets on stmmac results in a kernel crash:
>> >
>> > |[ 255.822584] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
>
> would be good to explain where it comes from, no?
Sure, no problem.
Thanks,
Kurt
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-25 10:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22 9:45 [PATCH net] net: stmmac: Complete meta data only when enabled Kurt Kanzenbach
2024-02-22 19:53 ` Stanislav Fomichev
2024-02-23 16:45 ` Maciej Fijalkowski
2024-02-25 10:55 ` Kurt Kanzenbach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).