mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Marcello Sylvester Bauer <email@vger.kernel.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Marcello Sylvester Bauer <sylv@sylv.io>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] xfrm: Use skb_mac_header_was_set() to check for MAC header presence
Date: Tue, 05 Sep 2023 11:59:32 +0200	[thread overview]
Message-ID: <a88c3486dafcc9e7a8cb5eecf14b6e6b93a13c65.camel@redhat.com> (raw)
In-Reply-To: <0490137bbc24e95eadf01bed9c31eb1d0a856a21.1693823464.git.sylv@sylv.io>

On Mon, 2023-09-04 at 12:32 +0200, Marcello Sylvester Bauer wrote:
> From: Marcello Sylvester Bauer <sylv@sylv.io>
> 
> Add skb_mac_header_was_set() in xfrm4_remove_tunnel_encap() and
> xfrm6_remove_tunnel_encap() to detect the presence of a MAC header.
> This change prevents a kernel page fault on a non-zero mac_len when the
> mac_header is not set.
> 
> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>

Please include a suitable fixes tag.

Please also include in the commit message the stacktrace:

https://lore.kernel.org/netdev/636d3434-d47a-4cd4-b3ba-7f7254317b64@sylv.io/

trimming the asm code and lines starting with ' ? ' 

I think the real issue could be elsewhere, we should not reach here
with mac_len > 0 && !skb_mac_header_was_set().

Could you please try the following debug patch in your setup, and see
if hints at some other relevant place? 

Thanks,

Paolo

---
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4174c4b82d13..38ca2c7e50ca 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2793,6 +2793,7 @@ static inline void skb_reset_inner_headers(struct sk_buff *skb)
 
 static inline void skb_reset_mac_len(struct sk_buff *skb)
 {
+	WARN_ON_ONCE(!skb_mac_header_was_set(skb));
 	skb->mac_len = skb->network_header - skb->mac_header;
 }
 


  reply	other threads:[~2023-09-05 16:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 10:32 Marcello Sylvester Bauer
2023-09-05  9:59 ` Paolo Abeni [this message]
2023-09-05 10:13   ` Marcello Sylverster Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a88c3486dafcc9e7a8cb5eecf14b6e6b93a13c65.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=email@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=sylv@sylv.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®