topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
47.59k stars 12.08k forks source link

Segmentation fault patching RAMDISK - Huawei Mate 30 Pro #3652

Closed lorenzodifuccia closed 3 years ago

lorenzodifuccia commented 3 years ago

I'm experiencing a Segmentation fault error trying to patch a RAMDISK.img on a Huawei Mate 30 Pro.

Device Spec

Firmware

Magisk version (Canary)

Issue description From logcat:

01-09 00:48:48.723  9509 10221 D OkHttp  : <-- 200 https://cdn.jsdelivr.net/gh/topjohnwu/magisk_files@53179d44d4b291bddb9b0b13ab6cc7d4715b6f03/magisk-debug.zip (62ms, 12098539-byte body)
01-09 00:48:50.681  9509  9509 I HwViewRootImpl: removeInvalidNode all the node in jank list is out of time
01-09 00:48:50.829  9509  9509 W DefaultDispatch: type=1400 audit(0.0:16014): avc: granted { read } for pid=9509 path="/storage/emulated/0/Download/RAMDISK.img" dev="sdcardfs" ino=2098 scontext=u:r:untrusted_app_27:s0:c121,c256,c512,c768 tcontext=u:object_r:sdcardfs:s0 tclass=file
01-09 00:48:50.844  9509  9551 W System.err: java.io.IOException: unexpected end-of-contents marker
01-09 00:48:50.844  9509  9551 W System.err:    at org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source:14)
01-09 00:48:50.844  9509  9551 W System.err:    at com.topjohnwu.signing.SignBoot$BootSignature.<init>(SignBoot.java:241)
01-09 00:48:50.844  9509  9551 W System.err:    at com.topjohnwu.signing.SignBoot.verifySignature(SignBoot.java:150)
01-09 00:48:50.844  9509  9551 W System.err:    at com.topjohnwu.magisk.core.tasks.MagiskInstallImpl.patchBoot(MagiskInstaller.kt:316)
01-09 00:48:50.844  9509  9551 W System.err:    at com.topjohnwu.magisk.core.tasks.MagiskInstallImpl.handleFile(MagiskInstaller.kt:276)
01-09 00:48:50.844  9509  9551 W System.err:    at com.topjohnwu.magisk.core.tasks.MagiskInstallImpl.doPatchFile(MagiskInstaller.kt:401)
01-09 00:48:50.844  9509  9551 W System.err:    at com.topjohnwu.magisk.core.tasks.MagiskInstaller$Patch.operations(MagiskInstaller.kt:445)
01-09 00:48:50.844  9509  9551 W System.err:    at com.topjohnwu.magisk.core.tasks.MagiskInstallImpl$exec$2.invokeSuspend(MagiskInstaller.kt:419)
01-09 00:48:50.844  9509  9551 W System.err:    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
01-09 00:48:50.844  9509  9551 W System.err:    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
01-09 00:48:50.844  9509  9551 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
01-09 00:48:50.844  9509  9551 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
01-09 00:48:50.844  9509  9551 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
01-09 00:48:50.844  9509  9551 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Log from Install > Select and Patch a File:

- Device platform: arm64-v8a
- Magisk Manager: 8.0.4 (4770)
- Install target: 6d88d8ad (21201)
- Copying image to cache
2026+0 records in
2026+0 records out
2074624 bytes (1.9 M) copied, 0.005275 s, 375 M/s
1381+1 records in
1381+1 records out
1415016 bytes (1.3 M) copied, 0.004535 s, 298 M/s
Segmentation fault 
! Installation failed

Same issue trying patching RECOVERY_RAMDIS.img and BOOT.img.

Are there any further information I can add to this issue?

Thanks! 🙏🏻

osm0sis commented 3 years ago

Can report ramdisk.img is a proper kernel-less Huawei ANDROID! boot.img variant file so should be supported. Looks like another crash checking if signed from switching SignBoot implementation, as with https://github.com/topjohnwu/Magisk/issues/3876.

Can you try again with 22003? If it still doesn't work I'll mark this as a regression.

osm0sis commented 3 years ago

This appears working again in latest Canary. I was able to patch your ramdisk.img in the Magisk app on my device.