All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
@ 2021-10-14  1:37 Kalesh Singh
  2021-10-14  3:55   ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kalesh Singh @ 2021-10-14  1:37 UTC (permalink / raw)
  Cc: surenb, hridya, namhyung, samitolvanen, ndesaulniers,
	kernel-team, Kalesh Singh, Steven Rostedt, Ingo Molnar,
	linux-kernel

If CONFIG_CFI_CLANG=y, attempting to read an event histogram will cause
the kernel to panic due to failed CFI check.

    1. echo 'hist:keys=common_pid' >> events/sched/sched_switch/trigger
    2. cat events/sched/sched_switch/hist
    3. kernel panics on attempting to read hist

This happens because the sort() function expects a generic
int (*)(const void *, const void *) pointer for the compare function.
To prevent this CFI failure, change tracing map cmp_entries_* function
signatures to match this.

Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
---
Changes in v2:
  - Code style clean up, per Steve
  - Commit message typo fix, per Steve

 kernel/trace/tracing_map.c | 40 ++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c
index d6bddb157ef2..4f91a81dd838 100644
--- a/kernel/trace/tracing_map.c
+++ b/kernel/trace/tracing_map.c
@@ -834,20 +834,26 @@ int tracing_map_init(struct tracing_map *map)
 	return err;
 }
 
-static int cmp_entries_dup(const struct tracing_map_sort_entry **a,
-			   const struct tracing_map_sort_entry **b)
+static int cmp_entries_dup(const void *A, const void *B)
 {
+	const struct tracing_map_sort_entry **pa = A;
+	const struct tracing_map_sort_entry **pb = B;
+	const struct tracing_map_sort_entry *a = *pa;
+	const struct tracing_map_sort_entry *b = *pb;
 	int ret = 0;
 
-	if (memcmp((*a)->key, (*b)->key, (*a)->elt->map->key_size))
+	if (memcmp(a->key, b->key, a->elt->map->key_size))
 		ret = 1;
 
 	return ret;
 }
 
