| 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # |
| 4 | # Init code and data are freed after boot, so a klp relocation against them can |
| 5 | # never resolve. Such a patch must be rejected. |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | # The rejection can only happen if the patched build really does reference the |
| 13 | # init symbol. The fixture makes init_only volatile so the read cannot be |
| 14 | # folded away, and this checks that it worked: without a relocation klp diff |
| 15 | # would succeed, and the failure below would read as a missing check rather |
| 16 | # than as a fixture which stopped posing the question. |
| 17 | # Either spelling will do. A file-local variable is reached through its |
| 18 | # section symbol -- .init.data -- and a global one by name; which of the two |
| 19 | # the compiler picks is its business, and the reference is what matters. |
| 20 | | |
| 21 | | || |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | | || |
| 27 | |
| 28 | |
| 29 |