2020-11-14 01:13:55

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH net-next] net: linux/skbuff.h: combine NET + KCOV handling

The previous Kconfig patch led to some other build errors as
reported by the 0day bot and my own overnight build testing.

These are all in <linux/skbuff.h> when KCOV is enabled but
NET is not enabled, so fix those by combining those conditions
in the header file.

Fixes: 6370cc3bbd8a ("net: add kcov handle to skb extensions")
Fixes: 85ce50d337d1 ("net: kcov: don't select SKB_EXTENSIONS when there is no NET")
Signed-off-by: Randy Dunlap <[email protected]>
Reported-by: kernel test robot <[email protected]>
Cc: Aleksandr Nogikh <[email protected]>
Cc: Willem de Bruijn <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
include/linux/skbuff.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--- linux-next-20201113.orig/include/linux/skbuff.h
+++ linux-next-20201113/include/linux/skbuff.h
@@ -4151,7 +4151,7 @@ enum skb_ext_id {
#if IS_ENABLED(CONFIG_MPTCP)
SKB_EXT_MPTCP,
#endif
-#if IS_ENABLED(CONFIG_KCOV)
+#if IS_ENABLED(CONFIG_KCOV) && IS_ENABLED(CONFIG_NET)
SKB_EXT_KCOV_HANDLE,
#endif
SKB_EXT_NUM, /* must be last */
@@ -4608,7 +4608,7 @@ static inline void skb_reset_redirect(st
#endif
}

-#ifdef CONFIG_KCOV
+#if IS_ENABLED(CONFIG_KCOV) && IS_ENABLED(CONFIG_NET)
static inline void skb_set_kcov_handle(struct sk_buff *skb,
const u64 kcov_handle)
{
@@ -4636,7 +4636,7 @@ static inline u64 skb_get_kcov_handle(st
static inline void skb_set_kcov_handle(struct sk_buff *skb,
const u64 kcov_handle) { }
static inline u64 skb_get_kcov_handle(struct sk_buff *skb) { return 0; }
-#endif /* CONFIG_KCOV */
+#endif /* CONFIG_KCOV && CONFIG_NET */

#endif /* __KERNEL__ */
#endif /* _LINUX_SKBUFF_H */


2020-11-14 08:09:26

by Matthieu Baerts

[permalink] [raw]
Subject: Re: [PATCH net-next] net: linux/skbuff.h: combine NET + KCOV handling

Hi Randy,

On 14/11/2020 02:11, Randy Dunlap wrote:
> The previous Kconfig patch led to some other build errors as
> reported by the 0day bot and my own overnight build testing.

Thank you for looking at that!

I had the same issue and I was going to propose a similar fix with one
small difference, please see below.

> --- linux-next-20201113.orig/include/linux/skbuff.h
> +++ linux-next-20201113/include/linux/skbuff.h
> @@ -4608,7 +4608,7 @@ static inline void skb_reset_redirect(st
> #endif
> }
>
> -#ifdef CONFIG_KCOV
> +#if IS_ENABLED(CONFIG_KCOV) && IS_ENABLED(CONFIG_NET)
> static inline void skb_set_kcov_handle(struct sk_buff *skb,
Should we have here CONFIG_SKB_EXTENSIONS instead of CONFIG_NET?

It is valid to use NET thanks to your commit 85ce50d337d1 ("net: kcov:
don't select SKB_EXTENSIONS when there is no NET") that links
SKB_EXTENSIONS with NET for KCOV but it looks strange to me to use a
"non direct" dependence :)
I mean: here below, skb_ext_add() and skb_ext_find() are called but they
are defined only if SKB_EXTENSIONS is enabled, not only NET.

But as I said, this patch fixes the issue. It's fine for me if we prefer
to use CONFIG_NET.

> @@ -4636,7 +4636,7 @@ static inline u64 skb_get_kcov_handle(st
> static inline void skb_set_kcov_handle(struct sk_buff *skb,
> const u64 kcov_handle) { }
> static inline u64 skb_get_kcov_handle(struct sk_buff *skb) { return 0; }
> -#endif /* CONFIG_KCOV */
> +#endif /* CONFIG_KCOV && CONFIG_NET */

(Small detail if you post a v2: there is an extra space between "&&" and
"CONFIG_NET")

Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
http://www.tessares.net

2020-11-14 17:31:40

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH net-next] net: linux/skbuff.h: combine NET + KCOV handling

On 11/14/20 12:01 AM, Matthieu Baerts wrote:
> Hi Randy,
>
> On 14/11/2020 02:11, Randy Dunlap wrote:
>> The previous Kconfig patch led to some other build errors as
>> reported by the 0day bot and my own overnight build testing.
>
> Thank you for looking at that!
>
> I had the same issue and I was going to propose a similar fix with one small difference, please see below.
>
>> --- linux-next-20201113.orig/include/linux/skbuff.h
>> +++ linux-next-20201113/include/linux/skbuff.h
>> @@ -4608,7 +4608,7 @@ static inline void skb_reset_redirect(st
>>   #endif
>>   }
>>   -#ifdef CONFIG_KCOV
>> +#if IS_ENABLED(CONFIG_KCOV) && IS_ENABLED(CONFIG_NET)
>>   static inline void skb_set_kcov_handle(struct sk_buff *skb,
> Should we have here CONFIG_SKB_EXTENSIONS instead of CONFIG_NET?
>
> It is valid to use NET thanks to your commit 85ce50d337d1 ("net: kcov: don't select SKB_EXTENSIONS when there is no NET") that links SKB_EXTENSIONS with NET for KCOV but it looks strange to me to use a "non direct" dependence :)
> I mean: here below, skb_ext_add() and skb_ext_find() are called but they are defined only if SKB_EXTENSIONS is enabled, not only NET.
>
> But as I said, this patch fixes the issue. It's fine for me if we prefer to use CONFIG_NET.

I think it would be safer to use CONFIG_SKB_EXTENSIONS.

>> @@ -4636,7 +4636,7 @@ static inline u64 skb_get_kcov_handle(st
>>   static inline void skb_set_kcov_handle(struct sk_buff *skb,
>>                          const u64 kcov_handle) { }
>>   static inline u64 skb_get_kcov_handle(struct sk_buff *skb) { return 0; }
>> -#endif /* CONFIG_KCOV */
>> +#endif /* CONFIG_KCOV &&  CONFIG_NET */
>
> (Small detail if you post a v2: there is an extra space between "&&" and "CONFIG_NET")

Oops. Fixed in v2. Thanks for looking.

v2 on the way.

--
~Randy