2020-10-26 15:10:37

by Aleksandr Nogikh

[permalink] [raw]
Subject: [PATCH v3 0/3] net, mac80211, kernel: enable KCOV remote coverage collection for 802.11 frame handling

From: Aleksandr Nogikh <[email protected]>

This patch series enables remote KCOV coverage collection during
802.11 frames processing. These changes make it possible to perform
coverage-guided fuzzing in search of remotely triggerable bugs.

Normally, KCOV collects coverage information for the code that is
executed inside the system call context. It is easy to identify where
that coverage should go and whether it should be collected at all by
looking at the current process. If KCOV was enabled on that process,
coverage will be stored in a buffer specific to that process.
Howerever, it is not always enough as handling can happen elsewhere
(e.g. in separate kernel threads).

When it is impossible to infer KCOV-related info just by looking at
the currently running process, one needs to manually pass some
information to the code that should be instrumented. The information
takes the form of 64 bit integers (KCOV remote handles). Zero is the
special value that corresponds to an empty handle. More details on
KCOV and remote coverage collection can be found in
Documentation/dev-tools/kcov.rst.

The series consists of three commits.
1. Apply a minor fix to kcov_common_handle() so that it returns a
valid handle (zero) when called in an interrupt context.
2. Take the remote handle from KCOV and attach it to newly allocated
SKBs as an skb extension. If the allocation happens inside a system
call context, the SKB will be tied to the process that issued the
syscall (if that process is interested in remote coverage collection).
3. Annotate the code that processes incoming 802.11 frames with
kcov_remote_start()/kcov_remote_stop()

v3:
* kcov_handle is now stored in skb extensions instead of sk_buff
itself.
* Updated the cover letter.

v2:
https://lkml.kernel.org/r/[email protected]
* Moved KCOV annotations from ieee80211_tasklet_handler to
ieee80211_rx.
* Updated kcov_common_handle() to return 0 if it is called in
interrupt context.
* Updated the cover letter.

v1:
https://lkml.kernel.org/r/[email protected]

Aleksandr Nogikh (3):
kernel: make kcov_common_handle consider the current context
net: add kcov handle to skb extensions
mac80211: add KCOV remote annotations to incoming frame processing

include/linux/skbuff.h | 31 +++++++++++++++++++++++++++++++
include/net/mac80211.h | 2 ++
kernel/kcov.c | 2 ++
net/core/skbuff.c | 11 +++++++++++
net/mac80211/iface.c | 2 ++
5 files changed, 48 insertions(+)


base-commit: 2ef991b5fdbe828dc8fb8af473dab160729570ed
--
2.29.0.rc1.297.gfa9743e501-goog


2020-10-26 15:11:30

by Aleksandr Nogikh

[permalink] [raw]
Subject: [PATCH v3 2/3] net: add kcov handle to skb extensions

From: Aleksandr Nogikh <[email protected]>

Remote KCOV coverage collection enables coverage-guided fuzzing of the
code that is not reachable during normal system call execution. It is
especially helpful for fuzzing networking subsystems, where it is
common to perform packet handling in separate work queues even for the
packets that originated directly from the user space.

Enable coverage-guided frame injection by adding kcov remote handle to
skb extensions. Default initialization in __alloc_skb and
__build_skb_around ensures that no socket buffer that was generated
during a system call will be missed.

Code that is of interest and that performs packet processing should be
annotated with kcov_remote_start()/kcov_remote_stop().

An alternative approach is to determine kcov_handle solely on the
basis of the device/interface that received the specific socket
buffer. However, in this case it would be impossible to distinguish
between packets that originated during normal background network
processes or were intentionally injected from the user space.

