Comments (3)
All other issues are currently blocked by this as my S4 is my only testing device right now (tripping KNOX disables Samsung Pay on my S6E+...).
from dualbootpatcher.
An upcoming release will include a heavily stripped down fork of adbd, miniadbd
, which can be used for debugging issues during the mbtool init stage. If enabled, it is spawned instead of the ROM's /init
binary
from dualbootpatcher.
Just ran /init
through strace in miniadbd. It looks like the policy is preventing another policy from being loaded by init's stage 1 because it's initially running under the u:r:kernel:s0
context. We may want to copy /sepolicy
to another file, patch it to make all types permissive, and load the temporary policy. Then, we can relabel files any way we need during the mbtool stage. Once the real /init takes over, it will load the real policy.
EDIT: Yep, patching the policy is the way to go. I originally had the incorrect assumption that I could do:
if (!selinux_set_enforcing(0)) {
LOGW("Failed to set SELinux to permissive mode");
}
// Load policy
...
but the policy is able to override the global enforcing status.
root@android:/ # umount /sys/fs/selinux
root@android:/ # /strace_static /init
execve("/init", ["/init"], [/* 16 vars */]) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
gettid() = 301
set_tls(0x9497c, 0xfffffe00, 0, 0x9497c, 0x94bb0) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 0xb6f59000
madvise(0xb6f59000, 8192, MADV_MERGEABLE) = -1 EINVAL (Invalid argument)
sigaltstack({ss_sp=0xb6f59000, ss_flags=0, ss_size=8192}, NULL) = 0
open("/dev/__properties__", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
fstat64(7, {st_mode=S_IFREG|0600, st_size=32768, ...}) = 0
mmap2(NULL, 32768, PROT_READ, MAP_SHARED, 7, 0) = 0xb6f51000
mprotect(0x86000, 40960, PROT_READ) = 0
statfs64("/sys/fs/selinux", 88, {f_type="SYSFS_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=4128}) = 0
open("/proc/filesystems", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
gettimeofday({1389738735, 146875}, NULL) = 0
brk(0) = 0x96000
brk(0x96000) = 0x96000
brk(0x97000) = 0x97000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 1024) = 333
close(3) = 0
open("/proc/mounts", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "rootfs / rootfs rw 0 0\ntmpfs /de"..., 1024) = 1024
read(3, "abel,relatime,discard,journal_ch"..., 1024) = 752
read(3, "", 1024) = 0
close(3) = 0
clock_gettime(CLOCK_MONOTONIC, {53, 660641049}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f50000
madvise(0xb6f50000, 4096, MADV_MERGEABLE) = -1 EINVAL (Invalid argument)
mprotect(0xb6f50000, 4096, PROT_READ) = 0
brk(0x98000) = 0x98000
umask(0) = 0
mkdir("/dev", 0755) = -1 EEXIST (File exists)
mkdir("/proc", 0755) = -1 EEXIST (File exists)
mkdir("/sys", 0755) = -1 EEXIST (File exists)
mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755") = 0
mkdir("/dev/pts", 0755) = 0
mkdir("/dev/socket", 0755) = 0
mount("devpts", "/dev/pts", "devpts", 0, NULL) = 0
mount("proc", "/proc", "proc", 0, NULL) = -1 EBUSY (Device or resource busy)
mount("sysfs", "/sys", "sysfs", 0, NULL) = -1 EBUSY (Device or resource busy)
open("/dev/.booting", O_WRONLY|O_CREAT, 0) = 3
close(3) = 0
mknod("/dev/__null__", S_IFCHR|0600, makedev(1, 3)) = 0
open("/dev/__null__", O_RDWR) = 3
unlink("/dev/__null__") = 0
dup2(3, 0) = 0
dup2(3, 1) = 1
dup2(3, 2) = 2
close(3) = 0
mknod("/dev/__kmsg__", S_IFCHR|0600, makedev(1, 11)) = 0
open("/dev/__kmsg__", O_WRONLY) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
unlink("/dev/__kmsg__") = 0
write(3, "!@Boot: Start init process\n", 27) = 27
open("/dev/__properties__", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0444) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
ftruncate(4, 131072) = 0
mmap2(NULL, 131072, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = 0xb6f30000
close(4) = 0
open("/dev/__properties__", O_RDONLY|O_NOFOLLOW) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
open("/proc/cpuinfo", O_RDONLY) = 5
read(5, "Processor\t: ARMv7 Processor rev "..., 1023) = 395
close(5) = 0
chmod("/proc/cmdline", 0440) = 0
open("/proc/cmdline", O_RDONLY) = 5
read(5, "console=null androidboot.hardwar"..., 1023) = 868
close(5) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
futex(0xb6f30004, FUTEX_WAKE, 2147483647) = 0
access("/sys/fs/selinux", F_OK) = 0
mount("selinuxfs", "/sys/fs/selinux", "selinuxfs", 0, NULL) = 0
open("/data/security/sepolicy", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/data/security/spota/sepolicy_version", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/sepolicy_version", O_RDONLY) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=236, ...}) = 0
brk(0x99000) = 0x99000
read(5, "VE=SEPF_SGH-M919_4.4.4_0024\nHS=6"..., 4096) = 236
close(5) = 0
open("/dev/log/main", O_WRONLY) = -1 ENOENT (No such file or directory)
open("/dev/log/radio", O_WRONLY) = -1 ENOENT (No such file or directory)
open("/dev/log/events", O_WRONLY) = -1 ENOENT (No such file or directory)
open("/dev/log/system", O_WRONLY) = -1 ENOENT (No such file or directory)
close(-1) = -1 EBADF (Bad file number)
close(-1) = -1 EBADF (Bad file number)
close(-1) = -1 EBADF (Bad file number)
open("/sepolicy", O_RDONLY|O_NOFOLLOW) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=1438251, ...}) = 0
mmap2(NULL, 1438251, PROT_READ, MAP_PRIVATE, 5, 0) = 0xb6dd0000
madvise(0xb6dd0000, 1438251, MADV_MERGEABLE) = -1 EINVAL (Invalid argument)
open("/sys/fs/selinux/load", O_RDWR) = 6
write(6, "\214\377|\371\10\0\0\0SE Linux\32\0\0\0\1\0\0\0\10\0\0\0\7\0\0\0"..., 1438251) = -1 EACCES (Permission denied)
close(6) = 0
munmap(0xb6dd0000, 1438251) = 0
close(5) = 0
write(3, "<3>init: SELinux: Failed to load"..., 70) = 70
sync() = 0
open("/proc/sysrq-trigger", O_WRONLY) = 5
write(5, "u", 1) = 1
close(5) = 0
open("/proc/mounts", O_RDONLY) = 5
fstat64(5, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(5, "rootfs / rootfs rw 0 0\ntmpfs /de"..., 1024) = 1024
close(5) = 0
nanosleep({0, 100000000}, 0xbe814c00) = 0
open("/proc/mounts", O_RDONLY) = 5
fstat64(5, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(5, "rootfs / rootfs rw 0 0\ntmpfs /de"..., 1024) = 1024
read(5, "abel,relatime,discard,journal_ch"..., 1024) = 919
read(5, "", 1024) = 0
close(5) = 0
reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, "recovery"
from dualbootpatcher.
Related Issues (20)
- fails to flash zip file
- BOOT UI can be installed on pie
- A920F
- mi 6x(wayne)
- Add redmi k20
- Xiaomi Redmi k20 pro not support HOT 1
- Completely removing the dependence on root HOT 2
- Add support Xiaomi Mi8 (dipper) please HOT 1
- compile error HOT 1
- Docker build is not working HOT 1
- Nokia 7.2
- Ryan
- No files in Internal Storage Issue in Primary ROM after installing Second ROM
- Asus zenfone max plus 1 (x018d)
- Failed to copy
- Please support Xiaomi Mi8
- Galaxy s4 mini duos gt 19192 not working
- Failed to flash different ROMs on Xiaomi Redmi Note 2
- Dynamic partitions? HOT 2
- Could not connect to mbtool.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dualbootpatcher.