All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] net: skbuff: fix missing a __noreturn annotation warning
  2023-05-27 11:04 [PATCH] net: skbuff: fix missing a __noreturn annotation warning Miaohe Lin
@ 2023-05-27  4:00 ` Kuniyuki Iwashima
  2023-05-27  9:22   ` Miaohe Lin
  2023-05-30 10:28   ` Paolo Abeni
  0 siblings, 2 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2023-05-27  4:00 UTC (permalink / raw)
  To: linmiaohe; +Cc: davem, edumazet, kuba, linux-kernel, netdev, pabeni, kuniyu

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: skbuff: fix missing a __noreturn annotation warning
  2023-05-27  4:00 ` Kuniyuki Iwashima
@ 2023-05-27  9:22   ` Miaohe Lin
  2023-05-30 10:28   ` Paolo Abeni
  1 sibling, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2023-05-27  9:22 UTC (permalink / raw)
  To: Kuniyuki Iwashima; +Cc: davem, edumazet, kuba, linux-kernel, netdev, pabeni

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
> .
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] net: skbuff: fix missing a __noreturn annotation warning
@ 2023-05-27 11:04 Miaohe Lin
  2023-05-27  4:00 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 5+ messages in thread
From: Miaohe Lin @ 2023-05-27 11:04 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel, linmiaohe

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(-)

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: skbuff: fix missing a __noreturn annotation warning
  2023-05-27  4:00 ` Kuniyuki Iwashima
  2023-05-27  9:22   ` Miaohe Lin
@ 2023-05-30 10:28   ` Paolo Abeni
  2023-06-03  3:09     ` Miaohe Lin
  1 sibling, 1 reply; 5+ messages in thread
From: Paolo Abeni @ 2023-05-30 10:28 UTC (permalink / raw)
  To: Kuniyuki Iwashima, linmiaohe; +Cc: davem, edumazet, kuba, linux-kernel, netdev

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: skbuff: fix missing a __noreturn annotation warning
  2023-05-30 10:28   ` Paolo Abeni
@ 2023-06-03  3:09     ` Miaohe Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2023-06-03  3:09 UTC (permalink / raw)
  To: Paolo Abeni, Kuniyuki Iwashima
  Cc: davem, edumazet, kuba, linux-kernel, netdev

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
> 
> .
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-03  3:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 11:04 [PATCH] net: skbuff: fix missing a __noreturn annotation warning Miaohe Lin
2023-05-27  4:00 ` Kuniyuki Iwashima
2023-05-27  9:22   ` Miaohe Lin
2023-05-30 10:28   ` Paolo Abeni
2023-06-03  3:09     ` Miaohe Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.