Signed-off-by: Aleksandr Nogikh <[email protected]>
--
v2 -> v3:
* Reimplemented this change. Now kcov handle is added to skb
extensions instead of sk_buff.
v1 -> v2:
* Updated the commit message.
---
include/linux/skbuff.h | 31 +++++++++++++++++++++++++++++++
net/core/skbuff.c | 11 +++++++++++
2 files changed, 42 insertions(+)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a828cf99c521..b63d90faa8e9 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -4150,6 +4150,9 @@ enum skb_ext_id {
#endif
#if IS_ENABLED(CONFIG_MPTCP)
SKB_EXT_MPTCP,
+#endif
+#if IS_ENABLED(CONFIG_KCOV)
+ SKB_EXT_KCOV_HANDLE,
#endif
SKB_EXT_NUM, /* must be last */
};
@@ -4605,5 +4608,33 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
#endif
}

+#ifdef CONFIG_KCOV
+
+static inline void skb_set_kcov_handle(struct sk_buff *skb, const u64 kcov_handle)
+{
+ /* No reason to allocate skb extensions to set kcov_handle if kcov_handle is 0. */
+ if (skb_has_extensions(skb) || kcov_handle) {
+ u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
+
+ if (kcov_handle_ptr)
+ *kcov_handle_ptr = kcov_handle;
+ }
+}
+
+static inline u64 skb_get_kcov_handle(struct sk_buff *skb)
+{
+ u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
+
+ return kcov_handle ? *kcov_handle : 0;
+}
+
+#else
+
+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 /* __KERNEL__ */
#endif /* _LINUX_SKBUFF_H */
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1ba8f0163744..c5e6c0b83a92 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -249,6 +249,9 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,

fclones->skb2.fclone = SKB_FCLONE_CLONE;
}
+
+ skb_set_kcov_handle(skb, kcov_common_handle());
+
out:
return skb;
nodata:
@@ -282,6 +285,8 @@ static struct sk_buff *__build_skb_around(struct sk_buff *skb,
memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
atomic_set(&shinfo->dataref, 1);

+ skb_set_kcov_handle(skb, kcov_common_handle());
+
return skb;
}

@@ -4203,6 +4208,9 @@ static const u8 skb_ext_type_len[] = {
#if IS_ENABLED(CONFIG_MPTCP)
[SKB_EXT_MPTCP] = SKB_EXT_CHUNKSIZEOF(struct mptcp_ext),
#endif
+#if IS_ENABLED(CONFIG_KCOV)
+ [SKB_EXT_KCOV_HANDLE] = SKB_EXT_CHUNKSIZEOF(u64),
+#endif
};

static __always_inline unsigned int skb_ext_total_length(void)
@@ -4219,6 +4227,9 @@ static __always_inline unsigned int skb_ext_total_length(void)
#endif
#if IS_ENABLED(CONFIG_MPTCP)
skb_ext_type_len[SKB_EXT_MPTCP] +
+#endif
+#if IS_ENABLED(CONFIG_KCOV)
+ skb_ext_type_len[SKB_EXT_KCOV_HANDLE] +
#endif
0;
}
--
2.29.0.rc1.297.gfa9743e501-goog

2020-10-26 15:13:43

by Aleksandr Nogikh

[permalink] [raw]
Subject: [PATCH v3 3/3] mac80211: add KCOV remote annotations to incoming frame processing

From: Aleksandr Nogikh <[email protected]>

Add KCOV remote annotations to ieee80211_iface_work and
ieee80211_rx. This will enable coverage-guided fuzzing of
mac80211 code that processes incoming 802.11 frames.

Signed-off-by: Aleksandr Nogikh <[email protected]>
---
v1 -> v2:
* The commit now affects ieee80211_rx instead of
ieee80211_tasklet_handler.
---
include/net/mac80211.h | 2 ++
net/mac80211/iface.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e8e295dae744..f4c37a1b381e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4499,7 +4499,9 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
*/
static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
{
+ kcov_remote_start_common(skb_get_kcov_handle(skb));
ieee80211_rx_napi(hw, NULL, skb, NULL);
+ kcov_remote_stop();
}

