Commit graph

5 commits

Author SHA1 Message Date
fatalcoder524
1376511c6e
Fix missing #include <linux/dma-buf.h> in a16-6.12 <92 kernels 2026-11-09 19:23:06 +05:30
fatalcoder524
ae58d5e228
Fix task_struct KABI alignment 6.1.157 and above
Place
dmabuf_info : slot 2
sched_prop : slot 3
scx : slot 4

Something similar to:
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1555,14 +1555,14 @@ struct task_struct {
 #endif

 	ANDROID_KABI_USE(1, unsigned int saved_state);
+	ANDROID_KABI_USE(2, struct task_dma_buf_info *dmabuf_info);
 #ifdef CONFIG_SLIM_SCHED
-	ANDROID_KABI_USE(2, unsigned long sched_prop);
-	ANDROID_KABI_USE(3, struct sched_ext_entity *scx);
-	ANDROID_KABI_USE(4, struct task_dma_buf_info *dmabuf_info);
+	ANDROID_KABI_USE(3, unsigned long sched_prop);
+	ANDROID_KABI_USE(4, struct sched_ext_entity *scx);
 #else
-	ANDROID_KABI_USE(2, struct task_dma_buf_info *dmabuf_info);
 	ANDROID_KABI_RESERVE(3);
 	ANDROID_KABI_RESERVE(4);
 #endif
 	ANDROID_KABI_RESERVE(5);
 	ANDROID_KABI_RESERVE(6);
2026-11-09 17:24:48 +05:30
fatalcoder524
b107df3d2c
Fix bootloop caused by export test_task_ux
Caused by:
5c8c927af4
and similar commits

Vendor module already exports `test_task_ux`. The 1001 sync added EXPORT_SYMBOL_GPL(test_task_ux) to block/blk-mq.c, but the vendor module oplus_bsp_sched_assist.ko (built from vendor/oplus/kernel/cpu/sched/sched_assist/sa_common.c) already defines and exports the same symbol, and it is part of the first-stage vendor_boot module set.

For more info, checkout:
https://github.com/OnePlusOSS/android_kernel_common_oneplus_sm8650/issues/42
https://github.com/OnePlusOSS/android_kernel_common_oneplus_sm8650/issues/35#issuecomment-5045684911

Also revert: 704193404f
2026-11-09 17:24:48 +05:30
fatalcoder524
61c5d514ef
feat(compat): add rule for MTK tfa98xx firmware dotdot exception
Port the MediaTek audio firmware path exception from workflow shell
scripting into a declarative stage-1 compatibility rule.

Upstream kernel 5.10.226+ introduced name_contains_dotdot() in
drivers/base/firmware_loader/main.c to prevent path traversal in
firmware requests. On MediaTek Dimensity and Helio platforms, the
tfa98xx speaker codec requests firmware via relative traversal paths
(e.g. '../../odm/firmware/tfa98xx.cnt'), which causes the upstream
check to fail with -EINVAL (-22), leaving the codec uninitialized
and breaking speaker audio.

Add rule 'mtk-tfa98xx-firmware-dotdot-exception':
- Target: android12-5.10 (sublevel >= 226) on MediaTek SoCs
  (soc=("dimensity*", "helio*")).
- Uses Composite edit:
  1. InsertRelative: injects name_is_confined_vendor_firmware() above
     name_contains_dotdot().
  2. ReplaceRegex: gates the dotdot failure condition on the helper.
- Gated by when: only runs if name_contains_dotdot() is present and
  the helper has not already been added.

This confines the traversal exception strictly to fixed vendor firmware
roots ('../../odm/firmware/', '../odm/firmware/') while ensuring any
further traversal attempts are still rejected, preserving upstream
security defense-in-depth without disabling the guard kernel-wide.

Fixes #287
2026-11-09 17:24:48 +05:30
fatalcoder524
cdd0f7483d
Replace bash SUSFS compat patching with Python framework
Replace the per-KMI fake_patched/fake_patched2/fake_patched_expand bash
flags (grep/sed/perl one-liners) with a declarative, idempotent Python
compatibility layer:

- scripts/fix_susfs_compatibility_patches.py: stage1/stage2 driver with
  Target (KMI + sublevel range) matching, Rule-based dispatch, and
  comment/string-literal-aware brace scanning (BraceScope) for safely
  scoping edits to a single function body.
- scripts/README.md: full usage guide and Edit-type reference.
- tests/test_susfs_compat.py, tests/test_rules_integration.py: unit and
  integration coverage for the primitives and the real RULES tuple.

Workflow changes:
- stage 1 now runs before the main SUSFS patch, stage 2 after it;
  `patch -p1` invocations remain in the workflow shell, never in Python.
- main patch is applied via dry-run-then-apply instead of applying for
  real and patching over .rej files.
- fold_fixup_entries.patch application stays in-workflow, gated on the
  same header-presence check as before.
- compat state is written to $RUNNER_TEMP, keyed per KMI, so stage 2
  can tell which stage-1 edits actually fired without relying on
  remembered line numbers/offsets.

All existing fake_patched*-gated edits were ported to Rule entries with
their original sublevel gates preserved (zswap <=57, dma-buf <=92,
vma-block-expand/pagemap-locals <=30, swap-slots >=123). Previously
ungated edits (android14-6.1 trace/hooks/blk.h, android13-5.15
trace/hooks/mm.h, dma-buf on android14-6.1) were added as new Rules
since they existed in bash but were missing from the first pass of the
Python port.
2026-11-09 17:24:30 +05:30