| 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # |
| 4 | # find_export() matched on symbol name alone, so a static function or variable |
| 5 | # sharing a name with an export was mistaken for a reference to that export. |
| 6 | # For a vmlinux export that means no klp relocation at all: the normal |
| 7 | # relocation left behind is resolved by the module loader to the vmlinux |
| 8 | # symbol, and the patched code quietly reads and writes the wrong object. |
| 9 | # |
| 10 | # Exports are always global, so a local symbol is never one. |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | # The static the fixture uses. Compilers mangle statics variously -- gcc says |
| 18 | # counter.0, clang says target.counter -- so find what this one produced rather |
| 19 | # than assuming a shape. |
| 20 | local_sym=" |
| 21 | )" |
| 22 | [ || |
| 23 | |
| 24 | |
| 25 | # Contrive the collision: something else exports that same name. |
| 26 | |
| 27 | |
| 28 | |
| 29 | # Still treated as the local it is, not as the export. |
| 30 | |
| 31 | |
| 32 |