/**
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 1be775979132..56a1bcea2c1c 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1356,6 +1356,7 @@ static void ieee80211_iface_work(struct work_struct *work)
while ((skb = skb_dequeue(&sdata->skb_queue))) {
struct ieee80211_mgmt *mgmt = (void *)skb->data;

+ kcov_remote_start_common(skb_get_kcov_handle(skb));
if (ieee80211_is_action(mgmt->frame_control) &&
mgmt->u.action.category == WLAN_CATEGORY_BACK) {
int len = skb->len;
@@ -1465,6 +1466,7 @@ static void ieee80211_iface_work(struct work_struct *work)
}

kfree_skb(skb);
+ kcov_remote_stop();
}

/* then other type-dependent work */
--
2.29.0.rc1.297.gfa9743e501-goog

2020-10-26 15:13:50

by Aleksandr Nogikh

[permalink] [raw]
Subject: [PATCH v3 1/3] kernel: make kcov_common_handle consider the current context

From: Aleksandr Nogikh <[email protected]>

kcov_common_handle is a method that is used to obtain a "default" KCOV
remote handle of the current process. The handle can later be passed
to kcov_remote_start in order to collect coverage for the processing
that is initiated by one process, but done in another. For details see
Documentation/dev-tools/kcov.rst and comments in kernel/kcov.c.

Presently, if kcov_common_handle is called in an IRQ context, it will
return a handle for the interrupted process. This may lead to
unreliable and incorrect coverage collection.

Adjust the behavior of kcov_common_handle in the following way. If it
is called in a task context, return the common handle for the
currently running task. Otherwise, return 0.

Signed-off-by: Aleksandr Nogikh <[email protected]>
Reviewed-by: Andrey Konovalov <[email protected]>
---
kernel/kcov.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/kcov.c b/kernel/kcov.c
index 6b8368be89c8..80bfe71bbe13 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -1023,6 +1023,8 @@ EXPORT_SYMBOL(kcov_remote_stop);
/* See the comment before kcov_remote_start() for usage details. */
u64 kcov_common_handle(void)
{
+ if (!in_task())
+ return 0;
return current->kcov_handle;
}
EXPORT_SYMBOL(kcov_common_handle);
--
2.29.0.rc1.297.gfa9743e501-goog

2020-10-26 19:52:13

by Willem de Bruijn

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] net: add kcov handle to skb extensions

On Mon, Oct 26, 2020 at 11:11 AM Aleksandr Nogikh
<[email protected]> wrote:
>
> From: Aleksandr Nogikh <[email protected]>
>
> Remote KCOV coverage collection enables coverage-guided fuzzing of the
> code that is not reachable during normal system call execution. It is
> especially helpful for fuzzing networking subsystems, where it is
> common to perform packet handling in separate work queues even for the
> packets that originated directly from the user space.
>
> Enable coverage-guided frame injection by adding kcov remote handle to
> skb extensions. Default initialization in __alloc_skb and
> __build_skb_around ensures that no socket buffer that was generated
> during a system call will be missed.
>
> Code that is of interest and that performs packet processing should be
> annotated with kcov_remote_start()/kcov_remote_stop().
>
> An alternative approach is to determine kcov_handle solely on the
> basis of the device/interface that received the specific socket
> buffer. However, in this case it would be impossible to distinguish
> between packets that originated during normal background network
> processes or were intentionally injected from the user space.
>
> Signed-off-by: Aleksandr Nogikh <[email protected]>
> --
> v2 -> v3:
> * Reimplemented this change. Now kcov handle is added to skb
> extensions instead of sk_buff.
> v1 -> v2:
> * Updated the commit message.
> ---
> include/linux/skbuff.h | 31 +++++++++++++++++++++++++++++++
> net/core/skbuff.c | 11 +++++++++++
> 2 files changed, 42 insertions(+)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index a828cf99c521..b63d90faa8e9 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -4150,6 +4150,9 @@ enum skb_ext_id {
> #endif
> #if IS_ENABLED(CONFIG_MPTCP)
> SKB_EXT_MPTCP,
> +#endif
> +#if IS_ENABLED(CONFIG_KCOV)
> + SKB_EXT_KCOV_HANDLE,
> #endif
> SKB_EXT_NUM, /* must be last */
> };
> @@ -4605,5 +4608,33 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
> #endif
> }
>
> +#ifdef CONFIG_KCOV
> +
> +static inline void skb_set_kcov_handle(struct sk_buff *skb, const u64 kcov_handle)
> +{
> + /* No reason to allocate skb extensions to set kcov_handle if kcov_handle is 0. */

If the handle does not need to be set if zero, why then set it if the
skb has extensions?

> + if (skb_has_extensions(skb) || kcov_handle) {
> + u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);

skb_ext_add and skb_ext_find are not defined unless CONFIG_SKB_EXTENSIONS.

Perhaps CONFIG_KCOV should be made to select that?




> +
> + if (kcov_handle_ptr)
> + *kcov_handle_ptr = kcov_handle;
> + }
> +}
> +
> +static inline u64 skb_get_kcov_handle(struct sk_buff *skb)
> +{
> + u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
> +
> + return kcov_handle ? *kcov_handle : 0;
> +}
> +
> +#else
> +
> +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 */

