Commit 89547d0
committed
arch: model the module band where the kernel actually puts it (ppc32, riscv32)
module_base_bounds emits the band edges at CONF_INFERRED, so a band that
does not cover the real module region puts a guaranteed bound on
Q_MODULE_BASE that excludes the truth -- and the region check rejects
every genuine module leak on top of that. Two arches had one.
riscv32 declared the band as the upper VAS, floor at PAGE_OFFSET. The
kernel puts it below: MODULES_VADDR is VMALLOC_START, which is
PAGE_OFFSET - VMALLOC_SIZE, and VMALLOC_SIZE is KERN_VIRT_SIZE >> 1. rv32
is sv32 only, so PGDIR_SHIFT 22 and PTRS_PER_PGD 1024 fix that at 512 MiB
exactly, with no configuration to take a union over. The declared band and
the real one were disjoint.
ppc32 declared the 8xx / book3s32 window, PAGE_OFFSET - 256 MiB upward.
Only those two platforms define MODULES_VADDR; every other one, PPC_85xx
among them -- the only ppc32 platform that randomizes -- allocates from
the shared vmalloc window instead, whose edges are runtime values above
PAGE_OFFSET. Nothing at compile time distinguishes the two kernels, so
the band is now the union of both.
The projection clamped its floor to KERNEL_VIRT_VAS_START, which on both
of these arches IS PAGE_OFFSET -- so a band below it collapsed to a point
the moment PAGE_OFFSET was pinned, discarding what the arch headers had
just been corrected to say. The floor only ever needed protecting against
the wrap a subtracting relation produces on a low split, which is the test
module_base_bounds already applies to the same edges. arm32 is untouched
either way: its VAS floor is the lowest admissible split, not PAGE_OFFSET.
The band test mirrored the clamp rather than asserting the relation, so it
would have agreed with either behaviour. It now asserts the projected
floor is the relation's own value, and fails on ppc32 and riscv32 -- not
arm32 -- if the clamp returns.1 parent 3b4fe25 commit 89547d0
4 files changed
Lines changed: 62 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
49 | 66 | | |
50 | 67 | | |
51 | | - | |
| 68 | + | |
52 | 69 | | |
53 | 70 | | |
54 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
44 | 57 | | |
45 | | - | |
46 | | - | |
| 58 | + | |
| 59 | + | |
47 | 60 | | |
48 | 61 | | |
49 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3960 | 3960 | | |
3961 | 3961 | | |
3962 | 3962 | | |
3963 | | - | |
3964 | | - | |
3965 | | - | |
3966 | | - | |
3967 | | - | |
3968 | | - | |
| 3963 | + | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
| 3967 | + | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
3969 | 3973 | | |
3970 | 3974 | | |
3971 | 3975 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1916 | 1916 | | |
1917 | 1917 | | |
1918 | 1918 | | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
1919 | 1926 | | |
1920 | 1927 | | |
1921 | | - | |
1922 | | - | |
| 1928 | + | |
1923 | 1929 | | |
1924 | 1930 | | |
1925 | 1931 | | |
| |||
0 commit comments