Skip to contentSkip to conversation

net: skbuff: fix missing a __noreturn annotation warning

PATCH In review Miaohe Lin 3 participants 5 messages May 27, 2023 – Jun 3, 2023

Subsystems (2)
lore
Share & tools
lore

Miaohe Lin

author
#0 lore raw

PATCH 1/1 net: skbuff: fix missing a __noreturn annotation warning

Add __noreturn annotation to fix the warning:
net/core/skbuff.o: warning: objtool: skb_push+0x3c: skb_panic() is missing a __noreturn annotation net/core/skbuff.o: warning: objtool: skb_put+0x4e: skb_panic() is missing a __noreturn annotation

---
 net/core/skbuff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/skbuff.c +2 -2
index 6724a84ebb09..12b525aa4783 100644
@@ -181,8 +181,8 @@ EXPORT_SYMBOL_GPL(drop_reasons_unregister_subsys);
  *	Keep out of line to prevent kernel bloat.
  *	__builtin_return_address is not used because it is not always reliable.
  */
-static void skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
-		      const char msg[])
+static void __noreturn skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
+				 const char msg[])
 {
 	pr_emerg("%s: text:%px len:%d put:%d head:%px data:%px tail:%#lx end:%#lx dev:%s\n",
 		 msg, addr, skb->len, sz, skb->head, skb->data,
Signature · 1 line
2.27.0
#1 lore raw

From: Miaohe Lin <[email protected]>
Date: Sat, 27 May 2023 19:04:09 +0800

Quoted 3 lines

Add __noreturn annotation to fix the warning:
net/core/skbuff.o: warning: objtool: skb_push+0x3c: skb_panic() is missing a __noreturn annotation net/core/skbuff.o: warning: objtool: skb_put+0x4e: skb_panic() is missing a __noreturn annotation

What arch are you using ?

IIUC, BUG() should have an annotation for objtool, for example, __builtin_unreachable() for x86.

Maybe the arch is missing such an annotation ?

Also I'm curious why objtool complains about only skb_push(), there should be more non-inline functions that has BUG().

Thanks,
Kuniyuki

Quoted 23 lines
---
 net/core/skbuff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/skbuff.c +2 -2
index 6724a84ebb09..12b525aa4783 100644
@@ -181,8 +181,8 @@ EXPORT_SYMBOL_GPL(drop_reasons_unregister_subsys);
  *	Keep out of line to prevent kernel bloat.
  *	__builtin_return_address is not used because it is not always reliable.
  */
-static void skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
-		      const char msg[])
+static void __noreturn skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
+				 const char msg[])
 {
 	pr_emerg("%s: text:%px len:%d put:%d head:%px data:%px tail:%#lx end:%#lx dev:%s\n",
 		 msg, addr, skb->len, sz, skb->head, skb->data,
Signature · 1 line
2.27.0
author
#2 lore raw
Quoted 8 lines · Kuniyuki Iwashima

From: Miaohe Lin <[email protected]>
Date: Sat, 27 May 2023 19:04:09 +0800

Quoted 3 lines

Add __noreturn annotation to fix the warning:
net/core/skbuff.o: warning: objtool: skb_push+0x3c: skb_panic() is missing a __noreturn annotation net/core/skbuff.o: warning: objtool: skb_put+0x4e: skb_panic() is missing a __noreturn annotation

What arch are you using ?

Quoted 7 lines

IIUC, BUG() should have an annotation for objtool, for example, __builtin_unreachable() for x86.

Maybe the arch is missing such an annotation ?

Also I'm curious why objtool complains about only skb_push(), there should be more non-inline functions that has BUG().

I'm not really sure. I was just compiling the kernel using my old gcc (GCC) 7.3.0 and saw this warning. Maybe this warning is just false positive.

Thanks.

Quoted 30 lines

Thanks,
Kuniyuki

Quoted 23 lines
---
 net/core/skbuff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/skbuff.c +2 -2
index 6724a84ebb09..12b525aa4783 100644
@@ -181,8 +181,8 @@ EXPORT_SYMBOL_GPL(drop_reasons_unregister_subsys);
  *	Keep out of line to prevent kernel bloat.
  *	__builtin_return_address is not used because it is not always reliable.
  */
-static void skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
-		      const char msg[])
+static void __noreturn skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
+				 const char msg[])
 {
 	pr_emerg("%s: text:%px len:%d put:%d head:%px data:%px tail:%#lx end:%#lx dev:%s\n",
 		 msg, addr, skb->len, sz, skb->head, skb->data,
Signature · 1 line
2.27.0

.

maintainer
#3 lore raw
In reply to Kuniyuki Iwashima
Quoted 8 lines · Kuniyuki Iwashima

From: Miaohe Lin <[email protected]>
Date: Sat, 27 May 2023 19:04:09 +0800

Quoted 3 lines

Add __noreturn annotation to fix the warning:
net/core/skbuff.o: warning: objtool: skb_push+0x3c: skb_panic() is missing a __noreturn annotation net/core/skbuff.o: warning: objtool: skb_put+0x4e: skb_panic() is missing a __noreturn annotation

What arch are you using ?

Quoted 7 lines

IIUC, BUG() should have an annotation for objtool, for example, __builtin_unreachable() for x86.

Maybe the arch is missing such an annotation ?

Also I'm curious why objtool complains about only skb_push(), there should be more non-inline functions that has BUG().

AFAICS, the BUG() macro implementation should already carry the __noreturn annotation, via panic() or other arch-specific way.

This looks like the old toolchain not being able to successfully/correctly propagate the annotation???

I think we can drop this patch.

Cheers,

Paolo

author
#4 lore raw
Quoted 14 lines · Paolo Abeni
Quoted 13 lines · Kuniyuki Iwashima

From: Miaohe Lin <[email protected]>
Date: Sat, 27 May 2023 19:04:09 +0800

Quoted 3 lines

Add __noreturn annotation to fix the warning:
net/core/skbuff.o: warning: objtool: skb_push+0x3c: skb_panic() is missing a __noreturn annotation net/core/skbuff.o: warning: objtool: skb_put+0x4e: skb_panic() is missing a __noreturn annotation

What arch are you using ?

IIUC, BUG() should have an annotation for objtool, for example, __builtin_unreachable() for x86.

Maybe the arch is missing such an annotation ?

Quoted 8 lines
Quoted 2 lines

Also I'm curious why objtool complains about only skb_push(), there should be more non-inline functions that has BUG().

AFAICS, the BUG() macro implementation should already carry the __noreturn annotation, via panic() or other arch-specific way.

This looks like the old toolchain not being able to successfully/correctly propagate the annotation???

I tend to agree with you. Will drop it. Thanks for your comment.

Quoted 9 lines

I think we can drop this patch.

Cheers,

Paolo

.