2020-10-26 20:17:55

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] net: add kcov handle to skb extensions

Hi Aleksandr,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 2ef991b5fdbe828dc8fb8af473dab160729570ed]

url: https://github.com/0day-ci/linux/commits/Aleksandr-Nogikh/net-mac80211-kernel-enable-KCOV-remote-coverage-collection-for-802-11-frame-handling/20201026-231134
base: 2ef991b5fdbe828dc8fb8af473dab160729570ed
config: x86_64-randconfig-a001-20201026 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project f2c25c70791de95d2466e09b5b58fc37f6ccd7a4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/46d348800b64931071128ba47a5f17641d288a2f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Aleksandr-Nogikh/net-mac80211-kernel-enable-KCOV-remote-coverage-collection-for-802-11-frame-handling/20201026-231134
git checkout 46d348800b64931071128ba47a5f17641d288a2f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

In file included from drivers/vdpa/vdpa_sim/vdpa_sim.c:24:
In file included from include/linux/etherdevice.h:20:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/vdpa/vdpa_sim/vdpa_sim.c:364:27: warning: shift count >= width of type [-Wshift-count-overflow]
dev->coherent_dma_mask = DMA_BIT_MASK(64);
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
1 warning and 4 errors generated.
--
In file included from drivers/net/ethernet/intel/e1000/e1000_main.c:4:
In file included from drivers/net/ethernet/intel/e1000/e1000.h:18:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/intel/e1000/e1000_main.c:1002:45: warning: shift count >= width of type [-Wshift-count-overflow]
!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/net/ethernet/intel/e1000/e1000_main.c:1002:45: warning: shift count >= width of type [-Wshift-count-overflow]
!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/net/ethernet/intel/e1000/e1000_main.c:1002:45: warning: shift count >= width of type [-Wshift-count-overflow]
!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
~~~~~~~~~~~~~~~~~^~~~~
include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
(cond) ? \
^~~~
3 warnings and 4 errors generated.
--
In file included from net/ipv4/fib_trie.c:49:
In file included from include/linux/inet.h:42:
In file included from include/net/net_namespace.h:39:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> net/ipv4/fib_trie.c:324:13: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 2305843009213693946 to 4294967290 [-Wconstant-conversion]
if (bits > TNODE_VMALLOC_MAX)
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
net/ipv4/fib_trie.c:305:35: note: expanded from macro 'TNODE_VMALLOC_MAX'
ilog2((SIZE_MAX - TNODE_SIZE(0)) / sizeof(struct key_vector *))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/log2.h:161:14: note: expanded from macro 'ilog2'
__ilog2_u32(n) : \
~~~~~~~~~~~ ^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
~~~~~~~~~~~~~~~~~^~~~~
include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
(cond) ? \
^~~~
>> net/ipv4/fib_trie.c:324:13: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 2305843009213693946 to 4294967290 [-Wconstant-conversion]
if (bits > TNODE_VMALLOC_MAX)
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
net/ipv4/fib_trie.c:305:35: note: expanded from macro 'TNODE_VMALLOC_MAX'
ilog2((SIZE_MAX - TNODE_SIZE(0)) / sizeof(struct key_vector *))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/log2.h:161:14: note: expanded from macro 'ilog2'
__ilog2_u32(n) : \
~~~~~~~~~~~ ^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> net/ipv4/fib_trie.c:324:13: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 2305843009213693946 to 4294967290 [-Wconstant-conversion]
if (bits > TNODE_VMALLOC_MAX)
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
net/ipv4/fib_trie.c:305:35: note: expanded from macro 'TNODE_VMALLOC_MAX'
ilog2((SIZE_MAX - TNODE_SIZE(0)) / sizeof(struct key_vector *))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/log2.h:161:14: note: expanded from macro 'ilog2'
__ilog2_u32(n) : \
~~~~~~~~~~~ ^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
3 warnings and 4 errors generated.

