You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/22 15:00:02 UTC

[GitHub] [incubator-nuttx] no1wudi opened a new pull request, #6892: sim: Enable ubsan in sim:kasan

no1wudi opened a new pull request, #6892:
URL: https://github.com/apache/incubator-nuttx/pull/6892

   ## Summary
   Change some prototypes of KASAN function to pass build with both KASAN and UBSan enabled.
   ## Impact
   Should be none
   ## Testing
   sim
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6892: sim: Enable ubsan in sim:kasan

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6892:
URL: https://github.com/apache/incubator-nuttx/pull/6892


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6892: sim: Enable ubsan in sim:kasan

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6892:
URL: https://github.com/apache/incubator-nuttx/pull/6892#discussion_r951572859


##########
mm/kasan/kasan.c:
##########
@@ -222,188 +222,188 @@ void __asan_handle_no_return(void)
   /* Shut up compiler complaints */
 }
 
-void __asan_report_load_n_noabort(uintptr_t addr, size_t size)
+void __asan_report_load_n_noabort(FAR void *addr, size_t size)
 {
-  kasan_report(addr, size, false);
+  kasan_report((uintptr_t)addr, size, false);

Review Comment:
   let's change the prototype of kasan_report and kasan_set_posion to avoid the cast



##########
mm/kasan/kasan.c:
##########
@@ -222,188 +222,188 @@ void __asan_handle_no_return(void)
   /* Shut up compiler complaints */
 }
 
-void __asan_report_load_n_noabort(uintptr_t addr, size_t size)
+void __asan_report_load_n_noabort(FAR void *addr, size_t size)
 {
-  kasan_report(addr, size, false);
+  kasan_report((uintptr_t)addr, size, false);
 }
 
-void __asan_report_store_n_noabort(uintptr_t addr, size_t size)
+void __asan_report_store_n_noabort(FAR void *addr, size_t size)
 {
-  kasan_report(addr, size, true);
+  kasan_report((uintptr_t)addr, size, true);
 }
 
-void __asan_report_load16_noabort(uintptr_t addr)
+void __asan_report_load16_noabort(FAR void *addr)
 {
   __asan_report_load_n_noabort(addr, 16);
 }
 
-void __asan_report_store16_noabort(uintptr_t addr)
+void __asan_report_store16_noabort(FAR void *addr)
 {
   __asan_report_store_n_noabort(addr, 16);
 }
 
-void __asan_report_load8_noabort(uintptr_t addr)
+void __asan_report_load8_noabort(FAR void *addr)
 {
   __asan_report_load_n_noabort(addr, 8);
 }
 
-void __asan_report_store8_noabort(uintptr_t addr)
+void __asan_report_store8_noabort(FAR void *addr)
 {
   __asan_report_store_n_noabort(addr, 8);
 }
 
-void __asan_report_load4_noabort(uintptr_t addr)
+void __asan_report_load4_noabort(FAR void *addr)
 {
   __asan_report_load_n_noabort(addr, 4);
 }
 
-void __asan_report_store4_noabort(uintptr_t addr)
+void __asan_report_store4_noabort(FAR void *addr)
 {
   __asan_report_store_n_noabort(addr, 4);
 }
 
-void __asan_report_load2_noabort(uintptr_t addr)
+void __asan_report_load2_noabort(FAR void *addr)
 {
   __asan_report_load_n_noabort(addr, 2);
 }
 
-void __asan_report_store2_noabort(uintptr_t addr)
+void __asan_report_store2_noabort(FAR void *addr)
 {
   __asan_report_store_n_noabort(addr, 2);
 }
 
-void __asan_report_load1_noabort(uintptr_t addr)
+void __asan_report_load1_noabort(FAR void *addr)
 {
   __asan_report_load_n_noabort(addr, 1);
 }
 
-void __asan_report_store1_noabort(uintptr_t addr)
+void __asan_report_store1_noabort(FAR void *addr)
 {
   __asan_report_store_n_noabort(addr, 1);
 }
 
-void __asan_loadN_noabort(uintptr_t addr, size_t size)
+void __asan_loadN_noabort(FAR void *addr, size_t size)
 {
-  if (kasan_is_poisoned(addr, size))
+  if (kasan_is_poisoned((uintptr_t)addr, size))

Review Comment:
   let's change the prototype of kasan_is_poisoned to avoid the cast



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6892: sim: Enable ubsan in sim:kasan

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6892:
URL: https://github.com/apache/incubator-nuttx/pull/6892#discussion_r951582835


##########
mm/kasan/kasan.c:
##########
@@ -107,12 +107,12 @@ static void kasan_report(uintptr_t addr, size_t size, bool is_write)
   --recursion;
 }
 
-static bool kasan_is_poisoned(uintptr_t addr, size_t size)
+static bool kasan_is_poisoned(FAR void *addr, size_t size)
 {
   FAR uintptr_t *p;
   unsigned int bit;
 
-  p = kasan_mem_to_shadow(addr + size - 1, 1, &bit);
+  p = kasan_mem_to_shadow((uintptr_t)(addr + size - 1), 1, &bit);

Review Comment:
   let's change kasan_mem_to_shadow and kasan_set_poison prototype to FAR void * too



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6892: sim: Enable ubsan in sim:kasan

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6892:
URL: https://github.com/apache/incubator-nuttx/pull/6892#discussion_r951593884


##########
mm/kasan/kasan.c:
##########
@@ -116,7 +117,7 @@ static bool kasan_is_poisoned(uintptr_t addr, size_t size)
   return p && ((*p >> bit) & 1);
 }
 
-static void kasan_set_poison(uintptr_t addr, size_t size, bool poisoned)
+static void kasan_set_poison(FAR void *addr, size_t size, bool poisoned)

Review Comment:
   let's add const and remove the cast from 174 and 179



##########
mm/kasan/kasan.c:
##########
@@ -107,7 +108,7 @@ static void kasan_report(uintptr_t addr, size_t size, bool is_write)
   --recursion;
 }
 
-static bool kasan_is_poisoned(uintptr_t addr, size_t size)
+static bool kasan_is_poisoned(FAR void *addr, size_t size)

Review Comment:
   add const too



##########
mm/kasan/kasan.c:
##########
@@ -73,10 +73,11 @@ static FAR struct kasan_region_s *g_region;
  * Private Functions
  ****************************************************************************/
 
-static FAR uintptr_t *kasan_mem_to_shadow(uintptr_t addr, size_t size,
+static FAR uintptr_t *kasan_mem_to_shadow(FAR void *ptr, size_t size,

Review Comment:
   add const



##########
mm/kasan/kasan.c:
##########
@@ -93,7 +94,7 @@ static FAR uintptr_t *kasan_mem_to_shadow(uintptr_t addr, size_t size,
   return NULL;
 }
 
-static void kasan_report(uintptr_t addr, size_t size, bool is_write)
+static void kasan_report(FAR void *addr, size_t size, bool is_write)

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org