-static int cmp_entries_sum(const struct tracing_map_sort_entry **a,
-			   const struct tracing_map_sort_entry **b)
+static int cmp_entries_sum(const void *A, const void *B)
 {
+	const struct tracing_map_sort_entry **pa = A;
+	const struct tracing_map_sort_entry **pb = B;
+	const struct tracing_map_sort_entry *a = *pa;
+	const struct tracing_map_sort_entry *b = *pb;
 	const struct tracing_map_elt *elt_a, *elt_b;
 	struct tracing_map_sort_key *sort_key;
 	struct tracing_map_field *field;
@@ -855,8 +861,8 @@ static int cmp_entries_sum(const struct tracing_map_sort_entry **a,
 	void *val_a, *val_b;
 	int ret = 0;
 
-	elt_a = (*a)->elt;
-	elt_b = (*b)->elt;
+	elt_a = a->elt;
+	elt_b = b->elt;
 
 	sort_key = &elt_a->map->sort_key;
 
@@ -873,9 +879,12 @@ static int cmp_entries_sum(const struct tracing_map_sort_entry **a,
 	return ret;
 }
 
-static int cmp_entries_key(const struct tracing_map_sort_entry **a,
-			   const struct tracing_map_sort_entry **b)
+static int cmp_entries_key(const void *A, const void *B)
 {
+	const struct tracing_map_sort_entry **pa = A;
+	const struct tracing_map_sort_entry **pb = B;
+	const struct tracing_map_sort_entry *a = *pa;
+	const struct tracing_map_sort_entry *b = *pb;
 	const struct tracing_map_elt *elt_a, *elt_b;
 	struct tracing_map_sort_key *sort_key;
 	struct tracing_map_field *field;
@@ -883,8 +892,8 @@ static int cmp_entries_key(const struct tracing_map_sort_entry **a,
 	void *val_a, *val_b;
 	int ret = 0;
 
-	elt_a = (*a)->elt;
-	elt_b = (*b)->elt;
+	elt_a = a->elt;
+	elt_b = b->elt;
 
 	sort_key = &elt_a->map->sort_key;
 
@@ -989,10 +998,8 @@ static void sort_secondary(struct tracing_map *map,
 			   struct tracing_map_sort_key *primary_key,
 			   struct tracing_map_sort_key *secondary_key)
 {
-	int (*primary_fn)(const struct tracing_map_sort_entry **,
-			  const struct tracing_map_sort_entry **);
-	int (*secondary_fn)(const struct tracing_map_sort_entry **,
-			    const struct tracing_map_sort_entry **);
+	int (*primary_fn)(const void *, const void *);
+	int (*secondary_fn)(const void *, const void *);
 	unsigned i, start = 0, n_sub = 1;
 
 	if (is_key(map, primary_key->field_idx))
@@ -1061,8 +1068,7 @@ int tracing_map_sort_entries(struct tracing_map *map,
 			     unsigned int n_sort_keys,
 			     struct tracing_map_sort_entry ***sort_entries)
 {
-	int (*cmp_entries_fn)(const struct tracing_map_sort_entry **,
-			      const struct tracing_map_sort_entry **);
+	int (*cmp_entries_fn)(const void *, const void *);
 	struct tracing_map_sort_entry *sort_entry, **entries;
 	int i, n_entries, ret;
 

base-commit: 348949d9a4440abdab3b1dc99a9bb660e8c7da7c
-- 
2.33.0.1079.g6e70778dc9-goog


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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
  2021-10-14  1:37 [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch Kalesh Singh
@ 2021-10-14  3:55   ` kernel test robot
  2021-10-14 10:44   ` kernel test robot
  2021-10-14 11:12   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-10-14  3:55 UTC (permalink / raw)
  To: Kalesh Singh
  Cc: kbuild-all, surenb, hridya, namhyung, samitolvanen, ndesaulniers,
	kernel-team, Kalesh Singh, Steven Rostedt, Ingo Molnar,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3697 bytes --]

Hi Kalesh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]

url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
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
        # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
        git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   kernel/trace/tracing_map.c: In function 'cmp_entries_dup':
>> kernel/trace/tracing_map.c:839:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     839 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:840:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     840 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_sum':
   kernel/trace/tracing_map.c:853:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     853 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:854:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     854 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_key':
   kernel/trace/tracing_map.c:884:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     884 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:885:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     885 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   cc1: all warnings being treated as errors


vim +/const +839 kernel/trace/tracing_map.c

   836	
   837	static int cmp_entries_dup(const void *A, const void *B)
   838	{
 > 839		const struct tracing_map_sort_entry **pa = A;
   840		const struct tracing_map_sort_entry **pb = B;
   841		const struct tracing_map_sort_entry *a = *pa;
   842		const struct tracing_map_sort_entry *b = *pb;
   843		int ret = 0;
   844	
   845		if (memcmp(a->key, b->key, a->elt->map->key_size))
   846			ret = 1;
   847	
   848		return ret;
   849	}
   850	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 72298 bytes --]

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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
@ 2021-10-14  3:55   ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-10-14  3:55 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3769 bytes --]

Hi Kalesh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]

url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
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
        # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
        git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   kernel/trace/tracing_map.c: In function 'cmp_entries_dup':
>> kernel/trace/tracing_map.c:839:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     839 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:840:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     840 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_sum':
   kernel/trace/tracing_map.c:853:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     853 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:854:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     854 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_key':
   kernel/trace/tracing_map.c:884:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     884 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:885:52: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     885 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   cc1: all warnings being treated as errors


vim +/const +839 kernel/trace/tracing_map.c

   836	
   837	static int cmp_entries_dup(const void *A, const void *B)
   838	{
 > 839		const struct tracing_map_sort_entry **pa = A;
   840		const struct tracing_map_sort_entry **pb = B;
   841		const struct tracing_map_sort_entry *a = *pa;
   842		const struct tracing_map_sort_entry *b = *pb;
   843		int ret = 0;
   844	
   845		if (memcmp(a->key, b->key, a->elt->map->key_size))
   846			ret = 1;
   847	
   848		return ret;
   849	}
   850	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 72298 bytes --]

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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
  2021-10-14  1:37 [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch Kalesh Singh
@ 2021-10-14 10:44   ` kernel test robot
  2021-10-14 10:44   ` kernel test robot
  2021-10-14 11:12   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-10-14 10:44 UTC (permalink / raw)
  To: Kalesh Singh
  Cc: llvm, kbuild-all, surenb, hridya, namhyung, samitolvanen,
	ndesaulniers, kernel-team, Kalesh Singh, Steven Rostedt,
	Ingo Molnar, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3936 bytes --]

Hi Kalesh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]

