diff mbox series

net: skbuff: fix missing a __noreturn annotation warning

Message ID 20230527110409.497408-1-linmiaohe@huawei.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series net: skbuff: fix missing a __noreturn annotation warning | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 10 this patch: 10
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 10 this patch: 10
netdev/checkpatch warning WARNING: line length of 82 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Miaohe Lin May 27, 2023, 11:04 a.m. UTC
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

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 net/core/skbuff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kuniyuki Iwashima May 27, 2023, 4 a.m. UTC | #1
From: Miaohe Lin <linmiaohe@huawei.com>
Date: Sat, 27 May 2023 19:04:09 +0800
> 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


> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  net/core/skbuff.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 6724a84ebb09..12b525aa4783 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -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,
> -- 
> 2.27.0
Miaohe Lin May 27, 2023, 9:22 a.m. UTC | #2
On 2023/5/27 12:00, Kuniyuki Iwashima wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> Date: Sat, 27 May 2023 19:04:09 +0800
>> 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().

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.

> 
> Thanks,
> Kuniyuki
> 
> 
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>  net/core/skbuff.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
>> index 6724a84ebb09..12b525aa4783 100644
>> --- a/net/core/skbuff.c
>> +++ b/net/core/skbuff.c
>> @@ -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,
>> -- 
>> 2.27.0
> .
>
Paolo Abeni May 30, 2023, 10:28 a.m. UTC | #3
On Fri, 2023-05-26 at 21:00 -0700, Kuniyuki Iwashima wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> Date: Sat, 27 May 2023 19:04:09 +0800
> > 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().

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
Miaohe Lin June 3, 2023, 3:09 a.m. UTC | #4
On 2023/5/30 18:28, Paolo Abeni wrote:
> On Fri, 2023-05-26 at 21:00 -0700, Kuniyuki Iwashima wrote:
>> From: Miaohe Lin <linmiaohe@huawei.com>
>> Date: Sat, 27 May 2023 19:04:09 +0800
>>> 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().
> 
> 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.

> 
> I think we can drop this patch.
> 
> Cheers,
> 
> Paolo
> 
> .
>
diff mbox series

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6724a84ebb09..12b525aa4783 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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,