vim +364 drivers/vdpa/vdpa_sim/vdpa_sim.c

2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 342
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 343 static struct vdpasim *vdpasim_create(void)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 344 {
de91a4d0e725db drivers/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-08-04 345 const struct vdpa_config_ops *ops;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 346 struct vdpasim *vdpasim;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 347 struct device *dev;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 348 int ret = -ENOMEM;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 349
de91a4d0e725db drivers/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-08-04 350 if (batch_mapping)
de91a4d0e725db drivers/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-08-04 351 ops = &vdpasim_net_batch_config_ops;
de91a4d0e725db drivers/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-08-04 352 else
de91a4d0e725db drivers/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-08-04 353 ops = &vdpasim_net_config_ops;
de91a4d0e725db drivers/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-08-04 354
a9974489b61c09 drivers/vdpa/vdpa_sim/vdpa_sim.c Max Gurtovoy 2020-08-04 355 vdpasim = vdpa_alloc_device(struct vdpasim, vdpa, NULL, ops, VDPASIM_VQ_NUM);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 356 if (!vdpasim)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 357 goto err_alloc;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 358
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 359 INIT_WORK(&vdpasim->work, vdpasim_work);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 360 spin_lock_init(&vdpasim->lock);
1e3e792650d2c0 drivers/vdpa/vdpa_sim/vdpa_sim.c Michael S. Tsirkin 2020-08-10 361 spin_lock_init(&vdpasim->iommu_lock);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 362
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 363 dev = &vdpasim->vdpa.dev;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 @364 dev->coherent_dma_mask = DMA_BIT_MASK(64);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 365 set_dma_ops(dev, &vdpasim_dma_ops);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 366
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 367 vdpasim->iommu = vhost_iotlb_alloc(2048, 0);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 368 if (!vdpasim->iommu)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 369 goto err_iommu;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 370
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 371 vdpasim->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 372 if (!vdpasim->buffer)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 373 goto err_iommu;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 374
5d7d0f387ae1b9 drivers/vdpa/vdpa_sim/vdpa_sim.c Michael S. Tsirkin 2020-07-12 375 eth_random_addr(vdpasim->config.mac);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 376
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 377 vringh_set_iotlb(&vdpasim->vqs[0].vring, vdpasim->iommu);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 378 vringh_set_iotlb(&vdpasim->vqs[1].vring, vdpasim->iommu);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 379
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 380 vdpasim->vdpa.dma_dev = dev;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 381 ret = vdpa_register_device(&vdpasim->vdpa);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 382 if (ret)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 383 goto err_iommu;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 384
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 385 return vdpasim;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 386
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 387 err_iommu:
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 388 put_device(dev);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 389 err_alloc:
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 390 return ERR_PTR(ret);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 391 }
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26 392

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (17.66 kB)
.config.gz (36.28 kB)
Download all attachments

2020-10-26 23:53:36

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] net: add kcov handle to skb extensions

Hi Aleksandr,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 2ef991b5fdbe828dc8fb8af473dab160729570ed]

url: https://github.com/0day-ci/linux/commits/Aleksandr-Nogikh/net-mac80211-kernel-enable-KCOV-remote-coverage-collection-for-802-11-frame-handling/20201026-231134
base: 2ef991b5fdbe828dc8fb8af473dab160729570ed
config: x86_64-randconfig-a004-20201026 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project f2c25c70791de95d2466e09b5b58fc37f6ccd7a4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/46d348800b64931071128ba47a5f17641d288a2f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Aleksandr-Nogikh/net-mac80211-kernel-enable-KCOV-remote-coverage-collection-for-802-11-frame-handling/20201026-231134
git checkout 46d348800b64931071128ba47a5f17641d288a2f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

