Comments (3)
After a year, I'm back on this.
I've noticed that on kernel 4.4, the derive_key_aes method is always called, while on 4.14 it's called only for directories:
4.4 (Sony, but it's the same also on OnePlus for example): https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.6.4.r1/fs/ext4/crypto_key.c#L336
4.14: https://github.com/roberto-sartori-gl/4.14-kernel-oneplus-msm8998/blob/msm8998_op_new/fs/crypto/keyinfo.c#L120
This would explain why on 4.14 I can only read directories and files names, and in fact after applying the same change on 4.14, I can read directories and files name (as before the change) but I can also read some file contents. For example, I can read the content of /data/unencrypted/.
Reading '/data/unencrypted/mode', I verified that both 4.4 and 4.14 uses the "ice:aes-256-cts:v1" mode (ice for file contents, aes-256-cts for filenames).
I said that I can read some file contents because the device is still not booting: there are improvements, as the device does not go into bootloop, but after some seconds during boot I cannot read any file or any directory anymore (not even file names). All commands get stuck (e.g. 'ls /data' never returns, I have to close the adb process).
Analyzing the situation, I found out that a kworker is using 100% of the cpu (so 100% of a single core, actually). I'm now trying to debug this kworker, and:
cheeseburger:/proc/523 # cat stack
[<0000000000000000>] __switch_to+0x11c/0x138
[<0000000000000000>] try_to_wake_up+0x264/0x45c
[<0000000000000000>] wake_up_process+0x18/0x20
[<0000000000000000>] __queue_work+0x3b0/0x534
[<0000000000000000>] queue_work_on+0x4c/0x6c
[<0000000000000000>] ufs_qcom_pm_qos_req_start+0xfc/0x128
[<0000000000000000>] ufshcd_queuecommand+0x2d8/0x94c
[<0000000000000000>] scsi_dispatch_cmd+0xd8/0x2a0
[<0000000000000000>] scsi_request_fn+0x430/0x67c
[<0000000000000000>] blk_run_queue+0x5c/0xa8
[<0000000000000000>] scsi_run_queue+0x228/0x2a4
[<0000000000000000>] scsi_requeue_run_queue+0x14/0x1c
[<0000000000000000>] process_one_work+0x144/0x438
[<0000000000000000>] worker_thread+0x244/0x450
[<0000000000000000>] kthread+0x118/0x130
[<0000000000000000>] 0xffffffffffffffff
Not sure where the issue may be at this point, but I'll continue looking at this.
from kernel.
Update 2:
So, the issue mentioned above - the kworker stuck after my change - is present even if I format data on 4.14. That means that it is not related to the 4.4 encryption method, my change simply break encryption on 4.14.
Looking into that, I verified that for some reason the kernel is not able to find the decryption key for the file contents anymore:
https://github.com/roberto-sartori-gl/4.14-kernel-oneplus-msm8998/blob/msm8998_op_new/security/pfe/pfk_kc.c#L283
Here, it just returns NULL after trying all the indexes up to PFK_KC_TABLE_SIZE.
Not sure what's happening at the moment.
from kernel.
I finally fixed this issue.
This is the commit: OnePlus-5-T@f9f700b
Basically, support for ICE calls for UFS > 2.0 is not correctly implemented on 4.14 from the Sony repo. Not sure if Yoshino is actually using UFS 2.x.
OP5/5T uses UFS 2.1, so the method ufs_qcom_ice_cfg_end (from ufs-qcom.c) was never called, causing ICE to be unable to overwrite keys - limiting the total number of keys to 32 (for encryption purposes).
With the patch above, when a key is not needed it can be overwritten by ICE with a new key succesfully.
from kernel.
Related Issues (20)
- Latest update on LA.UM.6.4.r1 broke compilation HOT 8
- LA.UM.7.1.r1 for ganges ? HOT 3
- Missing techpack/audio/Kconfig ! HOT 3
- techpack requires slimbus
- Why is there no suzuran defconfig HOT 6
- Sony Xperia 5 AOSP HOT 7
- techpack/audio/kconfig something in config is wrong HOT 6
- Kagura HOT 3
- Incomplete directories, Kernel will not compile:"audio/Kconfig not found"; Please test what you provide HOT 24
- automativ kernel build for Xperia 1II HOT 4
- boot loader unlock does not work on the Sony Xperia 5 iii HOT 2
- outdated - any chance of patching to .290? HOT 1
- Doesn't build anymore HOT 1
- Software binaries for AOSP Android 11.0 – Kernel 4.14 – Yoshino v9a is missing a ton of stuff HOT 3
- Camera issue on Xperia 1(SO-03L) HOT 2
- Sony debug UART port HOT 58
- [aosp/LA.UM.7.1.r1] High battery consumption in deep sleep - RPM power mode HOT 1
- Xperia 10 IV PMIC driver HOT 3
- msm8998 multi-thread performances with updated kernel HOT 13
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 kernel.