Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
fs/proc/base: Allow AppCompactor to access reclaim
Browse files Browse the repository at this point in the history
On AOSP ROMs CachedAppOptimizer tries to access reclaim for allocation
stats, process id and name
But CAF restricts userspace access to reclaim resulting in following
warning

[   29.986900] ------------[ cut here ]------------
[   29.986921] mWARNING: CPU: 1 PID: 1858 at
../../../../../../kernel/xiaomi/raphael/mm/vmscan.c:1685
isolate_lru_page+0x1e4/0x1ec
[   29.986925] Modules linked in:
[   29.986932] mCPU: 1 PID: 1858 Comm: CachedAppOptimi Tainted: G S
4.14.210-IMMENSiTY//f950c60da2 #2
[   29.986934] mHardware name: Qualcomm Technologies, Inc. SM8150 V2
PM8150 RAPHAEL (DT)
[   29.986937] mtask: 0000000050b69203 task.stack: 000000007e9ca8b3
[   29.986939] mpc : isolate_lru_page+0x1e4/0x1ec
[   29.986942] mlr : isolate_lru_page+0x1e4/0x1ec
[   29.986943] msp : ffffff8024893a90 pstate : 60000145
[   29.986945] mx29: ffffff8024893a90 x28: 0400000000000001
[   29.986948] mx27: ffffff8024893c18 x26: 0000000000000000
[   29.986952] mx25: 0000000000000000 x24: ffffffbf98cbbc40
[   29.986955] mx23: ffffffe61b3f7b08 x22: 0000000000000000
[   29.986958] mx21: ffffffe61b8010c0 x20: 00000007ffd61000
[   29.986962] mx19: ffffffbf98cbbc40 x18: 0000007922434000
[   29.986965] mx17: 0000000000000000 x16: 0000000000000001
[   29.986968] mx15: ffffffffffffffff x14: 0000007c49f7bd22
[   29.986972] mx13: 0000000000000004 x12: 0000000000000000
[   29.986975] mx11: 0000000000000000 x10: ffffffffffffffff
[   29.986978] mx9 : 7bee4e9ab8c00e00 x8 : 7bee4e9ab8c00e00
[   29.986981] mx7 : 000000000000001b x6 : ffffff9586fd3b93
[   29.986985] mx5 : ffffff80248937d8 x4 : 0000000000000000
[   29.986988] mx3 : 0000000000000065 x2 : 000000000000001b
[   29.986991] mx1 : 00000000000001c0 x0 : 000000000000001b
[   29.986995] m\x0aPC: 0xffffff95849f8650:
[   29.986996] 8650  2a1603e2 94012ce6 2a1f03f3 f94002e8 5282c009
8b090100 944e0032 2a1303e0
[   29.987007] 8670  a9434ff4 a94257f6 f9400bf7 a8c47bfd d65f03c0
9000c620 9106b400 97fcc349
[   29.987017] 8690  d4210000 17ffff94 d102c3ff b0010f28 f9478508
a9067bfd 910183fd f9003bf9
[   29.987026] 86b0  a9085ff8 a90957f6 a90a4ff4 f81f83a8 52801808
52800049 5280018a 72a02808
[   29.987036] m\x0aLR: 0xffffff95849f8650:
[   29.987037] 8650  2a1603e2 94012ce6 2a1f03f3 f94002e8 5282c009
8b090100 944e0032 2a1303e0
[   29.987047] 8670  a9434ff4 a94257f6 f9400bf7 a8c47bfd d65f03c0
9000c620 9106b400 97fcc349
[   29.987056] 8690  d4210000 17ffff94 d102c3ff b0010f28 f9478508
a9067bfd 910183fd f9003bf9
[   29.987066] 86b0  a9085ff8 a90957f6 a90a4ff4 f81f83a8 52801808
52800049 5280018a 72a02808
[   29.987076] m\x0aSP: 0xffffff8024893a50:
[   29.987077] 3a50  849f8690 ffffff95 60000145 00000000 ffffffc8
ffffff80 b8c00e00 7bee4e9a
[   29.987086] 3a70  ffffffff 0000007f 849f8690 ffffff95 24893a90
ffffff80 849f8690 ffffff95
[   29.987096] 3a90  24893b00 ffffff80 84adfba8 ffffff95 1b3f7b08
ffffffe6 1b3f7b00 ffffffe6
[   29.987105] 3ab0  00000000 00000000 1b8010c0 ffffffe6 ffd61000
00000007 ffda0000 00000007
[   29.987115]
[   29.987116] Call trace:
[   29.987119] isolate_lru_page+0x1e4/0x1ec
[   29.987125] reclaim_pte_range+0x144/0x230
[   29.987129] __walk_page_range+0x120/0x224
[   29.987132] walk_page_range+0x4c/0x128
[   29.987135] reclaim_write+0x298/0x3a8
[   29.987140] __vfs_write+0x44/0x134
[   29.987142] vfs_write+0xe0/0x19c
[   29.987144] SyS_write+0x6c/0xcc
[   29.987148] el0_svc_naked+0x34/0x38
[   29.987150] ---[ end trace 17986baba9f80714 ]---
[   29.987155] trying to isolate tail page
[   29.987162] ------------[ cut here ]------------
[   29.987169] mWARNING: CPU: 1 PID: 1858 at
../../../../../../kernel/xiaomi/raphael/mm/vmscan.c:1685
isolate_lru_page+0x1e4/0x1ec
[   29.987172] Modules linked in:
[   29.987176] mCPU: 1 PID: 1858 Comm: CachedAppOptimi Tainted: G S
W       4.14.210-IMMENSiTY//f950c60da2 #2
[   29.987178] mHardware name: Qualcomm Technologies, Inc. SM8150 V2
PM8150 RAPHAEL (DT)
[   29.987179] mtask: 0000000050b69203 task.stack: 000000007e9ca8b3
[   29.987182] mpc : isolate_lru_page+0x1e4/0x1ec
[   29.987184] mlr : isolate_lru_page+0x1e4/0x1ec
[   29.987186] msp : ffffff8024893a90 pstate : 60000145
[   29.987187] mx29: ffffff8024893a90 x28: 0400000000000001
[   29.987191] mx27: ffffff8024893c18 x26: 0000000000000000
[   29.987194] mx25: 0000000000000000 x24: ffffffbf98cbbc80
[   29.987197] mx23: ffffffe61b3f7b10 x22: 0000000000000000
[   29.987200] mx21: ffffffe61b8010c0 x20: 00000007ffd62000
[   29.987204] mx19: ffffffbf98cbbc80 x18: 0000007922434000
[   29.987207] mx17: 0000000000000000 x16: 0000000000000001
[   29.987210] mx15: ffffffffffffffff x14: 0000007c49f7bd22
[   29.987213] mx13: 0000000000000004 x12: 0000000000000000
[   29.987216] mx11: 0000000000000000 x10: ffffffffffffffff
[   29.987220] mx9 : 7bee4e9ab8c00e00 x8 : 7bee4e9ab8c00e00
[   29.987223] mx7 : 000000000000001b x6 : ffffff9586fd3b93
[   29.987226] mx5 : ffffff80248937d8 x4 : 0000000000000000
[   29.987229] mx3 : 0000000000000065 x2 : 000000000000001b
[   29.987232] mx1 : 00000000000001c0 x0 : 000000000000001b
[   29.987236] m\x0aPC: 0xffffff95849f8650:
[   29.987237] 8650  2a1603e2 94012ce6 2a1f03f3 f94002e8 5282c009
8b090100 944e0032 2a1303e0
[   29.987246] 8670  a9434ff4 a94257f6 f9400bf7 a8c47bfd d65f03c0
9000c620 9106b400 97fcc349
[   29.987256] 8690  d4210000 17ffff94 d102c3ff b0010f28 f9478508
a9067bfd 910183fd f9003bf9
[   29.987265] 86b0  a9085ff8 a90957f6 a90a4ff4 f81f83a8 52801808
52800049 5280018a 72a02808
[   29.987275] m\x0aLR: 0xffffff95849f8650:
[   29.987276] 8650  2a1603e2 94012ce6 2a1f03f3 f94002e8 5282c009
8b090100 944e0032 2a1303e0
[   29.987285] 8670  a9434ff4 a94257f6 f9400bf7 a8c47bfd d65f03c0
9000c620 9106b400 97fcc349
[   29.987295] 8690  d4210000 17ffff94 d102c3ff b0010f28 f9478508
a9067bfd 910183fd f9003bf9
[   29.987304] 86b0  a9085ff8 a90957f6 a90a4ff4 f81f83a8 52801808
52800049 5280018a 72a02808
[   29.987314] m\x0aSP: 0xffffff8024893a50:
[   29.987315] 3a50  849f8690 ffffff95 60000145 00000000 ffffffc8
ffffff80 b8c00e00 7bee4e9a
[   29.987324] 3a70  ffffffff 0000007f 849f8690 ffffff95 24893a90
ffffff80 849f8690 ffffff95
[   29.987334] 3a90  24893b00 ffffff80 84adfba8 ffffff95 1b3f7b10
ffffffe6 1b3f7b00 ffffffe6
[   29.987343] 3ab0  00000000 00000000 1b8010c0 ffffffe6 ffd62000
00000007 ffda0000 00000007
[   29.987353]
[   29.987354] Call trace:
[   29.987357] isolate_lru_page+0x1e4/0x1ec
[   29.987359] reclaim_pte_range+0x144/0x230
[   29.987362] __walk_page_range+0x120/0x224
[   29.987365] walk_page_range+0x4c/0x128
[   29.987368] reclaim_write+0x298/0x3a8
[   29.987370] __vfs_write+0x44/0x134
[   29.987373] vfs_write+0xe0/0x19c
[   29.987375] SyS_write+0x6c/0xcc
[   29.987377] el0_svc_naked+0x34/0x38
[   29.987379] ---[ end trace 17986baba9f80715 ]---
[   29.987385] trying to isolate tail page
[   29.987391] ------------[ cut here ]------------

pixel devices also uses the same permissions for their per-process
reclaim
[*]GrapheneOS-Archive/kernel_msm-coral@18c2af0

Signed-off-by: UtsavBalar1231 <[email protected]>
Signed-off-by: pix106 <[email protected]>
Change-Id: I1d7138d343cf1f1230886bfd47efc3439f273b07
  • Loading branch information
UtsavBalar1231 authored and reocat committed Jan 8, 2024
1 parent da9cc99 commit 75c1eaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3127,7 +3127,7 @@ static const struct pid_entry tgid_base_stuff[] = {
REG("mountinfo", S_IRUGO, proc_mountinfo_operations),
REG("mountstats", S_IRUSR, proc_mountstats_operations),
#ifdef CONFIG_PROCESS_RECLAIM
REG("reclaim", S_IWUSR, proc_reclaim_operations),
REG("reclaim", S_IWUGO, proc_reclaim_operations),
#endif
#ifdef CONFIG_PROC_PAGE_MONITOR
REG("clear_refs", S_IWUSR, proc_clear_refs_operations),
Expand Down

0 comments on commit 75c1eaf

Please sign in to comment.