url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
config: x86_64-buildonly-randconfig-r002-20211013 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6c76d0101193aa4eb891a6954ff047eda2f9cf71)
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
        # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
        git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/trace/tracing_map.c:839:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pa = A;
                                                 ^    ~
   kernel/trace/tracing_map.c:840:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pb = B;
                                                 ^    ~
   kernel/trace/tracing_map.c:853:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pa = A;
                                                 ^    ~
   kernel/trace/tracing_map.c:854:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pb = B;
                                                 ^    ~
   kernel/trace/tracing_map.c:884:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pa = A;
                                                 ^    ~
   kernel/trace/tracing_map.c:885:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pb = B;
                                                 ^    ~
   6 errors generated.


vim +839 kernel/trace/tracing_map.c

   836	
   837	static int cmp_entries_dup(const void *A, const void *B)
   838	{
 > 839		const struct tracing_map_sort_entry **pa = A;
   840		const struct tracing_map_sort_entry **pb = B;
   841		const struct tracing_map_sort_entry *a = *pa;
   842		const struct tracing_map_sort_entry *b = *pb;
   843		int ret = 0;
   844	
   845		if (memcmp(a->key, b->key, a->elt->map->key_size))
   846			ret = 1;
   847	
   848		return ret;
   849	}
   850	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37916 bytes --]

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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
@ 2021-10-14 10:44   ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-10-14 10:44 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4005 bytes --]

Hi Kalesh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]

url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
config: x86_64-buildonly-randconfig-r002-20211013 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6c76d0101193aa4eb891a6954ff047eda2f9cf71)
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
        # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
        git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/trace/tracing_map.c:839:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pa = A;
                                                 ^    ~
   kernel/trace/tracing_map.c:840:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pb = B;
                                                 ^    ~
   kernel/trace/tracing_map.c:853:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pa = A;
                                                 ^    ~
   kernel/trace/tracing_map.c:854:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pb = B;
                                                 ^    ~
   kernel/trace/tracing_map.c:884:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pa = A;
                                                 ^    ~
   kernel/trace/tracing_map.c:885:40: error: initializing 'const struct tracing_map_sort_entry **' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           const struct tracing_map_sort_entry **pb = B;
                                                 ^    ~
   6 errors generated.


vim +839 kernel/trace/tracing_map.c

   836	
   837	static int cmp_entries_dup(const void *A, const void *B)
   838	{
 > 839		const struct tracing_map_sort_entry **pa = A;
   840		const struct tracing_map_sort_entry **pb = B;
   841		const struct tracing_map_sort_entry *a = *pa;
   842		const struct tracing_map_sort_entry *b = *pb;
   843		int ret = 0;
   844	
   845		if (memcmp(a->key, b->key, a->elt->map->key_size))
   846			ret = 1;
   847	
   848		return ret;
   849	}
   850	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37916 bytes --]

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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
  2021-10-14  1:37 [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch Kalesh Singh
@ 2021-10-14 11:12   ` kernel test robot
  2021-10-14 10:44   ` kernel test robot
  2021-10-14 11:12   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-10-14 11:12 UTC (permalink / raw)
  To: Kalesh Singh
  Cc: kbuild-all, surenb, hridya, namhyung, samitolvanen, ndesaulniers,
	kernel-team, Kalesh Singh, Steven Rostedt, Ingo Molnar,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3644 bytes --]

Hi Kalesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]

url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
config: arm64-randconfig-r005-20211014 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
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
        # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
        git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   kernel/trace/tracing_map.c: In function 'cmp_entries_dup':
