ramosian-glider / address-sanitizer

Automatically exported from code.google.com/p/address-sanitizer
0 stars 0 forks source link

Unable to sanitize system_server on android #329

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. build an eng ROM with AOSP PLATFORM_VERSION 4.4.3.43.43.43
2. build again with WITH_ADDRESS_SANITIZER=true
3. run the emulator
4. use below commands to setup asan environment
$ adb logcat -c
$ adb shell setprop wrap.system_server "logwrapper asanwrapper"
$ adb shell stop
$ adb shell start
$ adb logcat -v threadtime > asan_system_server.log
5. system server cannot be started

What is the expected output? What do you see instead?
By referencing the 
https://code.google.com/p/address-sanitizer/issues/detail?id=320#c2, I expect 
sanitizing system_server is worked by setting system property.
From attached log, system_server cannot be started due to "execv failed: EACCES 
(Permission denied)".

Please provide any additional information below.
$ adb shell getprop |grep wrapper
[wrap.system_server]: [logwrapper asanwrapper]

$ adb shell ls -l /system/bin | grep wrapper
-rwxr-xr-x root     shell        5408 2014-07-25 07:56 asanwrapper
-rwxr-xr-x root     shell       13660 2014-07-25 08:11 logwrapper

Some related runtime logs, please reference attached for all.
08-01 06:09:39.141  1064  1064 I Zygote  : System server process 1548 has been 
created
08-01 06:09:39.212  1064  1064 I Zygote  : Accepting command socket connections
08-01 06:09:39.390  1548  1548 W system_server: type=1400 audit(0.0:4): avc: 
denied { execute } for name="sh" dev="mtdblock0" ino=238 
scontext=u:r:system_server:s0 tcontext=u:object_r:shell_exec:s0 tclass=file 
permissive=0
08-01 06:09:39.491  1548  1548 E Zygote  : Zygote died with exception
08-01 06:09:39.491  1548  1548 E Zygote  : java.lang.RuntimeException: 
android.system.ErrnoException: execv failed: EACCES (Permission denied)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
com.android.internal.os.Zygote.execShell(Zygote.java:146)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
com.android.internal.os.WrapperInit.execApplication(WrapperInit.java:109)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
com.android.internal.os.ZygoteInit.handleSystemServerProcess(ZygoteInit.java:493
)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
com.android.internal.os.ZygoteInit.startSystemServer(ZygoteInit.java:561)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:623)
08-01 06:09:39.491  1548  1548 E Zygote  : Caused by: 
android.system.ErrnoException: execv failed: EACCES (Permission denied)
08-01 06:09:39.491  1548  1548 E Zygote  :  at libcore.io.Posix.execv(Native 
Method)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
libcore.io.ForwardingOs.execv(ForwardingOs.java:63)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
android.system.Os.execv(Os.java:109)
08-01 06:09:39.491  1548  1548 E Zygote  :  at 
com.android.internal.os.Zygote.execShell(Zygote.java:144)
08-01 06:09:39.491  1548  1548 E Zygote  :  ... 4 more
08-01 06:09:39.491  1548  1548 D AndroidRuntime: Shutting down VM
08-01 06:09:39.955  1064  1064 E Zygote  : Exit zygote because system server 
(1548) has terminated

Original issue reported on code.google.com by tony.ys_...@htc.com on 1 Aug 2014 at 6:51

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by konstant...@gmail.com on 1 Aug 2014 at 8:14

GoogleCodeExporter commented 9 years ago
Try adb shell setenforce 0

Original comment by euge...@google.com on 1 Aug 2014 at 8:15

GoogleCodeExporter commented 9 years ago
Hi Eugenis,

Here is my command to try setenforce, but the system server still cannot be 
started
$ adb logcat -c
$ adb shell setprop wrap.system_server "logwrapper asanwrapper"
$ adb shell stop
$ adb shell setenforce 0
$ adb shell start
$ adb logcat -v threadtime > asan_system_server_permissive.log

[asan_system_server_permissive.log]
08-18 06:41:35.711  2993  2993 I Zygote  : System server process 3465 has been 
created
08-18 06:41:35.780  2993  2993 I Zygote  : Accepting command socket connections
08-18 06:41:35.902  3465  3465 I system_server: type=1400 audit(0.0:5): avc: 
denied { execute } for name="sh" dev="mtdblock0" ino=238 
scontext=u:r:system_server:s0 tcontext=u:object_r:shell_exec:s0 tclass=file 
permissive=1
08-18 06:41:35.912  3465  3465 I system_server: type=1400 audit(0.0:6): avc: 
denied { read open } for name="sh" dev="mtdblock0" ino=238 
scontext=u:r:system_server:s0 tcontext=u:object_r:shell_exec:s0 tclass=file 
permissive=1
08-18 06:41:35.912  3465  3465 I system_server: type=1400 audit(0.0:7): avc: 
denied { execute_no_trans } for path="/system/bin/sh" dev="mtdblock0" ino=238 
scontext=u:r:system_server:s0 tcontext=u:object_r:shell_exec:s0 tclass=file 
permissive=1
08-18 06:41:36.166  3487  3487 E logwrapper: executing asanwrapp failed: 
Permission denied
08-18 06:41:36.168  3484  3484 I asanwrapp: executing asanwrapp failed: 
Permission denied
08-18 06:41:36.169  3484  3484 I asanwrapp: asanwrapp terminated by exit(255)
08-18 06:41:36.187  2993  2993 I Zygote  : Process 3465 exited cleanly (255)
08-18 06:41:36.187  2993  2993 E Zygote  : Exit zygote because system server 
(3465) has terminated

Original comment by tony.ys_...@htc.com on 18 Aug 2014 at 6:56

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by ramosian.glider@gmail.com on 30 Jul 2015 at 9:05

GoogleCodeExporter commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Original comment by ramosian.glider@gmail.com on 30 Jul 2015 at 9:06