Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Cryptsetup segfaults #53

Closed
Neo-Oli opened this issue Feb 8, 2019 · 8 comments
Closed

Cryptsetup segfaults #53

Neo-Oli opened this issue Feb 8, 2019 · 8 comments
Labels

Comments

@Neo-Oli
Copy link
Member

Neo-Oli commented Feb 8, 2019

Hi, just got a new phone so I have all kinds of new problems

Problem description
Cryptsetup is segfaulting when trying to open or create a LUKS encrypted device

Steps to reproduce
To create a new encrypted device

$ tsudo cryptsetup luksFormat /dev/block/vold/public\:8_1

or to open a previously encrypted one

$ tsudo cryptsetup open /dev/block/vold/public\:179_65

both result in a segfault.
Here's the logcat output about this

02-09 00:33:25.875   248   252 D vold    : Disk at 254:15 changed
02-09 00:33:25.877  9405  9405 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xbe419ff4 in tid 9405 (cryptsetup), pid 9405 (cryptsetup)
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 37: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 38: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 39: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 40: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 41: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 42: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 43: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 44: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 45: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 46: Invalid argument
02-09 00:33:25.887  9415  9415 E libc    : failed to raise ambient capability 47: Invalid argument
02-09 00:33:25.889  9415  9415 E libc    : failed to raise ambient capability 48: Invalid argument
02-09 00:33:25.889  9415  9415 E libc    : failed to raise ambient capability 49: Invalid argument
02-09 00:33:25.889  9415  9415 E libc    : failed to raise ambient capability 50: Invalid argument
02-09 00:33:25.889  9415  9415 E libc    : failed to raise ambient capability 51: Invalid argument
02-09 00:33:25.889  9415  9415 E libc    : failed to raise ambient capability 52: Invalid argument
02-09 00:33:25.889  9415  9415 E libc    : failed to raise ambient capability 53: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 54: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 55: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 56: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 57: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 58: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 59: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 60: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 61: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 62: Invalid argument
02-09 00:33:25.890  9415  9415 E libc    : failed to raise ambient capability 63: Invalid argument
02-09 00:33:25.919  9416  9416 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
02-09 00:33:25.919   504   504 I /system/bin/tombstoned: received crash request for pid 9405
02-09 00:33:25.920  9416  9416 I crash_dump32: performing dump of process 9405 (target tid = 9405)
02-09 00:33:25.920  9405  9405 F libc    : failed to resend signal during crash: Operation not permitted
02-09 00:33:25.946  9401  9401 D su      : pid 9402 returned 256.
02-09 00:33:25.946  9401  9401 D su      : Finishing su operation for app [uid:10084, pkgName: com.termux.api]
02-09 00:33:25.947   694  1387 E ActivityManager: Sending non-protected broadcast android.intent.action.SU_SESSION_CHANGED from system 694:system/1000 pkg android
02-09 00:33:25.947   694  1387 E ActivityManager: java.lang.Throwable
02-09 00:33:25.947   694  1387 E ActivityManager:       at com.android.server.am.ActivityManagerService.checkBroadcastFromSystem(ActivityManagerService.java:19170)
02-09 00:33:25.947   694  1387 E ActivityManager:       at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:19682)
02-09 00:33:25.947   694  1387 E ActivityManager:       at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:19917)
02-09 00:33:25.947   694  1387 E ActivityManager:       at android.app.ContextImpl.sendBroadcastAsUser(ContextImpl.java:1130)
02-09 00:33:25.947   694  1387 E ActivityManager:       at com.android.server.AppOpsService$2.run(AppOpsService.java:143)
02-09 00:33:25.947   694  1387 E ActivityManager:       at android.os.Handler.handleCallback(Handler.java:790)
02-09 00:33:25.947   694  1387 E ActivityManager:       at android.os.Handler.dispatchMessage(Handler.java:99)
02-09 00:33:25.947   694  1387 E ActivityManager:       at android.os.Looper.loop(Looper.java:164)
02-09 00:33:25.947   694  1387 E ActivityManager:       at android.os.HandlerThread.run(HandlerThread.java:65)
02-09 00:33:25.947   694  1387 E ActivityManager:       at com.android.server.ServiceThread.run(ServiceThread.java:46)
02-09 00:33:25.948  9401  9401 W IPCThreadState: Calling IPCThreadState::self() during shutdown is dangerous, expect a crash.
02-09 00:33:25.948  9401  9401 W IPCThreadState: Calling IPCThreadState::self() during shutdown is dangerous, expect a crash.
02-09 00:33:25.950  9398  9398 D su      : sending code
02-09 00:33:25.950  9398  9398 D su      : child exited
02-09 00:33:25.951  9395  9395 D su      : client exited 1
02-09 00:33:25.955   504   504 W /system/bin/tombstoned: crash socket received short read of length 0 (expected 12)
02-09 00:33:25.875   248   252 D vold    : Disk at 254:15 changed
02-09 00:33:25.956   694  1605 I BootReceiver: Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)
02-09 00:33:25.907  9416  9416 W crash_dump32: type=1400 audit(0.0:624): avc: denied { dac_override } for capability=1 scontext=u:r:crash_dump:s0 tcontext=u:r:crash_dump:s0 tclass=capability per
missive=0
02-09 00:33:25.907  9416  9416 W crash_dump32: type=1400 audit(0.0:625): avc: denied { dac_read_search } for capability=2 scontext=u:r:crash_dump:s0 tcontext=u:r:crash_dump:s0 tclass=capability
permissive=0
02-09 00:33:25.907  9416  9416 W crash_dump32: type=1400 audit(0.0:626): avc: denied { dac_override } for capability=1 scontext=u:r:crash_dump:s0 tcontext=u:r:crash_dump:s0 tclass=capability per
missive=0
02-09 00:33:25.973   694  1387 E ActivityManager: Sending non-protected broadcast android.intent.action.SU_SESSION_CHANGED from system 694:system/1000 pkg android
02-09 00:33:25.973   694  1387 E ActivityManager: java.lang.Throwable
02-09 00:33:25.973   694  1387 E ActivityManager:       at com.android.server.am.ActivityManagerService.checkBroadcastFromSystem(ActivityManagerService.java:19170)
02-09 00:33:25.973   694  1387 E ActivityManager:       at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:19775)
02-09 00:33:25.973   694  1387 E ActivityManager:       at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:19917)
02-09 00:33:25.973   694  1387 E ActivityManager:       at android.app.ContextImpl.sendBroadcastAsUser(ContextImpl.java:1130)
02-09 00:33:25.973   694  1387 E ActivityManager:       at com.android.server.AppOpsService$2.run(AppOpsService.java:143)
02-09 00:33:25.973   694  1387 E ActivityManager:       at android.os.Handler.handleCallback(Handler.java:790)
02-09 00:33:25.973   694  1387 E ActivityManager:       at android.os.Handler.dispatchMessage(Handler.java:99)
02-09 00:33:25.973   694  1387 E ActivityManager:       at android.os.Looper.loop(Looper.java:164)
02-09 00:33:25.973   694  1387 E ActivityManager:       at android.os.HandlerThread.run(HandlerThread.java:65)
02-09 00:33:25.973   694  1387 E ActivityManager:       at com.android.server.ServiceThread.run(ServiceThread.java:46)
02-09 00:33:25.907  9416  9416 W crash_dump32: type=1400 audit(0.0:627): avc: denied { dac_read_search } for capability=2 scontext=u:r:crash_dump:s0 tcontext=u:r:crash_dump:s0 tclass=capability
permissive=0
02-09 00:33:25.907  9416  9416 W crash_dump32: type=1400 audit(0.0:628): avc: denied { dac_override } for capability=1 scontext=u:r:crash_dump:s0 tcontext=u:r:crash_dump:s0 tclass=capability per
missive=0
02-09 00:33:25.907  9416  9416 W crash_dump32: type=1400 audit(0.0:629): avc: denied { dac_read_search } for capability=2 scontext=u:r:crash_dump:s0 tcontext=u:r:crash_dump:s0 tclass=capability
permissive=0