>> kernel/trace/tracing_map.c:839:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     839 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:840:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     840 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_sum':
   kernel/trace/tracing_map.c:853:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     853 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:854:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     854 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_key':
   kernel/trace/tracing_map.c:884:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     884 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:885:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     885 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^


vim +/const +839 kernel/trace/tracing_map.c

   836	
   837	static int cmp_entries_dup(const void *A, const void *B)
   838	{
 > 839		const struct tracing_map_sort_entry **pa = A;
   840		const struct tracing_map_sort_entry **pb = B;
   841		const struct tracing_map_sort_entry *a = *pa;
   842		const struct tracing_map_sort_entry *b = *pb;
   843		int ret = 0;
   844	
   845		if (memcmp(a->key, b->key, a->elt->map->key_size))
   846			ret = 1;
   847	
   848		return ret;
   849	}
   850	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31422 bytes --]

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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
@ 2021-10-14 11:12   ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-10-14 11:12 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3715 bytes --]

Hi Kalesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]

url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
config: arm64-randconfig-r005-20211014 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
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
        # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
        git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   kernel/trace/tracing_map.c: In function 'cmp_entries_dup':
>> kernel/trace/tracing_map.c:839:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     839 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:840:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     840 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_sum':
   kernel/trace/tracing_map.c:853:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     853 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:854:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     854 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^
   kernel/trace/tracing_map.c: In function 'cmp_entries_key':
   kernel/trace/tracing_map.c:884:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     884 |         const struct tracing_map_sort_entry **pa = A;
         |                                                    ^
   kernel/trace/tracing_map.c:885:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     885 |         const struct tracing_map_sort_entry **pb = B;
         |                                                    ^


vim +/const +839 kernel/trace/tracing_map.c

   836	
   837	static int cmp_entries_dup(const void *A, const void *B)
   838	{
 > 839		const struct tracing_map_sort_entry **pa = A;
   840		const struct tracing_map_sort_entry **pb = B;
   841		const struct tracing_map_sort_entry *a = *pa;
   842		const struct tracing_map_sort_entry *b = *pb;
   843		int ret = 0;
   844	
   845		if (memcmp(a->key, b->key, a->elt->map->key_size))
   846			ret = 1;
   847	
   848		return ret;
   849	}
   850	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31422 bytes --]

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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
  2021-10-14 11:12   ` kernel test robot
@ 2021-10-14 16:23     ` Kalesh Singh
  -1 siblings, 0 replies; 9+ messages in thread
From: Kalesh Singh @ 2021-10-14 16:23 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, Suren Baghdasaryan, Hridya Valsaraju, Namhyung Kim,
	Sami Tolvanen, Nick Desaulniers, Cc: Android Kernel,
	Steven Rostedt, Ingo Molnar, LKML

