Message ID | 20231017-module_relocations-v4-0-937f5ef316f0@rivosinc.com (mailing list archive) |
---|---|
Headers | show |
Series | riscv: Add remaining module relocations and tests | expand |
Hey Charlie, On Tue, Oct 17, 2023 at 10:34:15PM -0700, Charlie Jenkins wrote: > A handful of module relocations were missing, this patch includes the > remaining ones. I also wrote some test cases to ensure that module > loading works properly. Some relocations cannot be supported in the > kernel, these include the ones that rely on thread local storage and > dynamic linking. > > ULEB128 handling is a bit special because SET and SUB relocations must > happen together, and SET must happen before SUB. A psABI proposal [1] > mandates that the first SET_ULEB128 that appears before a SUB_ULEB128 > is the associated SET_ULEB128. > > This can be tested by enabling KUNIT, RUNTIME_KERNEL_TESTING_MENU, and > RISCV_MODULE_LINKING_KUNIT. > > [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/403 > > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> > --- > Changes in v4: > - Complete removal of R_RISCV_RVC_LUI > - Fix bug in R_RISCV_SUB6 linking > - Only build ULEB128 tests if supported by toolchain > - Link to v3: https://lore.kernel.org/r/20231016-module_relocations-v3-0-a667fd6071e9@rivosinc.com On patch 2/2: ../arch/riscv/kernel/tests/module_test/test_uleb128.S:18:17: error: unknown relocation name ../arch/riscv/kernel/tests/module_test/test_uleb128.S:19:17: error: unknown relocation name Same toolchain configuration in the patchwork automation as before. Cheers, Conor. > > Changes in v3: > - Add prototypes to test_module_linking_main as recommended by intel > zero day bot > - Improve efficiency of ULEB128 pair matching > - Link to v2: https://lore.kernel.org/r/20231006-module_relocations-v2-0-47566453fedc@rivosinc.com > > Changes in v2: > - Added ULEB128 relocations > - Link to v1: https://lore.kernel.org/r/20230913-module_relocations-v1-0-bb3d8467e793@rivosinc.com > > --- > Charlie Jenkins (2): > riscv: Add remaining module relocations > riscv: Add tests for riscv module loading > > arch/riscv/Kconfig.debug | 1 + > arch/riscv/include/uapi/asm/elf.h | 5 +- > arch/riscv/kernel/Makefile | 1 + > arch/riscv/kernel/module.c | 207 ++++++++++++++++++--- > arch/riscv/kernel/tests/Kconfig.debug | 35 ++++ > arch/riscv/kernel/tests/Makefile | 1 + > arch/riscv/kernel/tests/module_test/Makefile | 15 ++ > .../tests/module_test/test_module_linking_main.c | 85 +++++++++ > arch/riscv/kernel/tests/module_test/test_set16.S | 23 +++ > arch/riscv/kernel/tests/module_test/test_set32.S | 20 ++ > arch/riscv/kernel/tests/module_test/test_set6.S | 23 +++ > arch/riscv/kernel/tests/module_test/test_set8.S | 23 +++ > arch/riscv/kernel/tests/module_test/test_sub16.S | 22 +++ > arch/riscv/kernel/tests/module_test/test_sub32.S | 22 +++ > arch/riscv/kernel/tests/module_test/test_sub6.S | 22 +++ > arch/riscv/kernel/tests/module_test/test_sub64.S | 27 +++ > arch/riscv/kernel/tests/module_test/test_sub8.S | 22 +++ > arch/riscv/kernel/tests/module_test/test_uleb128.S | 20 ++ > 18 files changed, 548 insertions(+), 26 deletions(-) > --- > base-commit: 4d320c2d9a2b22f53523a1b012cda17a50220965 > change-id: 20230908-module_relocations-f63ced651bd7 > -- > - Charlie >
On Wed, Oct 18, 2023 at 12:35:55PM +0100, Conor Dooley wrote: > Hey Charlie, > > On Tue, Oct 17, 2023 at 10:34:15PM -0700, Charlie Jenkins wrote: > > A handful of module relocations were missing, this patch includes the > > remaining ones. I also wrote some test cases to ensure that module > > loading works properly. Some relocations cannot be supported in the > > kernel, these include the ones that rely on thread local storage and > > dynamic linking. > > > > ULEB128 handling is a bit special because SET and SUB relocations must > > happen together, and SET must happen before SUB. A psABI proposal [1] > > mandates that the first SET_ULEB128 that appears before a SUB_ULEB128 > > is the associated SET_ULEB128. > > > > This can be tested by enabling KUNIT, RUNTIME_KERNEL_TESTING_MENU, and > > RISCV_MODULE_LINKING_KUNIT. > > > > [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/403 > > > > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> > > --- > > Changes in v4: > > - Complete removal of R_RISCV_RVC_LUI > > - Fix bug in R_RISCV_SUB6 linking > > - Only build ULEB128 tests if supported by toolchain > > - Link to v3: https://lore.kernel.org/r/20231016-module_relocations-v3-0-a667fd6071e9@rivosinc.com > > On patch 2/2: > > ../arch/riscv/kernel/tests/module_test/test_uleb128.S:18:17: error: unknown relocation name > ../arch/riscv/kernel/tests/module_test/test_uleb128.S:19:17: error: unknown relocation name > > Same toolchain configuration in the patchwork automation as before. > > Cheers, > Conor. Where do you see this error? On Patchwork I see a success [1]. [1] https://patchwork.kernel.org/project/linux-riscv/patch/20231017-module_relocations-v4-2-937f5ef316f0@rivosinc.com/ > > > > > Changes in v3: > > - Add prototypes to test_module_linking_main as recommended by intel > > zero day bot > > - Improve efficiency of ULEB128 pair matching > > - Link to v2: https://lore.kernel.org/r/20231006-module_relocations-v2-0-47566453fedc@rivosinc.com > > > > Changes in v2: > > - Added ULEB128 relocations > > - Link to v1: https://lore.kernel.org/r/20230913-module_relocations-v1-0-bb3d8467e793@rivosinc.com > > > > --- > > Charlie Jenkins (2): > > riscv: Add remaining module relocations > > riscv: Add tests for riscv module loading > > > > arch/riscv/Kconfig.debug | 1 + > > arch/riscv/include/uapi/asm/elf.h | 5 +- > > arch/riscv/kernel/Makefile | 1 + > > arch/riscv/kernel/module.c | 207 ++++++++++++++++++--- > > arch/riscv/kernel/tests/Kconfig.debug | 35 ++++ > > arch/riscv/kernel/tests/Makefile | 1 + > > arch/riscv/kernel/tests/module_test/Makefile | 15 ++ > > .../tests/module_test/test_module_linking_main.c | 85 +++++++++ > > arch/riscv/kernel/tests/module_test/test_set16.S | 23 +++ > > arch/riscv/kernel/tests/module_test/test_set32.S | 20 ++ > > arch/riscv/kernel/tests/module_test/test_set6.S | 23 +++ > > arch/riscv/kernel/tests/module_test/test_set8.S | 23 +++ > > arch/riscv/kernel/tests/module_test/test_sub16.S | 22 +++ > > arch/riscv/kernel/tests/module_test/test_sub32.S | 22 +++ > > arch/riscv/kernel/tests/module_test/test_sub6.S | 22 +++ > > arch/riscv/kernel/tests/module_test/test_sub64.S | 27 +++ > > arch/riscv/kernel/tests/module_test/test_sub8.S | 22 +++ > > arch/riscv/kernel/tests/module_test/test_uleb128.S | 20 ++ > > 18 files changed, 548 insertions(+), 26 deletions(-) > > --- > > base-commit: 4d320c2d9a2b22f53523a1b012cda17a50220965 > > change-id: 20230908-module_relocations-f63ced651bd7 > > -- > > - Charlie > >
On Wed, Oct 18, 2023 at 10:31:29AM -0700, Charlie Jenkins wrote: > On Wed, Oct 18, 2023 at 12:35:55PM +0100, Conor Dooley wrote: > > Hey Charlie, > > > > On Tue, Oct 17, 2023 at 10:34:15PM -0700, Charlie Jenkins wrote: > > > A handful of module relocations were missing, this patch includes the > > > remaining ones. I also wrote some test cases to ensure that module > > > loading works properly. Some relocations cannot be supported in the > > > kernel, these include the ones that rely on thread local storage and > > > dynamic linking. > > > > > > ULEB128 handling is a bit special because SET and SUB relocations must > > > happen together, and SET must happen before SUB. A psABI proposal [1] > > > mandates that the first SET_ULEB128 that appears before a SUB_ULEB128 > > > is the associated SET_ULEB128. > > > > > > This can be tested by enabling KUNIT, RUNTIME_KERNEL_TESTING_MENU, and > > > RISCV_MODULE_LINKING_KUNIT. > > > > > > [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/403 > > > > > > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> > > > --- > > > Changes in v4: > > > - Complete removal of R_RISCV_RVC_LUI > > > - Fix bug in R_RISCV_SUB6 linking > > > - Only build ULEB128 tests if supported by toolchain > > > - Link to v3: https://lore.kernel.org/r/20231016-module_relocations-v3-0-a667fd6071e9@rivosinc.com > > > > On patch 2/2: > > > > ../arch/riscv/kernel/tests/module_test/test_uleb128.S:18:17: error: unknown relocation name > > ../arch/riscv/kernel/tests/module_test/test_uleb128.S:19:17: error: unknown relocation name > > > > Same toolchain configuration in the patchwork automation as before. > > > > Cheers, > > Conor. > > Where do you see this error? On Patchwork I see a success [1]. > > [1] https://patchwork.kernel.org/project/linux-riscv/patch/20231017-module_relocations-v4-2-937f5ef316f0@rivosinc.com/ It was a failure this morning! See <https://github.com/linux-riscv/linux-riscv/actions/runs/6549280771/job/17785844013> I wonder if there is something wrong with the CI code, where it erroneously reports the state from previous patches and then runs the tests again with the new patches and re-pushes the results. Bjorn, any idea?
Conor Dooley <conor@kernel.org> writes: > On Wed, Oct 18, 2023 at 10:31:29AM -0700, Charlie Jenkins wrote: >> On Wed, Oct 18, 2023 at 12:35:55PM +0100, Conor Dooley wrote: >> > Hey Charlie, >> > >> > On Tue, Oct 17, 2023 at 10:34:15PM -0700, Charlie Jenkins wrote: >> > > A handful of module relocations were missing, this patch includes the >> > > remaining ones. I also wrote some test cases to ensure that module >> > > loading works properly. Some relocations cannot be supported in the >> > > kernel, these include the ones that rely on thread local storage and >> > > dynamic linking. >> > > >> > > ULEB128 handling is a bit special because SET and SUB relocations must >> > > happen together, and SET must happen before SUB. A psABI proposal [1] >> > > mandates that the first SET_ULEB128 that appears before a SUB_ULEB128 >> > > is the associated SET_ULEB128. >> > > >> > > This can be tested by enabling KUNIT, RUNTIME_KERNEL_TESTING_MENU, and >> > > RISCV_MODULE_LINKING_KUNIT. >> > > >> > > [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/403 >> > > >> > > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> >> > > --- >> > > Changes in v4: >> > > - Complete removal of R_RISCV_RVC_LUI >> > > - Fix bug in R_RISCV_SUB6 linking >> > > - Only build ULEB128 tests if supported by toolchain >> > > - Link to v3: https://lore.kernel.org/r/20231016-module_relocations-v3-0-a667fd6071e9@rivosinc.com >> > >> > On patch 2/2: >> > >> > ../arch/riscv/kernel/tests/module_test/test_uleb128.S:18:17: error: unknown relocation name >> > ../arch/riscv/kernel/tests/module_test/test_uleb128.S:19:17: error: unknown relocation name >> > >> > Same toolchain configuration in the patchwork automation as before. >> > >> > Cheers, >> > Conor. >> >> Where do you see this error? On Patchwork I see a success [1]. >> >> [1] https://patchwork.kernel.org/project/linux-riscv/patch/20231017-module_relocations-v4-2-937f5ef316f0@rivosinc.com/ > > It was a failure this morning! > See > <https://github.com/linux-riscv/linux-riscv/actions/runs/6549280771/job/17785844013> > > I wonder if there is something wrong with the CI code, where it > erroneously reports the state from previous patches and then runs the > tests again with the new patches and re-pushes the results. > > Bjorn, any idea? The PW syncher tries to reuse the Github PR branch for newer versions. Say that v4 has some set of results, and v5 some set of results. Then, it'll be a bit of flux until v5 is fully built. Hmm, I'll try to improve that. The PW v4 should never get results from PW v5... FWIW, the v5 of the series https://patchwork.kernel.org/project/linux-riscv/list/?series=794521 has a bunch of errors. Björn
A handful of module relocations were missing, this patch includes the remaining ones. I also wrote some test cases to ensure that module loading works properly. Some relocations cannot be supported in the kernel, these include the ones that rely on thread local storage and dynamic linking. ULEB128 handling is a bit special because SET and SUB relocations must happen together, and SET must happen before SUB. A psABI proposal [1] mandates that the first SET_ULEB128 that appears before a SUB_ULEB128 is the associated SET_ULEB128. This can be tested by enabling KUNIT, RUNTIME_KERNEL_TESTING_MENU, and RISCV_MODULE_LINKING_KUNIT. [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/403 Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> --- Changes in v4: - Complete removal of R_RISCV_RVC_LUI - Fix bug in R_RISCV_SUB6 linking - Only build ULEB128 tests if supported by toolchain - Link to v3: https://lore.kernel.org/r/20231016-module_relocations-v3-0-a667fd6071e9@rivosinc.com Changes in v3: - Add prototypes to test_module_linking_main as recommended by intel zero day bot - Improve efficiency of ULEB128 pair matching - Link to v2: https://lore.kernel.org/r/20231006-module_relocations-v2-0-47566453fedc@rivosinc.com Changes in v2: - Added ULEB128 relocations - Link to v1: https://lore.kernel.org/r/20230913-module_relocations-v1-0-bb3d8467e793@rivosinc.com --- Charlie Jenkins (2): riscv: Add remaining module relocations riscv: Add tests for riscv module loading arch/riscv/Kconfig.debug | 1 + arch/riscv/include/uapi/asm/elf.h | 5 +- arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/module.c | 207 ++++++++++++++++++--- arch/riscv/kernel/tests/Kconfig.debug | 35 ++++ arch/riscv/kernel/tests/Makefile | 1 + arch/riscv/kernel/tests/module_test/Makefile | 15 ++ .../tests/module_test/test_module_linking_main.c | 85 +++++++++ arch/riscv/kernel/tests/module_test/test_set16.S | 23 +++ arch/riscv/kernel/tests/module_test/test_set32.S | 20 ++ arch/riscv/kernel/tests/module_test/test_set6.S | 23 +++ arch/riscv/kernel/tests/module_test/test_set8.S | 23 +++ arch/riscv/kernel/tests/module_test/test_sub16.S | 22 +++ arch/riscv/kernel/tests/module_test/test_sub32.S | 22 +++ arch/riscv/kernel/tests/module_test/test_sub6.S | 22 +++ arch/riscv/kernel/tests/module_test/test_sub64.S | 27 +++ arch/riscv/kernel/tests/module_test/test_sub8.S | 22 +++ arch/riscv/kernel/tests/module_test/test_uleb128.S | 20 ++ 18 files changed, 548 insertions(+), 26 deletions(-) --- base-commit: 4d320c2d9a2b22f53523a1b012cda17a50220965 change-id: 20230908-module_relocations-f63ced651bd7