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 2021/10/30 08:07:35 UTC

[GitHub] [incubator-nuttx] Wei23Chen opened a new pull request #4743: mm: Support the kernel address sanitizer

Wei23Chen opened a new pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743


   Signed-off-by: chenwei23 <ch...@xiaomi.com>
   Change-Id: Ie7cd9df6f2388b2e2bac2a85df3be579a0141342
   
   mm/heap: Simplify the condition check in mm_realloc
   
   Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
   Change-Id: I091c26fcb594d5a47d6ed4d2a40d357d826246e5
   
   mm/heap: Call kasan_[un]poison with allocation granularity
   
   and keep mm_realloc behaviour same with/without kasan
   
   Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
   Change-Id: I14a810c898c59d9c869206e0fcadc1b20f658e00
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   


-- 
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 edited a comment on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957444496


   > In terms of usability, the new proposed solution is worse than adding to `MAXOPTIMIZATION`, but at least it does not hurt coherence. I'm not satisfied, but I'd accept it. KAsan will be mostly used on the simulator, anyway. For the next major release we need to rework compiler flags management.
   
   Yes, I think so. It's too hard to add the common option in the current Make.defs design. We need refactor Make.defs to address:
   
   1. Avoid so many duplicated config in each Make.defs
   2. Allow the common option addition more easier


-- 
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] gustavonihei commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740998036



##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       It seems that the `LLVM/clang` that ships with macOS somehow does not support sanitizers: https://stackoverflow.com/questions/65112164/how-to-resolve-clang-error-unsupported-option-fsanitize-leak-on-apple-dev
   
   Let's address it later. Probably we would need to install the host toolchain (either clang or GCC) from Homwbrew to make it work properly.




-- 
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] Wei23Chen commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Wei23Chen commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957027874


   > How about adding `__asan_loadN_noabort`/`__asan_storeN_noabort` to the nxstyle whitelist?
   
   Good idea!


-- 
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 pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957078490






-- 
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 change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740700515



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       The new option require we modify all boards/**/scripts/Make.defs, or we let user add -fsanitize=kernel-address manually.




-- 
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] Ouss4 commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957241568


   > Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address. Please review again.
   
   @xioxiang781216 by manually you mean through EXTRA_FLAGS?


-- 
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] gustavonihei commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740459260



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Adding it as an "optimization option" seems conceptually wrong. We should create another variable for the instrumentation options.

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       Is this really true? Or this lack of support is just that it has not been verified to work with NuttX?
   Clang seems to support kernel address sanitizers for a long time.

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       Is this really true? Or this lack of support is just that it has not been verified to work with NuttX?
   Clang seems to support kernel address sanitizers for a long time.
   https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/Sanitizers.def#L49-L50

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       It seems that the `LLVM/clang` that ships with macOS somehow does not support sanitizers: https://stackoverflow.com/questions/65112164/how-to-resolve-clang-error-unsupported-option-fsanitize-leak-on-apple-dev
   
   Let's address it later. Probably we would need to install the host toolchain (either clang or GCC) from Homwbrew to make it work properly.




-- 
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] gustavonihei commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740936299



##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       Is this really true? Or this lack of support is just that it has not been verified to work with NuttX?
   Clang seems to support kernel address sanitizers for a long time.

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       Is this really true? Or this lack of support is just that it has not been verified to work with NuttX?
   Clang seems to support kernel address sanitizers for a long time.
   https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/Sanitizers.def#L49-L50

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       It seems that the `LLVM/clang` that ships with macOS somehow does not support sanitizers: https://stackoverflow.com/questions/65112164/how-to-resolve-clang-error-unsupported-option-fsanitize-leak-on-apple-dev
   
   Let's address it later. Probably we would need to install the host toolchain (either clang or GCC) from Homwbrew to make it work properly.




-- 
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 change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740806690



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address.

##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address. Please review again.




-- 
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 change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740978702



##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       At least, clang on our macOS CI can't recognize -fsanitize=kernel-address. Here is the link before I add kasan to the black list(https://github.com/apache/incubator-nuttx/runs/4055120804?check_suite_focus=true):
   ```
   clangclang: error: error: clangunsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0': : error: unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   
   unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   ```