On Thu, Oct 14, 2021 at 4:13 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi Kalesh,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]
>
> url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
> base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
> config: arm64-randconfig-r005-20211014 (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 11.2.0
> 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
>         # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
>         git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
>    kernel/trace/tracing_map.c: In function 'cmp_entries_dup':
> >> kernel/trace/tracing_map.c:839:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      839 |         const struct tracing_map_sort_entry **pa = A;
>          |                                                    ^
>    kernel/trace/tracing_map.c:840:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      840 |         const struct tracing_map_sort_entry **pb = B;
>          |                                                    ^
>    kernel/trace/tracing_map.c: In function 'cmp_entries_sum':
>    kernel/trace/tracing_map.c:853:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      853 |         const struct tracing_map_sort_entry **pa = A;
>          |                                                    ^
>    kernel/trace/tracing_map.c:854:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      854 |         const struct tracing_map_sort_entry **pb = B;
>          |                                                    ^
>    kernel/trace/tracing_map.c: In function 'cmp_entries_key':
>    kernel/trace/tracing_map.c:884:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      884 |         const struct tracing_map_sort_entry **pa = A;
>          |                                                    ^
>    kernel/trace/tracing_map.c:885:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      885 |         const struct tracing_map_sort_entry **pb = B;
>          |                                                    ^
>

I posted a v3 to address these:
https://lore.kernel.org/r/20211014045217.3265162-1-kaleshsingh@google.com/

Thanks,
Kalesh
>
> vim +/const +839 kernel/trace/tracing_map.c
>
>    836
>    837  static int cmp_entries_dup(const void *A, const void *B)
>    838  {
>  > 839          const struct tracing_map_sort_entry **pa = A;
>    840          const struct tracing_map_sort_entry **pb = B;
>    841          const struct tracing_map_sort_entry *a = *pa;
>    842          const struct tracing_map_sort_entry *b = *pb;
>    843          int ret = 0;
>    844
>    845          if (memcmp(a->key, b->key, a->elt->map->key_size))
>    846                  ret = 1;
>    847
>    848          return ret;
>    849  }
>    850
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.

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

* Re: [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch
@ 2021-10-14 16:23     ` Kalesh Singh
  0 siblings, 0 replies; 9+ messages in thread
From: Kalesh Singh @ 2021-10-14 16:23 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4253 bytes --]

On Thu, Oct 14, 2021 at 4:13 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi Kalesh,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on 348949d9a4440abdab3b1dc99a9bb660e8c7da7c]
>
> url:    https://github.com/0day-ci/linux/commits/Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
> base:   348949d9a4440abdab3b1dc99a9bb660e8c7da7c
> config: arm64-randconfig-r005-20211014 (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 11.2.0
> 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
>         # https://github.com/0day-ci/linux/commit/aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Kalesh-Singh/tracing-cfi-Fix-cmp_entries_-functions-signature-mismatch/20211014-093824
>         git checkout aca9efb61e0559ff7abff8c8bce5e1a65a73ccce
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
>    kernel/trace/tracing_map.c: In function 'cmp_entries_dup':
> >> kernel/trace/tracing_map.c:839:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      839 |         const struct tracing_map_sort_entry **pa = A;
>          |                                                    ^
>    kernel/trace/tracing_map.c:840:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      840 |         const struct tracing_map_sort_entry **pb = B;
>          |                                                    ^
>    kernel/trace/tracing_map.c: In function 'cmp_entries_sum':
>    kernel/trace/tracing_map.c:853:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      853 |         const struct tracing_map_sort_entry **pa = A;
>          |                                                    ^
>    kernel/trace/tracing_map.c:854:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      854 |         const struct tracing_map_sort_entry **pb = B;
>          |                                                    ^
>    kernel/trace/tracing_map.c: In function 'cmp_entries_key':
>    kernel/trace/tracing_map.c:884:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      884 |         const struct tracing_map_sort_entry **pa = A;
>          |                                                    ^
>    kernel/trace/tracing_map.c:885:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      885 |         const struct tracing_map_sort_entry **pb = B;
>          |                                                    ^
>

I posted a v3 to address these:
https://lore.kernel.org/r/20211014045217.3265162-1-kaleshsingh(a)google.com/

Thanks,
Kalesh
>
> vim +/const +839 kernel/trace/tracing_map.c
>
>    836
>    837  static int cmp_entries_dup(const void *A, const void *B)
>    838  {
>  > 839          const struct tracing_map_sort_entry **pa = A;
>    840          const struct tracing_map_sort_entry **pb = B;
>    841          const struct tracing_map_sort_entry *a = *pa;
>    842          const struct tracing_map_sort_entry *b = *pb;
>    843          int ret = 0;
>    844
>    845          if (memcmp(a->key, b->key, a->elt->map->key_size))
>    846                  ret = 1;
>    847
>    848          return ret;
>    849  }
>    850
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe(a)android.com.

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

end of thread, other threads:[~2021-10-14 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14  1:37 [PATCH v2] tracing/cfi: Fix cmp_entries_* functions signature mismatch Kalesh Singh
2021-10-14  3:55 ` kernel test robot
2021-10-14  3:55   ` kernel test robot
2021-10-14 10:44 ` kernel test robot
2021-10-14 10:44   ` kernel test robot
2021-10-14 11:12 ` kernel test robot
2021-10-14 11:12   ` kernel test robot
2021-10-14 16:23   ` Kalesh Singh
2021-10-14 16:23     ` Kalesh Singh

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.