In file included from drivers/net/ethernet/jme.c:17:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/jme.c:2863:30: warning: shift count >= width of type [-Wshift-count-overflow]
!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/net/ethernet/jme.c:2864:42: warning: shift count >= width of type [-Wshift-count-overflow]
if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 4 errors generated.
--
In file included from drivers/media/pci/ddbridge/ddbridge-main.c:35:
In file included from drivers/media/pci/ddbridge/ddbridge.h:56:
In file included from include/media/dvb_net.h:22:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/media/pci/ddbridge/ddbridge-main.c:183:29: warning: shift count >= width of type [-Wshift-count-overflow]
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
1 warning and 4 errors generated.
--
In file included from drivers/net/ethernet/broadcom/tg3.c:38:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/broadcom/tg3.c:17768:33: warning: shift count >= width of type [-Wshift-count-overflow]
persist_dma_mask = dma_mask = DMA_BIT_MASK(64);
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
1 warning and 4 errors generated.
--
In file included from drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c:13:
In file included from drivers/net/ethernet/aquantia/atlantic/aq_main.h:12:
In file included from drivers/net/ethernet/aquantia/atlantic/aq_common.h:13:
In file included from include/linux/etherdevice.h:20:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c:122:31: warning: shift count >= width of type [-Wshift-count-overflow]
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c:124:43: warning: shift count >= width of type [-Wshift-count-overflow]
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 4 errors generated.
--
In file included from drivers/net/ethernet/brocade/bna/bnad.c:12:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/brocade/bna/bnad.c:3559:45: warning: shift count >= width of type [-Wshift-count-overflow]
if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
1 warning and 4 errors generated.
--
In file included from drivers/net/ethernet/atheros/alx/main.c:38:
In file included from include/linux/ip.h:16:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/atheros/alx/main.c:1707:45: warning: shift count >= width of type [-Wshift-count-overflow]
if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
1 warning and 4 errors generated.
--
In file included from drivers/net/ethernet/marvell/skge.c:20:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/marvell/skge.c:3894:51: warning: shift count >= width of type [-Wshift-count-overflow]
if (!only_32bit_dma && !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/net/ethernet/marvell/skge.c:3896:43: warning: shift count >= width of type [-Wshift-count-overflow]
err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 4 errors generated.
--
In file included from drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:42:
In file included from include/linux/etherdevice.h:20:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:6692:30: warning: shift count >= width of type [-Wshift-count-overflow]
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:6694:43: warning: shift count >= width of type [-Wshift-count-overflow]
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 4 errors generated.
--
In file included from drivers/net/ethernet/cavium/liquidio/lio_main.c:22:
In file included from include/net/vxlan.h:5:
In file included from include/linux/if_vlan.h:10:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/cavium/liquidio/lio_main.c:1401:52: warning: shift count >= width of type [-Wshift-count-overflow]
if (dma_set_mask_and_coherent(&oct->pci_dev->dev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
1 warning and 4 errors generated.
--
In file included from drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c:43:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c:2920:31: warning: shift count >= width of type [-Wshift-count-overflow]
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c:2922:43: warning: shift count >= width of type [-Wshift-count-overflow]
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 4 errors generated.
--
In file included from drivers/net/ethernet/neterion/s2io.c:62:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
include/linux/skbuff.h:4617:26: error: implicit declaration of function 'skb_ext_add' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4617:43: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:21: error: implicit declaration of function 'skb_ext_find' [-Werror,-Wimplicit-function-declaration]
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
include/linux/skbuff.h:4626:39: error: use of undeclared identifier 'SKB_EXT_KCOV_HANDLE'
u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
^
>> drivers/net/ethernet/neterion/s2io.c:7669:32: warning: shift count >= width of type [-Wshift-count-overflow]
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/net/ethernet/neterion/s2io.c:7672:41: warning: shift count >= width of type [-Wshift-count-overflow]
if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 4 errors generated.
..

vim +2863 drivers/net/ethernet/jme.c

95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2858
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2859 static int
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2860 jme_pci_dma64(struct pci_dev *pdev)
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2861 {
814c01dc7c53303 drivers/net/jme.c Guo-Fu Tseng 2009-02-27 2862 if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 &&
e930438c42e744e drivers/net/jme.c Yang Hongyang 2009-04-13 @2863 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
e930438c42e744e drivers/net/jme.c Yang Hongyang 2009-04-13 2864 if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
814c01dc7c53303 drivers/net/jme.c Guo-Fu Tseng 2009-02-27 2865 return 1;
814c01dc7c53303 drivers/net/jme.c Guo-Fu Tseng 2009-02-27 2866
814c01dc7c53303 drivers/net/jme.c Guo-Fu Tseng 2009-02-27 2867 if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 &&
e930438c42e744e drivers/net/jme.c Yang Hongyang 2009-04-13 2868 !pci_set_dma_mask(pdev, DMA_BIT_MASK(40)))
e930438c42e744e drivers/net/jme.c Yang Hongyang 2009-04-13 2869 if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40)))
814c01dc7c53303 drivers/net/jme.c Guo-Fu Tseng 2009-02-27 2870 return 1;
814c01dc7c53303 drivers/net/jme.c Guo-Fu Tseng 2009-02-27 2871
284901a90a9e0b8 drivers/net/jme.c Yang Hongyang 2009-04-06 2872 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
284901a90a9e0b8 drivers/net/jme.c Yang Hongyang 2009-04-06 2873 if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2874 return 0;
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2875
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2876 return -1;
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2877 }
95252236e73e789 drivers/net/jme.c Guo-Fu Tseng 2008-09-16 2878

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (25.16 kB)
.config.gz (39.93 kB)
Download all attachments