-- 
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] gustavonihei merged pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei merged pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743


   


-- 
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] Ouss4 commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740769636



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       I agree with Gustavo here.  We are kind of abusing the MAXOPTIMIZATION variable here.




-- 
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 pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957444496


   > In terms of usability, the new proposed solution is worse than adding to `MAXOPTIMIZATION`, but at least it does not hurt coherence. I'm not satisfied, but I'd accept it. KAsan will be mostly used on the simulator, anyway. For the next major release we need to rework compiler flags management.
   
   Yes, I think so. It's too hard to add the common option in the current Makefile design. We need refactor Makefile to address:
   
   1. Avoid so many duplicated config in each Make.defs
   2. Allow the common option addition more easier


-- 
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 edited a comment on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957444496


   > In terms of usability, the new proposed solution is worse than adding to `MAXOPTIMIZATION`, but at least it does not hurt coherence. I'm not satisfied, but I'd accept it. 
   > KAsan will be mostly used on the simulator, anyway.
   
   No, KASan is designed to work on the real device. The simulator is better to enable SIM_SANITIZE instead which could detect more error(global and stack) and print more useful info.
   
   > For the next major release we need to rework compiler flags management.
   
   Yes, I think so. It's too hard to add the common option in the current Make.defs design. We need refactor Make.defs to address:
   
   1. Avoid so many duplicated config in each Make.defs
   2. Allow the common option addition more easier


-- 
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 edited a comment on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957444496






-- 
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] gustavonihei commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957321025


   In terms of usability, the new proposed solution is worse than adding to `MAXOPTIMIZATION`, but at least it does not hurt coherence. I'm not satisfied, but I'd accept it.
   KAsan will be mostly used on the simulator, anyway.
   For the next major release we need to rework compiler flags management.


-- 
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] gustavonihei commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740459260



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Adding it as an "optimization option" seems conceptually wrong. We should create another variable for the instrumentation options.




-- 
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] gustavonihei merged pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei merged pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743


   


-- 
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 change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740700515



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       The new option require we modify all boards/**/scripts/Make.defs, or we let user add -fsanitize=kernel-address manually.

##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address.

##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address. Please review again.

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       At least, clang on our macOS CI can't recognize -fsanitize=kernel-address. Here is the link before I add kasan to the black list(https://github.com/apache/incubator-nuttx/runs/4055120804?check_suite_focus=true):
   ```
   clangclang: error: error: clangunsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0': : error: unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   
   unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   ```

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       At least, clang on our macOS CI can't recognize -fsanitize=kernel-address. Here is the error report before I add kasan to the black list(https://github.com/apache/incubator-nuttx/runs/4055120804?check_suite_focus=true):
   ```
   clangclang: error: error: clangunsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0': : error: unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   
   unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   ```




-- 
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] Ouss4 commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957241568


   > Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address. Please review again.
   
   @xioxiang781216 by manually you mean through EXTRA_FLAGS?


-- 
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 pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957078490






-- 
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] Wei23Chen commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Wei23Chen commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957027874


   > How about adding `__asan_loadN_noabort`/`__asan_storeN_noabort` to the nxstyle whitelist?
   
   Good idea!


-- 
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] gustavonihei commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740936299



##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       Is this really true? Or this lack of support is just that it has not been verified to work with NuttX?
   Clang seems to support kernel address sanitizers for a long time.




-- 
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 change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740700515



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       The new option require we modify all boards/**/scripts/Make.defs, or we let user add -fsanitize=kernel-address manually.

##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address.

##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address. Please review again.

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       At least, clang on our macOS CI can't recognize -fsanitize=kernel-address. Here is the link before I add kasan to the black list(https://github.com/apache/incubator-nuttx/runs/4055120804?check_suite_focus=true):
   ```
   clangclang: error: error: clangunsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0': : error: unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   
   unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   ```