Expected behavior
It did work for many month like this on my previous phone, which was Android 7.1 arm64.

Additional information

$ termux-info
Updatable packages:
All packages up to date
System information:
Linux localhost 3.4.0-perf-g284400aea4b #1 SMP PREEMPT Mon Feb 4 11:41:05 UTC 2019 armv7l Android
Termux-packages arch:
arm
Android version:
8.1.0
Device manufacturer:
Fairphone
Device model:
FP2
@Grimler91
Copy link
Member

Have you tried plain encryption?
What's the content of /proc/crypto on your device?

@ghost
Copy link

ghost commented Feb 9, 2019

@Grimler91 Lacking of some encryption algorithms in kernel shouldn't cause crash.

Downgrading of libdevmapper fixes the problem.

@ghost
Copy link

ghost commented Feb 9, 2019

libdevmapper which works correctly:
libdevmapper-debs.tar.gz
libdevmapper-2.02.177.tar.gz

@ghost ghost added the bug label Feb 9, 2019
@Grimler91
Copy link
Member

@xeffyr which devices/android versions did you test?

There is a newer libdevmapper version available, I'll see if that fixes it, or if rebuilding cryptsetup is enough

@Grimler91
Copy link
Member

2.02.177 works but neither 2.03.02 or 2.02.183 works. I'll downgrade the package for now and add this to my list of stuff to look into

Grimler91 added a commit that referenced this issue Feb 9, 2019
@Grimler91
Copy link
Member

Should work again after a pkg upgrade. Let me know otherwise

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Feb 10, 2019

Alright it no longer segfaults, so I guess from that perspecive this issue can be closed. I still am unable to open my encrypted disks.

# cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1       364088 iterations per second for 256-bit key
PBKDF2-sha256     582542 iterations per second for 256-bit key
PBKDF2-sha512     275941 iterations per second for 256-bit key
PBKDF2-ripemd160  192752 iterations per second for 256-bit key
PBKDF2-whirlpool   36408 iterations per second for 256-bit key
argon2i       4 iterations, 249461 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
argon2id      4 iterations, 242526 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
Required kernel crypto interface not available.
Ensure you have algif_skcipher kernel module loaded.

So I am still trying to figure out why that is

@Neo-Oli Neo-Oli closed this as completed Feb 10, 2019
@Neo-Oli
Copy link
Member Author

Neo-Oli commented Feb 10, 2019

Required kernel crypto interface not available.
Ensure you have algif_skcipher kernel module loaded.

Ah, a false lead. My other device (where everything has been working displays the same result.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@Neo-Oli @Grimler91 and others