2020-10-27 14:48:50

by Aleksandr Nogikh

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] net: add kcov handle to skb extensions

On Mon, Oct 26, 2020 at 7:57 PM Willem de Bruijn
<[email protected]> wrote:
[...]
> If the handle does not need to be set if zero, why then set it if the
> skb has extensions?

The point of that condition is to avoid unnecessary allocations of skb extension
objects. At the same time, one would expect skb_get_kcov_handle to return the
latest value that was set via skb_set_kcov_handle. So if a buffer already has a
non-zero kcov_handle and skb_set_kcov_handle is called to set it to zero, it
should be set to zero.

> skb_ext_add and skb_ext_find are not defined unless CONFIG_SKB_EXTENSIONS.
>
> Perhaps CONFIG_KCOV should be made to select that?

Yes, thank you for pointing it out. I’ll fix it in the next version.

2020-10-27 14:52:40

by Willem de Bruijn

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] net: add kcov handle to skb extensions

On Tue, Oct 27, 2020 at 8:31 AM Aleksandr Nogikh <[email protected]> wrote:
>
> On Mon, Oct 26, 2020 at 7:57 PM Willem de Bruijn
> <[email protected]> wrote:
> [...]
> > If the handle does not need to be set if zero, why then set it if the
> > skb has extensions?
>
> The point of that condition is to avoid unnecessary allocations of skb extension
> objects. At the same time, one would expect skb_get_kcov_handle to return the
> latest value that was set via skb_set_kcov_handle. So if a buffer already has a
> non-zero kcov_handle and skb_set_kcov_handle is called to set it to zero, it
> should be set to zero.

I see. I thought it was some best effort approach: if there happens to
be space, use it, but don't allocate. Which I did not understand.
Could you rephrase the comment to make more clear that this is about
clearing a possibly previously set value.


> > skb_ext_add and skb_ext_find are not defined unless CONFIG_SKB_EXTENSIONS.
> >
> > Perhaps CONFIG_KCOV should be made to select that?
>
> Yes, thank you for pointing it out. I’ll fix it in the next version.