##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       At least, clang on our macOS CI can't recognize -fsanitize=kernel-address. Here is the error report before I add kasan to the black list(https://github.com/apache/incubator-nuttx/runs/4055120804?check_suite_focus=true):
   ```
   clangclang: error: error: clangunsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0': : error: unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   
   unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   ```




-- 
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] gustavonihei commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957321025


   In terms of usability, the new proposed solution is worse than adding to `MAXOPTIMIZATION`, but at least it does not hurt coherence. I'm not satisfied, but I'd accept it.
   KAsan will be mostly used on the simulator, anyway.
   For the next major release we need to rework compiler flags management.


-- 
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 edited a comment on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957444496






-- 
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 pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957244480


   > > Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address. Please review again.
   > 
   > @xioxiang781216 by manually you mean through EXTRA_FLAGS?
   
   Yes, or add to CFLAGS/CXXFLAGS in Make.defs, I note in the Kconfig:
   https://github.com/apache/incubator-nuttx/pull/4743/files#diff-6a0166b1d8bbb576287048e4de42eb7e8a1f118e357f407d3bdf7da9fc26d94dR181-R188
   ```
   config MM_KASAN
   	bool "Kernel Address Sanitizer"
   	default n
   	---help---
   		KASan is a fast compiler-based tool for detecting memory
   		bugs in native code. After turn on this option, Please
   		add -fsanitize=kernel-address to CFLAGS/CXXFLAGS 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 change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740978702



##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       At least, clang on our macOS CI can't recognize -fsanitize=kernel-address. Here is the error report before I add kasan to the black list(https://github.com/apache/incubator-nuttx/runs/4055120804?check_suite_focus=true):
   ```
   clangclang: error: error: clangunsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0': : error: unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   
   unsupported option '-fsanitize=kernel-address' for target 'x86_64-apple-darwin19.6.0'
   ```




-- 
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] gustavonihei commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-956500794






-- 
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] Wei23Chen commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Wei23Chen commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957027874


   > How about adding `__asan_loadN_noabort`/`__asan_storeN_noabort` to the nxstyle whitelist?
   
   Good idea!


-- 
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] Ouss4 commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740769636



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       I agree with Gustavo here.  We are kind of abusing the MAXOPTIMIZATION variable here.




-- 
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] gustavonihei commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-956500794


   How about adding `__asan_loadN_noabort`/`__asan_storeN_noabort` to the nxstyle whitelist?


-- 
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 pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957078490


   > How about adding `__asan_loadN_noabort`/`__asan_storeN_noabort` to the nxstyle whitelist?
   
   Done.


-- 
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] Ouss4 commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740769636



##########
File path: arch/arm/src/arm/Toolchain.defs
##########
@@ -67,6 +67,10 @@ else
   MAXOPTIMIZATION ?= -Os
 endif
 
+ifeq ($(CONFIG_MM_KASAN),y)
+  MAXOPTIMIZATION += -fsanitize=kernel-address

Review comment:
       I agree with Gustavo here.  We are kind of abusing the MAXOPTIMIZATION variable here.




-- 
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] gustavonihei commented on a change in pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#discussion_r740936299



##########
File path: tools/ci/testlist/sim-01.dat
##########
@@ -6,16 +6,19 @@
 -Darwin,sim:cxxtest
 -Darwin,sim:libcxxtest
 
-# Do not build Linux configs
--Darwin,sim:linuxi2c
--Darwin,sim:linuxspi
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:kasan

Review comment:
       Is this really true? Or this lack of support is just that it has not been verified to work with NuttX?
   Clang seems to support kernel address sanitizers for a long time.
   https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/Sanitizers.def#L49-L50




-- 
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] gustavonihei merged pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
gustavonihei merged pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743


   


-- 
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] Ouss4 commented on pull request #4743: mm: Support the kernel address sanitizer

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #4743:
URL: https://github.com/apache/incubator-nuttx/pull/4743#issuecomment-957241568


   > Ok, I revert all change under arch/, user has to add -fsanitize=kernel-address. Please review again.
   
   @xioxiang781216 by manually you mean through EXTRA_FLAGS?


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