| 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # |
| 4 | # A reference the patch adds has no counterpart in the original object. klp |
| 5 | # diff used to reject any such reference needing a klp relocation, which ruled |
| 6 | # out patches that call something they did not call before -- a common enough |
| 7 | # thing for a fix to do. |
| 8 | # |
| 9 | # Module.symvers is what makes it safe: it says the symbol exists and who owns |
| 10 | # it. But that is only sufficient for a vmlinux export. A new reference to a |
| 11 | # module's export is a dependency the patch module does not declare, and the |
| 12 | # relocation would resolve only if that module happened to be loaded, so it |
| 13 | # stays an error. |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | # Exported by vmlinux, in a module: namespace so it needs a klp relocation |
| 21 | # rather than an ordinary one. Allowed. |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | # Exported by a module the patched object does not depend on. Rejected, and |
| 28 | # for that reason rather than some other. |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | # ... unless the original already referenced something that module exports. |
| 35 | # The loader will not let the patched object load without other_mod, so the |
| 36 | # klp relocation has something to resolve against, and klp diff allows it. |
| 37 | # This is the other half of the rule, and it fails in the opposite direction: |
| 38 | # refusing here would reject a patch which is safe to apply. |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 |