All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-07-26  9:53 ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:53 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Petr Tesarik <petr.tesarik.ext@huawei.com>

The kexec_file_load(2) syscall does not work at least in some kernel
builds. For details see the relevant section in this blog post:

https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html

This patch series handles an additional relocation types, removes the need
to implement a Global Offset Table (GOT) for the purgatory and fixes the
placement of initrd.

Changelog
=========

Changes from v1:
- Replace memcmp() with a for loop.
- Drop handling of 16-bit add/subtract relocations. They were used only
  by alternatives in strcmp(), which was referenced only by string.o.
- Add the initrd placement fix.

Petr Tesarik (1):
  riscv/purgatory: do not link with string.o and its dependencies

Torsten Duwe (2):
  riscv/kexec: handle R_RISCV_CALL_PLT relocation type
  riscv/kexec: load initrd high in available memory

 arch/riscv/kernel/elf_kexec.c    |  3 ++-
 arch/riscv/purgatory/Makefile    | 26 +-------------------------
 arch/riscv/purgatory/purgatory.c |  6 ++++--
 3 files changed, 7 insertions(+), 28 deletions(-)

-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-07-26  9:53 ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:53 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Petr Tesarik <petr.tesarik.ext@huawei.com>

The kexec_file_load(2) syscall does not work at least in some kernel
builds. For details see the relevant section in this blog post:

https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html

This patch series handles an additional relocation types, removes the need
to implement a Global Offset Table (GOT) for the purgatory and fixes the
placement of initrd.

Changelog
=========

Changes from v1:
- Replace memcmp() with a for loop.
- Drop handling of 16-bit add/subtract relocations. They were used only
  by alternatives in strcmp(), which was referenced only by string.o.
- Add the initrd placement fix.

Petr Tesarik (1):
  riscv/purgatory: do not link with string.o and its dependencies

Torsten Duwe (2):
  riscv/kexec: handle R_RISCV_CALL_PLT relocation type
  riscv/kexec: load initrd high in available memory

 arch/riscv/kernel/elf_kexec.c    |  3 ++-
 arch/riscv/purgatory/Makefile    | 26 +-------------------------
 arch/riscv/purgatory/purgatory.c |  6 ++++--
 3 files changed, 7 insertions(+), 28 deletions(-)

-- 
2.25.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-07-26  9:53 ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:53 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Petr Tesarik <petr.tesarik.ext@huawei.com>

The kexec_file_load(2) syscall does not work at least in some kernel
builds. For details see the relevant section in this blog post:

https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html

This patch series handles an additional relocation types, removes the need
to implement a Global Offset Table (GOT) for the purgatory and fixes the
placement of initrd.

Changelog
=========

Changes from v1:
- Replace memcmp() with a for loop.
- Drop handling of 16-bit add/subtract relocations. They were used only
  by alternatives in strcmp(), which was referenced only by string.o.
- Add the initrd placement fix.

Petr Tesarik (1):
  riscv/purgatory: do not link with string.o and its dependencies

Torsten Duwe (2):
  riscv/kexec: handle R_RISCV_CALL_PLT relocation type
  riscv/kexec: load initrd high in available memory

 arch/riscv/kernel/elf_kexec.c    |  3 ++-
 arch/riscv/purgatory/Makefile    | 26 +-------------------------
 arch/riscv/purgatory/purgatory.c |  6 ++++--
 3 files changed, 7 insertions(+), 28 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH v2 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
  2023-07-26  9:53 ` Petr Tesarik
  (?)
@ 2023-07-26  9:53   ` Petr Tesarik
  -1 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:53 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Torsten Duwe <duwe@suse.de>

R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum
18-19 in Table 3. Relocation types here:

https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc

It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT"):

https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0

Recent tools (at least GNU binutils-2.40) already use R_RISCV_CALL_PLT.
Kernels built with such binutils fail kexec_load_file(2) with:

 kexec_image: Unknown rela relocation: 19
 kexec_image: Error loading purgatory ret=-8

The binary code at the call site remains the same, so tell
arch_kexec_apply_relocations_add() to handle _PLT alike.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: Li Zhengyu <lizhengyu3@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/kernel/elf_kexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 5372b708fae2..38390d3bdcac 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
 		 * sym, instead of searching the whole relsec.
 		 */
 		case R_RISCV_PCREL_HI20:
+		case R_RISCV_CALL_PLT:
 		case R_RISCV_CALL:
 			*(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) |
 				 ENCODE_UJTYPE_IMM(val - addr);
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
@ 2023-07-26  9:53   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:53 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Torsten Duwe <duwe@suse.de>

R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum
18-19 in Table 3. Relocation types here:

https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc

It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT"):

https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0

Recent tools (at least GNU binutils-2.40) already use R_RISCV_CALL_PLT.
Kernels built with such binutils fail kexec_load_file(2) with:

 kexec_image: Unknown rela relocation: 19
 kexec_image: Error loading purgatory ret=-8

The binary code at the call site remains the same, so tell
arch_kexec_apply_relocations_add() to handle _PLT alike.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: Li Zhengyu <lizhengyu3@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/kernel/elf_kexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 5372b708fae2..38390d3bdcac 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
 		 * sym, instead of searching the whole relsec.
 		 */
 		case R_RISCV_PCREL_HI20:
+		case R_RISCV_CALL_PLT:
 		case R_RISCV_CALL:
 			*(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) |
 				 ENCODE_UJTYPE_IMM(val - addr);
-- 
2.25.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
@ 2023-07-26  9:53   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:53 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Torsten Duwe <duwe@suse.de>

R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum
18-19 in Table 3. Relocation types here:

https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc

It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT"):

https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0

Recent tools (at least GNU binutils-2.40) already use R_RISCV_CALL_PLT.
Kernels built with such binutils fail kexec_load_file(2) with:

 kexec_image: Unknown rela relocation: 19
 kexec_image: Error loading purgatory ret=-8

The binary code at the call site remains the same, so tell
arch_kexec_apply_relocations_add() to handle _PLT alike.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: Li Zhengyu <lizhengyu3@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/kernel/elf_kexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 5372b708fae2..38390d3bdcac 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
 		 * sym, instead of searching the whole relsec.
 		 */
 		case R_RISCV_PCREL_HI20:
+		case R_RISCV_CALL_PLT:
 		case R_RISCV_CALL:
 			*(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) |
 				 ENCODE_UJTYPE_IMM(val - addr);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
  2023-07-26  9:53 ` Petr Tesarik
  (?)
@ 2023-07-26  9:54   ` Petr Tesarik
  -1 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Petr Tesarik <petr.tesarik.ext@huawei.com>

Linking with this object file makes kexec_file_load(2) fail because of
multiple unknown relocation types:

- R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
- R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()

All this hassle is needed for one single call to memcmp() from
verify_sha256_digest() to compare 32 bytes of SHA256 checksum.

Simply replace this memcmp() call with an explicit loop over those 32 bytes
and remove the need to link with string.o and all the other object files
that provide undefined symbols from that object file.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: Li Zhengyu <lizhengyu3@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/purgatory/Makefile    | 26 +-------------------------
 arch/riscv/purgatory/purgatory.c |  6 ++++--
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile
index dc20e166983e..00f50cd29310 100644
--- a/arch/riscv/purgatory/Makefile
+++ b/arch/riscv/purgatory/Makefile
@@ -1,39 +1,21 @@
 # SPDX-License-Identifier: GPL-2.0
 OBJECT_FILES_NON_STANDARD := y
 
-purgatory-y := purgatory.o sha256.o entry.o string.o ctype.o memcpy.o memset.o
-purgatory-y += strcmp.o strlen.o strncmp.o
+purgatory-y := purgatory.o sha256.o entry.o memcpy.o memset.o
 
 targets += $(purgatory-y)
 PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
 
-$(obj)/string.o: $(srctree)/lib/string.c FORCE
-	$(call if_changed_rule,cc_o_c)
-
-$(obj)/ctype.o: $(srctree)/lib/ctype.c FORCE
-	$(call if_changed_rule,cc_o_c)
-
 $(obj)/memcpy.o: $(srctree)/arch/riscv/lib/memcpy.S FORCE
 	$(call if_changed_rule,as_o_S)
 
 $(obj)/memset.o: $(srctree)/arch/riscv/lib/memset.S FORCE
 	$(call if_changed_rule,as_o_S)
 
-$(obj)/strcmp.o: $(srctree)/arch/riscv/lib/strcmp.S FORCE
-	$(call if_changed_rule,as_o_S)
-
-$(obj)/strlen.o: $(srctree)/arch/riscv/lib/strlen.S FORCE
-	$(call if_changed_rule,as_o_S)
-
-$(obj)/strncmp.o: $(srctree)/arch/riscv/lib/strncmp.S FORCE
-	$(call if_changed_rule,as_o_S)
-
 $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
 CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
-CFLAGS_string.o := -D__DISABLE_EXPORTS
-CFLAGS_ctype.o := -D__DISABLE_EXPORTS
 
 # When profile-guided optimization is enabled, llvm emits two different
 # overlapping text sections, which is not supported by kexec. Remove profile
@@ -83,12 +65,6 @@ CFLAGS_purgatory.o		+= $(PURGATORY_CFLAGS)
 CFLAGS_REMOVE_sha256.o		+= $(PURGATORY_CFLAGS_REMOVE)
 CFLAGS_sha256.o			+= $(PURGATORY_CFLAGS)
 
-CFLAGS_REMOVE_string.o		+= $(PURGATORY_CFLAGS_REMOVE)
-CFLAGS_string.o			+= $(PURGATORY_CFLAGS)
-
-CFLAGS_REMOVE_ctype.o		+= $(PURGATORY_CFLAGS_REMOVE)
-CFLAGS_ctype.o			+= $(PURGATORY_CFLAGS)
-
 asflags-remove-y		+= $(foreach x, -g -gdwarf-4 -gdwarf-5, $(x) -Wa,$(x))
 
 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
diff --git a/arch/riscv/purgatory/purgatory.c b/arch/riscv/purgatory/purgatory.c
index 80596ab5fb62..1d30103d2047 100644
--- a/arch/riscv/purgatory/purgatory.c
+++ b/arch/riscv/purgatory/purgatory.c
@@ -22,14 +22,16 @@ static int verify_sha256_digest(void)
 	struct kexec_sha_region *ptr, *end;
 	struct sha256_state ss;
 	u8 digest[SHA256_DIGEST_SIZE];
+	int i;
 
 	sha256_init(&ss);
 	end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
 	for (ptr = purgatory_sha_regions; ptr < end; ptr++)
 		sha256_update(&ss, (uint8_t *)(ptr->start), ptr->len);
 	sha256_final(&ss, digest);
-	if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)) != 0)
-		return 1;
+	for (i = 0; i < SHA256_DIGEST_SIZE; ++i)
+		if (digest[i] != purgatory_sha256_digest[i])
+			return 1;
 	return 0;
 }
 
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-07-26  9:54   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Petr Tesarik <petr.tesarik.ext@huawei.com>

Linking with this object file makes kexec_file_load(2) fail because of
multiple unknown relocation types:

- R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
- R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()

All this hassle is needed for one single call to memcmp() from
verify_sha256_digest() to compare 32 bytes of SHA256 checksum.

Simply replace this memcmp() call with an explicit loop over those 32 bytes
and remove the need to link with string.o and all the other object files
that provide undefined symbols from that object file.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: Li Zhengyu <lizhengyu3@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/purgatory/Makefile    | 26 +-------------------------
 arch/riscv/purgatory/purgatory.c |  6 ++++--
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile
index dc20e166983e..00f50cd29310 100644
--- a/arch/riscv/purgatory/Makefile
+++ b/arch/riscv/purgatory/Makefile
@@ -1,39 +1,21 @@
 # SPDX-License-Identifier: GPL-2.0
 OBJECT_FILES_NON_STANDARD := y
 
-purgatory-y := purgatory.o sha256.o entry.o string.o ctype.o memcpy.o memset.o
-purgatory-y += strcmp.o strlen.o strncmp.o
+purgatory-y := purgatory.o sha256.o entry.o memcpy.o memset.o
 
 targets += $(purgatory-y)
 PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
 
-$(obj)/string.o: $(srctree)/lib/string.c FORCE
-	$(call if_changed_rule,cc_o_c)
-
-$(obj)/ctype.o: $(srctree)/lib/ctype.c FORCE
-	$(call if_changed_rule,cc_o_c)
-
 $(obj)/memcpy.o: $(srctree)/arch/riscv/lib/memcpy.S FORCE
 	$(call if_changed_rule,as_o_S)
 
 $(obj)/memset.o: $(srctree)/arch/riscv/lib/memset.S FORCE
 	$(call if_changed_rule,as_o_S)
 
-$(obj)/strcmp.o: $(srctree)/arch/riscv/lib/strcmp.S FORCE
-	$(call if_changed_rule,as_o_S)
-
-$(obj)/strlen.o: $(srctree)/arch/riscv/lib/strlen.S FORCE
-	$(call if_changed_rule,as_o_S)
-
-$(obj)/strncmp.o: $(srctree)/arch/riscv/lib/strncmp.S FORCE
-	$(call if_changed_rule,as_o_S)
-
 $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
 CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
-CFLAGS_string.o := -D__DISABLE_EXPORTS
-CFLAGS_ctype.o := -D__DISABLE_EXPORTS
 
 # When profile-guided optimization is enabled, llvm emits two different
 # overlapping text sections, which is not supported by kexec. Remove profile
@@ -83,12 +65,6 @@ CFLAGS_purgatory.o		+= $(PURGATORY_CFLAGS)
 CFLAGS_REMOVE_sha256.o		+= $(PURGATORY_CFLAGS_REMOVE)
 CFLAGS_sha256.o			+= $(PURGATORY_CFLAGS)
 
-CFLAGS_REMOVE_string.o		+= $(PURGATORY_CFLAGS_REMOVE)
-CFLAGS_string.o			+= $(PURGATORY_CFLAGS)
-
-CFLAGS_REMOVE_ctype.o		+= $(PURGATORY_CFLAGS_REMOVE)
-CFLAGS_ctype.o			+= $(PURGATORY_CFLAGS)
-
 asflags-remove-y		+= $(foreach x, -g -gdwarf-4 -gdwarf-5, $(x) -Wa,$(x))
 
 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
diff --git a/arch/riscv/purgatory/purgatory.c b/arch/riscv/purgatory/purgatory.c
index 80596ab5fb62..1d30103d2047 100644
--- a/arch/riscv/purgatory/purgatory.c
+++ b/arch/riscv/purgatory/purgatory.c
@@ -22,14 +22,16 @@ static int verify_sha256_digest(void)
 	struct kexec_sha_region *ptr, *end;
 	struct sha256_state ss;
 	u8 digest[SHA256_DIGEST_SIZE];
+	int i;
 
 	sha256_init(&ss);
 	end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
 	for (ptr = purgatory_sha_regions; ptr < end; ptr++)
 		sha256_update(&ss, (uint8_t *)(ptr->start), ptr->len);
 	sha256_final(&ss, digest);
-	if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)) != 0)
-		return 1;
+	for (i = 0; i < SHA256_DIGEST_SIZE; ++i)
+		if (digest[i] != purgatory_sha256_digest[i])
+			return 1;
 	return 0;
 }
 
-- 
2.25.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-07-26  9:54   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Petr Tesarik <petr.tesarik.ext@huawei.com>

Linking with this object file makes kexec_file_load(2) fail because of
multiple unknown relocation types:

- R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
- R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()

All this hassle is needed for one single call to memcmp() from
verify_sha256_digest() to compare 32 bytes of SHA256 checksum.

Simply replace this memcmp() call with an explicit loop over those 32 bytes
and remove the need to link with string.o and all the other object files
that provide undefined symbols from that object file.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: Li Zhengyu <lizhengyu3@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/purgatory/Makefile    | 26 +-------------------------
 arch/riscv/purgatory/purgatory.c |  6 ++++--
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile
index dc20e166983e..00f50cd29310 100644
--- a/arch/riscv/purgatory/Makefile
+++ b/arch/riscv/purgatory/Makefile
@@ -1,39 +1,21 @@
 # SPDX-License-Identifier: GPL-2.0
 OBJECT_FILES_NON_STANDARD := y
 
-purgatory-y := purgatory.o sha256.o entry.o string.o ctype.o memcpy.o memset.o
-purgatory-y += strcmp.o strlen.o strncmp.o
+purgatory-y := purgatory.o sha256.o entry.o memcpy.o memset.o
 
 targets += $(purgatory-y)
 PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
 
-$(obj)/string.o: $(srctree)/lib/string.c FORCE
-	$(call if_changed_rule,cc_o_c)
-
-$(obj)/ctype.o: $(srctree)/lib/ctype.c FORCE
-	$(call if_changed_rule,cc_o_c)
-
 $(obj)/memcpy.o: $(srctree)/arch/riscv/lib/memcpy.S FORCE
 	$(call if_changed_rule,as_o_S)
 
 $(obj)/memset.o: $(srctree)/arch/riscv/lib/memset.S FORCE
 	$(call if_changed_rule,as_o_S)
 
-$(obj)/strcmp.o: $(srctree)/arch/riscv/lib/strcmp.S FORCE
-	$(call if_changed_rule,as_o_S)
-
-$(obj)/strlen.o: $(srctree)/arch/riscv/lib/strlen.S FORCE
-	$(call if_changed_rule,as_o_S)
-
-$(obj)/strncmp.o: $(srctree)/arch/riscv/lib/strncmp.S FORCE
-	$(call if_changed_rule,as_o_S)
-
 $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
 CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
-CFLAGS_string.o := -D__DISABLE_EXPORTS
-CFLAGS_ctype.o := -D__DISABLE_EXPORTS
 
 # When profile-guided optimization is enabled, llvm emits two different
 # overlapping text sections, which is not supported by kexec. Remove profile
@@ -83,12 +65,6 @@ CFLAGS_purgatory.o		+= $(PURGATORY_CFLAGS)
 CFLAGS_REMOVE_sha256.o		+= $(PURGATORY_CFLAGS_REMOVE)
 CFLAGS_sha256.o			+= $(PURGATORY_CFLAGS)
 
-CFLAGS_REMOVE_string.o		+= $(PURGATORY_CFLAGS_REMOVE)
-CFLAGS_string.o			+= $(PURGATORY_CFLAGS)
-
-CFLAGS_REMOVE_ctype.o		+= $(PURGATORY_CFLAGS_REMOVE)
-CFLAGS_ctype.o			+= $(PURGATORY_CFLAGS)
-
 asflags-remove-y		+= $(foreach x, -g -gdwarf-4 -gdwarf-5, $(x) -Wa,$(x))
 
 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
diff --git a/arch/riscv/purgatory/purgatory.c b/arch/riscv/purgatory/purgatory.c
index 80596ab5fb62..1d30103d2047 100644
--- a/arch/riscv/purgatory/purgatory.c
+++ b/arch/riscv/purgatory/purgatory.c
@@ -22,14 +22,16 @@ static int verify_sha256_digest(void)
 	struct kexec_sha_region *ptr, *end;
 	struct sha256_state ss;
 	u8 digest[SHA256_DIGEST_SIZE];
+	int i;
 
 	sha256_init(&ss);
 	end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
 	for (ptr = purgatory_sha_regions; ptr < end; ptr++)
 		sha256_update(&ss, (uint8_t *)(ptr->start), ptr->len);
 	sha256_final(&ss, digest);
-	if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)) != 0)
-		return 1;
+	for (i = 0; i < SHA256_DIGEST_SIZE; ++i)
+		if (digest[i] != purgatory_sha256_digest[i])
+			return 1;
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
  2023-07-26  9:53 ` Petr Tesarik
  (?)
@ 2023-07-26  9:54   ` Petr Tesarik
  -1 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Torsten Duwe <duwe@suse.de>

When initrd is loaded low, the secondary kernel fails like this:

 INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region

This initrd load address corresponds to the _end symbol, but the
reservation is aligned on PMD_SIZE, as explained by a comment in
setup_bootmem().

It is technically possible to align the initrd load address accordingly,
leaving a hole between the end of kernel and the initrd, but it is much
simpler to allocate the initrd top-down.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/kernel/elf_kexec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 38390d3bdcac..c08bb5c3b385 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -281,7 +281,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
 		kbuf.buffer = initrd;
 		kbuf.bufsz = kbuf.memsz = initrd_len;
 		kbuf.buf_align = PAGE_SIZE;
-		kbuf.top_down = false;
+		kbuf.top_down = true;
 		kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
 		ret = kexec_add_buffer(&kbuf);
 		if (ret)
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
@ 2023-07-26  9:54   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Torsten Duwe <duwe@suse.de>

When initrd is loaded low, the secondary kernel fails like this:

 INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region

This initrd load address corresponds to the _end symbol, but the
reservation is aligned on PMD_SIZE, as explained by a comment in
setup_bootmem().

It is technically possible to align the initrd load address accordingly,
leaving a hole between the end of kernel and the initrd, but it is much
simpler to allocate the initrd top-down.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/kernel/elf_kexec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 38390d3bdcac..c08bb5c3b385 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -281,7 +281,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
 		kbuf.buffer = initrd;
 		kbuf.bufsz = kbuf.memsz = initrd_len;
 		kbuf.buf_align = PAGE_SIZE;
-		kbuf.top_down = false;
+		kbuf.top_down = true;
 		kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
 		ret = kexec_add_buffer(&kbuf);
 		if (ret)
-- 
2.25.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
@ 2023-07-26  9:54   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26  9:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

From: Torsten Duwe <duwe@suse.de>

When initrd is loaded low, the secondary kernel fails like this:

 INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region

This initrd load address corresponds to the _end symbol, but the
reservation is aligned on PMD_SIZE, as explained by a comment in
setup_bootmem().

It is technically possible to align the initrd load address accordingly,
leaving a hole between the end of kernel and the initrd, but it is much
simpler to allocate the initrd top-down.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: stable@vger.kernel.org
---
 arch/riscv/kernel/elf_kexec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 38390d3bdcac..c08bb5c3b385 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -281,7 +281,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
 		kbuf.buffer = initrd;
 		kbuf.bufsz = kbuf.memsz = initrd_len;
 		kbuf.buf_align = PAGE_SIZE;
-		kbuf.top_down = false;
+		kbuf.top_down = true;
 		kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
 		ret = kexec_add_buffer(&kbuf);
 		if (ret)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
  2023-07-26  9:53   ` Petr Tesarik
  (?)
@ 2023-07-26 16:30     ` Conor Dooley
  -1 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:30 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

On Wed, Jul 26, 2023 at 11:53:59AM +0200, Petr Tesarik wrote:
> From: Torsten Duwe <duwe@suse.de>
> 
> R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum
> 18-19 in Table 3. Relocation types here:
> 
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
> 
> It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT"):
> 
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0

Ideally, these would be Link: tags, but that's certainly not worth a
respin. This looks fine to me,
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
@ 2023-07-26 16:30     ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:30 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 683 bytes --]

On Wed, Jul 26, 2023 at 11:53:59AM +0200, Petr Tesarik wrote:
> From: Torsten Duwe <duwe@suse.de>
> 
> R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum
> 18-19 in Table 3. Relocation types here:
> 
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
> 
> It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT"):
> 
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0

Ideally, these would be Link: tags, but that's certainly not worth a
respin. This looks fine to me,
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
@ 2023-07-26 16:30     ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:30 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 683 bytes --]

On Wed, Jul 26, 2023 at 11:53:59AM +0200, Petr Tesarik wrote:
> From: Torsten Duwe <duwe@suse.de>
> 
> R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum
> 18-19 in Table 3. Relocation types here:
> 
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
> 
> It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT"):
> 
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0

Ideally, these would be Link: tags, but that's certainly not worth a
respin. This looks fine to me,
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
  2023-07-26  9:54   ` Petr Tesarik
  (?)
@ 2023-07-26 16:33     ` Conor Dooley
  -1 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:33 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> Linking with this object file makes kexec_file_load(2) fail because of
> multiple unknown relocation types:
> 
> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
> 
> All this hassle is needed for one single call to memcmp() from
> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
> 
> Simply replace this memcmp() call with an explicit loop over those 32 bytes
> and remove the need to link with string.o and all the other object files
> that provide undefined symbols from that object file.
> 
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>

This version keeps the automation happy,
Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-07-26 16:33     ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:33 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 962 bytes --]

On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> Linking with this object file makes kexec_file_load(2) fail because of
> multiple unknown relocation types:
> 
> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
> 
> All this hassle is needed for one single call to memcmp() from
> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
> 
> Simply replace this memcmp() call with an explicit loop over those 32 bytes
> and remove the need to link with string.o and all the other object files
> that provide undefined symbols from that object file.
> 
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>

This version keeps the automation happy,
Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-07-26 16:33     ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:33 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 962 bytes --]

On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> Linking with this object file makes kexec_file_load(2) fail because of
> multiple unknown relocation types:
> 
> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
> 
> All this hassle is needed for one single call to memcmp() from
> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
> 
> Simply replace this memcmp() call with an explicit loop over those 32 bytes
> and remove the need to link with string.o and all the other object files
> that provide undefined symbols from that object file.
> 
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>

This version keeps the automation happy,
Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
  2023-07-26  9:54   ` Petr Tesarik
  (?)
@ 2023-07-26 16:38     ` Conor Dooley
  -1 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:38 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On Wed, Jul 26, 2023 at 11:54:01AM +0200, Petr Tesarik wrote:
> From: Torsten Duwe <duwe@suse.de>
> 
> When initrd is loaded low, the secondary kernel fails like this:
> 
>  INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region
> 
> This initrd load address corresponds to the _end symbol, but the
> reservation is aligned on PMD_SIZE, as explained by a comment in
> setup_bootmem().
> 
> It is technically possible to align the initrd load address accordingly,
> leaving a hole between the end of kernel and the initrd, but it is much
> simpler to allocate the initrd top-down.
> 
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Torsten Duwe <duwe@suse.de>
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
> Cc: stable@vger.kernel.org

Trying to align it might be worthwhile, but the simple fix makes sense
for now & w.r.t backporting.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
@ 2023-07-26 16:38     ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:38 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 985 bytes --]

On Wed, Jul 26, 2023 at 11:54:01AM +0200, Petr Tesarik wrote:
> From: Torsten Duwe <duwe@suse.de>
> 
> When initrd is loaded low, the secondary kernel fails like this:
> 
>  INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region
> 
> This initrd load address corresponds to the _end symbol, but the
> reservation is aligned on PMD_SIZE, as explained by a comment in
> setup_bootmem().
> 
> It is technically possible to align the initrd load address accordingly,
> leaving a hole between the end of kernel and the initrd, but it is much
> simpler to allocate the initrd top-down.
> 
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Torsten Duwe <duwe@suse.de>
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
> Cc: stable@vger.kernel.org

Trying to align it might be worthwhile, but the simple fix makes sense
for now & w.r.t backporting.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
@ 2023-07-26 16:38     ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-07-26 16:38 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 985 bytes --]

On Wed, Jul 26, 2023 at 11:54:01AM +0200, Petr Tesarik wrote:
> From: Torsten Duwe <duwe@suse.de>
> 
> When initrd is loaded low, the secondary kernel fails like this:
> 
>  INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region
> 
> This initrd load address corresponds to the _end symbol, but the
> reservation is aligned on PMD_SIZE, as explained by a comment in
> setup_bootmem().
> 
> It is technically possible to align the initrd load address accordingly,
> leaving a hole between the end of kernel and the initrd, but it is much
> simpler to allocate the initrd top-down.
> 
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Torsten Duwe <duwe@suse.de>
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
> Cc: stable@vger.kernel.org

Trying to align it might be worthwhile, but the simple fix makes sense
for now & w.r.t backporting.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
  2023-07-26 16:38     ` Conor Dooley
  (?)
@ 2023-07-26 18:27       ` Petr Tesarik
  -1 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26 18:27 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr

On 7/26/2023 6:38 PM, Conor Dooley wrote:
> On Wed, Jul 26, 2023 at 11:54:01AM +0200, Petr Tesarik wrote:
>> From: Torsten Duwe <duwe@suse.de>
>>
>> When initrd is loaded low, the secondary kernel fails like this:
>>
>>  INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region
>>
>> This initrd load address corresponds to the _end symbol, but the
>> reservation is aligned on PMD_SIZE, as explained by a comment in
>> setup_bootmem().
>>
>> It is technically possible to align the initrd load address accordingly,
>> leaving a hole between the end of kernel and the initrd, but it is much
>> simpler to allocate the initrd top-down.
>>
>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>> Signed-off-by: Torsten Duwe <duwe@suse.de>
>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>> Cc: stable@vger.kernel.org
> 
> Trying to align it might be worthwhile, but the simple fix makes sense
> for now & w.r.t backporting.

On a second thought, allocating the initrd at the top of the range is
probably even better, because the kernel can unpack to low addresses,
resulting in less fragmented memory. See diagrams.

Top-down initrd:

+----------+          +----------+
|  initrd  |          |          |
+----------+          |   free   |
|          |          |          |
|          |  unpack  +----------+
|   free   |  ----->  | unpacked |
|          |          |  initrd  |
+----------+          +----------+
|  kernel  |          |  kernel  |
+----------+          +----------+


Aligned initrd:

+----------+          +----------+
|          |          |   free   |
|          |          +----------|
|   free   |          | unpacked |
|          |          |  initrd  |
+----------+  unpack  +----------+
|  initrd  |  ----->  |   free   |
+----------+          +----------+
|  kernel  |          |  kernel  |
+----------+          +----------+

Petr T


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
@ 2023-07-26 18:27       ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26 18:27 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr

On 7/26/2023 6:38 PM, Conor Dooley wrote:
> On Wed, Jul 26, 2023 at 11:54:01AM +0200, Petr Tesarik wrote:
>> From: Torsten Duwe <duwe@suse.de>
>>
>> When initrd is loaded low, the secondary kernel fails like this:
>>
>>  INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region
>>
>> This initrd load address corresponds to the _end symbol, but the
>> reservation is aligned on PMD_SIZE, as explained by a comment in
>> setup_bootmem().
>>
>> It is technically possible to align the initrd load address accordingly,
>> leaving a hole between the end of kernel and the initrd, but it is much
>> simpler to allocate the initrd top-down.
>>
>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>> Signed-off-by: Torsten Duwe <duwe@suse.de>
>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>> Cc: stable@vger.kernel.org
> 
> Trying to align it might be worthwhile, but the simple fix makes sense
> for now & w.r.t backporting.

On a second thought, allocating the initrd at the top of the range is
probably even better, because the kernel can unpack to low addresses,
resulting in less fragmented memory. See diagrams.

Top-down initrd:

+----------+          +----------+
|  initrd  |          |          |
+----------+          |   free   |
|          |          |          |
|          |  unpack  +----------+
|   free   |  ----->  | unpacked |
|          |          |  initrd  |
+----------+          +----------+
|  kernel  |          |  kernel  |
+----------+          +----------+


Aligned initrd:

+----------+          +----------+
|          |          |   free   |
|          |          +----------|
|   free   |          | unpacked |
|          |          |  initrd  |
+----------+  unpack  +----------+
|  initrd  |  ----->  |   free   |
+----------+          +----------+
|  kernel  |          |  kernel  |
+----------+          +----------+

Petr T


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 3/3] riscv/kexec: load initrd high in available memory
@ 2023-07-26 18:27       ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-07-26 18:27 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list, Torsten Duwe,
	Roberto Sassu, petr

On 7/26/2023 6:38 PM, Conor Dooley wrote:
> On Wed, Jul 26, 2023 at 11:54:01AM +0200, Petr Tesarik wrote:
>> From: Torsten Duwe <duwe@suse.de>
>>
>> When initrd is loaded low, the secondary kernel fails like this:
>>
>>  INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region
>>
>> This initrd load address corresponds to the _end symbol, but the
>> reservation is aligned on PMD_SIZE, as explained by a comment in
>> setup_bootmem().
>>
>> It is technically possible to align the initrd load address accordingly,
>> leaving a hole between the end of kernel and the initrd, but it is much
>> simpler to allocate the initrd top-down.
>>
>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>> Signed-off-by: Torsten Duwe <duwe@suse.de>
>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>> Cc: stable@vger.kernel.org
> 
> Trying to align it might be worthwhile, but the simple fix makes sense
> for now & w.r.t backporting.

On a second thought, allocating the initrd at the top of the range is
probably even better, because the kernel can unpack to low addresses,
resulting in less fragmented memory. See diagrams.

Top-down initrd:

+----------+          +----------+
|  initrd  |          |          |
+----------+          |   free   |
|          |          |          |
|          |  unpack  +----------+
|   free   |  ----->  | unpacked |
|          |          |  initrd  |
+----------+          +----------+
|  kernel  |          |  kernel  |
+----------+          +----------+


Aligned initrd:

+----------+          +----------+
|          |          |   free   |
|          |          +----------|
|   free   |          | unpacked |
|          |          |  initrd  |
+----------+  unpack  +----------+
|  initrd  |  ----->  |   free   |
+----------+          +----------+
|  kernel  |          |  kernel  |
+----------+          +----------+

Petr T


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
  2023-07-26  9:53 ` Petr Tesarik
  (?)
@ 2023-08-01  9:27   ` Petr Tesarik
  -1 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-08-01  9:27 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

Hi,

On 7/26/2023 11:53 AM, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> This patch series handles an additional relocation types, removes the need
> to implement a Global Offset Table (GOT) for the purgatory and fixes the
> placement of initrd.

It seems there are no objections, but what is the plan here? Take it
into 6.5 as a fix, or let it go through for-next?

Petr T

> Changelog
> =========
> 
> Changes from v1:
> - Replace memcmp() with a for loop.
> - Drop handling of 16-bit add/subtract relocations. They were used only
>   by alternatives in strcmp(), which was referenced only by string.o.
> - Add the initrd placement fix.
> 
> Petr Tesarik (1):
>   riscv/purgatory: do not link with string.o and its dependencies
> 
> Torsten Duwe (2):
>   riscv/kexec: handle R_RISCV_CALL_PLT relocation type
>   riscv/kexec: load initrd high in available memory
> 
>  arch/riscv/kernel/elf_kexec.c    |  3 ++-
>  arch/riscv/purgatory/Makefile    | 26 +-------------------------
>  arch/riscv/purgatory/purgatory.c |  6 ++++--
>  3 files changed, 7 insertions(+), 28 deletions(-)
> 


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-08-01  9:27   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-08-01  9:27 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

Hi,

On 7/26/2023 11:53 AM, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> This patch series handles an additional relocation types, removes the need
> to implement a Global Offset Table (GOT) for the purgatory and fixes the
> placement of initrd.

It seems there are no objections, but what is the plan here? Take it
into 6.5 as a fix, or let it go through for-next?

Petr T

> Changelog
> =========
> 
> Changes from v1:
> - Replace memcmp() with a for loop.
> - Drop handling of 16-bit add/subtract relocations. They were used only
>   by alternatives in strcmp(), which was referenced only by string.o.
> - Add the initrd placement fix.
> 
> Petr Tesarik (1):
>   riscv/purgatory: do not link with string.o and its dependencies
> 
> Torsten Duwe (2):
>   riscv/kexec: handle R_RISCV_CALL_PLT relocation type
>   riscv/kexec: load initrd high in available memory
> 
>  arch/riscv/kernel/elf_kexec.c    |  3 ++-
>  arch/riscv/purgatory/Makefile    | 26 +-------------------------
>  arch/riscv/purgatory/purgatory.c |  6 ++++--
>  3 files changed, 7 insertions(+), 28 deletions(-)
> 


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-08-01  9:27   ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-08-01  9:27 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	open list:RISC-V ARCHITECTURE, kexec, open list
  Cc: Torsten Duwe, Roberto Sassu, petr

Hi,

On 7/26/2023 11:53 AM, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> This patch series handles an additional relocation types, removes the need
> to implement a Global Offset Table (GOT) for the purgatory and fixes the
> placement of initrd.

It seems there are no objections, but what is the plan here? Take it
into 6.5 as a fix, or let it go through for-next?

Petr T

> Changelog
> =========
> 
> Changes from v1:
> - Replace memcmp() with a for loop.
> - Drop handling of 16-bit add/subtract relocations. They were used only
>   by alternatives in strcmp(), which was referenced only by string.o.
> - Add the initrd placement fix.
> 
> Petr Tesarik (1):
>   riscv/purgatory: do not link with string.o and its dependencies
> 
> Torsten Duwe (2):
>   riscv/kexec: handle R_RISCV_CALL_PLT relocation type
>   riscv/kexec: load initrd high in available memory
> 
>  arch/riscv/kernel/elf_kexec.c    |  3 ++-
>  arch/riscv/purgatory/Makefile    | 26 +-------------------------
>  arch/riscv/purgatory/purgatory.c |  6 ++++--
>  3 files changed, 7 insertions(+), 28 deletions(-)
> 


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
  2023-07-26  9:53 ` Petr Tesarik
  (?)
@ 2023-08-03 15:10   ` patchwork-bot+linux-riscv
  -1 siblings, 0 replies; 42+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-08-03 15:10 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: linux-riscv, paul.walmsley, palmer, aou, conor.dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, kexec, linux-kernel, duwe, roberto.sassu, petr

Hello:

This series was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 26 Jul 2023 11:53:58 +0200 you wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Here is the summary with links:
  - [v2,1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
    https://git.kernel.org/riscv/c/1be0b05b3a80
  - [v2,2/3] riscv/purgatory: do not link with string.o and its dependencies
    (no matching commit)
  - [v2,3/3] riscv/kexec: load initrd high in available memory
    https://git.kernel.org/riscv/c/0ccd2e803745

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-08-03 15:10   ` patchwork-bot+linux-riscv
  0 siblings, 0 replies; 42+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-08-03 15:10 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: linux-riscv, paul.walmsley, palmer, aou, conor.dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, kexec, linux-kernel, duwe, roberto.sassu, petr

Hello:

This series was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 26 Jul 2023 11:53:58 +0200 you wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Here is the summary with links:
  - [v2,1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
    https://git.kernel.org/riscv/c/1be0b05b3a80
  - [v2,2/3] riscv/purgatory: do not link with string.o and its dependencies
    (no matching commit)
  - [v2,3/3] riscv/kexec: load initrd high in available memory
    https://git.kernel.org/riscv/c/0ccd2e803745

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-08-03 15:10   ` patchwork-bot+linux-riscv
  0 siblings, 0 replies; 42+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-08-03 15:10 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: linux-riscv, paul.walmsley, palmer, aou, conor.dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, kexec, linux-kernel, duwe, roberto.sassu, petr

Hello:

This series was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 26 Jul 2023 11:53:58 +0200 you wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Here is the summary with links:
  - [v2,1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
    https://git.kernel.org/riscv/c/1be0b05b3a80
  - [v2,2/3] riscv/purgatory: do not link with string.o and its dependencies
    (no matching commit)
  - [v2,3/3] riscv/kexec: load initrd high in available memory
    https://git.kernel.org/riscv/c/0ccd2e803745

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
  2023-07-26 16:33     ` Conor Dooley
  (?)
@ 2023-08-03 15:13       ` Palmer Dabbelt
  -1 siblings, 0 replies; 42+ messages in thread
From: Palmer Dabbelt @ 2023-08-03 15:13 UTC (permalink / raw)
  To: Conor Dooley
  Cc: petrtesarik, Paul Walmsley, aou, Conor Dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, linux-riscv, kexec, linux-kernel, duwe,
	roberto.sassu, petr

On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
> On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
>> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>> 
>> Linking with this object file makes kexec_file_load(2) fail because of
>> multiple unknown relocation types:
>> 
>> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
>> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>> 
>> All this hassle is needed for one single call to memcmp() from
>> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>> 
>> Simply replace this memcmp() call with an explicit loop over those 32 bytes
>> and remove the need to link with string.o and all the other object files
>> that provide undefined symbols from that object file.
>> 
>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>
> This version keeps the automation happy,
> Acked-by: Conor Dooley <conor.dooley@microchip.com>

Oddly enough, this breaks my builds.  I tried fixing the first one with
something like

    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
    From: Palmer Dabbelt <palmer@rivosinc.com>
    Date: Wed, 2 Aug 2023 20:22:33 -0700
    Subject: [PATCH] RISC-V: Include io from timex
    
    Without this I get some implicit declarations.
    
      CC      arch/riscv/kernel/asm-offsets.s
    In file included from linux/include/linux/timex.h:67,
                     from linux/include/linux/time32.h:13,
                     from linux/include/linux/time.h:60,
                     from linux/include/linux/ktime.h:24,
                     from linux/include/linux/timer.h:6,
                     from linux/include/linux/workqueue.h:9,
                     from linux/include/linux/mm_types.h:19,
                     from linux/include/linux/mmzone.h:22,
                     from linux/include/linux/gfp.h:7,
                     from linux/include/linux/mm.h:7,
                     from linux/arch/riscv/kernel/asm-offsets.c:10:
    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit declaration of function 'readl_relaxed' [-Werror=implicit-function-declaration]
       25 |         return readl_relaxed(((u32 *)clint_time_val));
          |
    
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    ---
     arch/riscv/include/asm/timex.h | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h
    index a06697846e69..1a4d181193e0 100644
    --- a/arch/riscv/include/asm/timex.h
    +++ b/arch/riscv/include/asm/timex.h
    @@ -7,6 +7,7 @@
     #define _ASM_RISCV_TIMEX_H
     
     #include <asm/csr.h>
    +#include <asm/io.h>
     
     typedef unsigned long cycles_t;
 
    -- 
    2.41.0

The other two look fine and are somewhat independent, so I've picked those up
for fixes.

Thanks!

>
> Thanks,
> Conor.

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-08-03 15:13       ` Palmer Dabbelt
  0 siblings, 0 replies; 42+ messages in thread
From: Palmer Dabbelt @ 2023-08-03 15:13 UTC (permalink / raw)
  To: Conor Dooley
  Cc: petrtesarik, Paul Walmsley, aou, Conor Dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, linux-riscv, kexec, linux-kernel, duwe,
	roberto.sassu, petr

On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
> On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
>> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>> 
>> Linking with this object file makes kexec_file_load(2) fail because of
>> multiple unknown relocation types:
>> 
>> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
>> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>> 
>> All this hassle is needed for one single call to memcmp() from
>> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>> 
>> Simply replace this memcmp() call with an explicit loop over those 32 bytes
>> and remove the need to link with string.o and all the other object files
>> that provide undefined symbols from that object file.
>> 
>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>
> This version keeps the automation happy,
> Acked-by: Conor Dooley <conor.dooley@microchip.com>

Oddly enough, this breaks my builds.  I tried fixing the first one with
something like

    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
    From: Palmer Dabbelt <palmer@rivosinc.com>
    Date: Wed, 2 Aug 2023 20:22:33 -0700
    Subject: [PATCH] RISC-V: Include io from timex
    
    Without this I get some implicit declarations.
    
      CC      arch/riscv/kernel/asm-offsets.s
    In file included from linux/include/linux/timex.h:67,
                     from linux/include/linux/time32.h:13,
                     from linux/include/linux/time.h:60,
                     from linux/include/linux/ktime.h:24,
                     from linux/include/linux/timer.h:6,
                     from linux/include/linux/workqueue.h:9,
                     from linux/include/linux/mm_types.h:19,
                     from linux/include/linux/mmzone.h:22,
                     from linux/include/linux/gfp.h:7,
                     from linux/include/linux/mm.h:7,
                     from linux/arch/riscv/kernel/asm-offsets.c:10:
    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit declaration of function 'readl_relaxed' [-Werror=implicit-function-declaration]
       25 |         return readl_relaxed(((u32 *)clint_time_val));
          |
    
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    ---
     arch/riscv/include/asm/timex.h | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h
    index a06697846e69..1a4d181193e0 100644
    --- a/arch/riscv/include/asm/timex.h
    +++ b/arch/riscv/include/asm/timex.h
    @@ -7,6 +7,7 @@
     #define _ASM_RISCV_TIMEX_H
     
     #include <asm/csr.h>
    +#include <asm/io.h>
     
     typedef unsigned long cycles_t;
 
    -- 
    2.41.0

The other two look fine and are somewhat independent, so I've picked those up
for fixes.

Thanks!

>
> Thanks,
> Conor.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-08-03 15:13       ` Palmer Dabbelt
  0 siblings, 0 replies; 42+ messages in thread
From: Palmer Dabbelt @ 2023-08-03 15:13 UTC (permalink / raw)
  To: Conor Dooley
  Cc: petrtesarik, Paul Walmsley, aou, Conor Dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, linux-riscv, kexec, linux-kernel, duwe,
	roberto.sassu, petr

On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
> On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
>> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>> 
>> Linking with this object file makes kexec_file_load(2) fail because of
>> multiple unknown relocation types:
>> 
>> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
>> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>> 
>> All this hassle is needed for one single call to memcmp() from
>> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>> 
>> Simply replace this memcmp() call with an explicit loop over those 32 bytes
>> and remove the need to link with string.o and all the other object files
>> that provide undefined symbols from that object file.
>> 
>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>
> This version keeps the automation happy,
> Acked-by: Conor Dooley <conor.dooley@microchip.com>

Oddly enough, this breaks my builds.  I tried fixing the first one with
something like

    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
    From: Palmer Dabbelt <palmer@rivosinc.com>
    Date: Wed, 2 Aug 2023 20:22:33 -0700
    Subject: [PATCH] RISC-V: Include io from timex
    
    Without this I get some implicit declarations.
    
      CC      arch/riscv/kernel/asm-offsets.s
    In file included from linux/include/linux/timex.h:67,
                     from linux/include/linux/time32.h:13,
                     from linux/include/linux/time.h:60,
                     from linux/include/linux/ktime.h:24,
                     from linux/include/linux/timer.h:6,
                     from linux/include/linux/workqueue.h:9,
                     from linux/include/linux/mm_types.h:19,
                     from linux/include/linux/mmzone.h:22,
                     from linux/include/linux/gfp.h:7,
                     from linux/include/linux/mm.h:7,
                     from linux/arch/riscv/kernel/asm-offsets.c:10:
    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit declaration of function 'readl_relaxed' [-Werror=implicit-function-declaration]
       25 |         return readl_relaxed(((u32 *)clint_time_val));
          |
    
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    ---
     arch/riscv/include/asm/timex.h | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h
    index a06697846e69..1a4d181193e0 100644
    --- a/arch/riscv/include/asm/timex.h
    +++ b/arch/riscv/include/asm/timex.h
    @@ -7,6 +7,7 @@
     #define _ASM_RISCV_TIMEX_H
     
     #include <asm/csr.h>
    +#include <asm/io.h>
     
     typedef unsigned long cycles_t;
 
    -- 
    2.41.0

The other two look fine and are somewhat independent, so I've picked those up
for fixes.

Thanks!

>
> Thanks,
> Conor.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
  2023-08-03 15:13       ` Palmer Dabbelt
  (?)
@ 2023-08-03 15:17         ` Conor Dooley
  -1 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-08-03 15:17 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: petrtesarik, Paul Walmsley, aou, Conor Dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, linux-riscv, kexec, linux-kernel, duwe,
	roberto.sassu, petr

[-- Attachment #1: Type: text/plain, Size: 3333 bytes --]

On Thu, Aug 03, 2023 at 08:13:48AM -0700, Palmer Dabbelt wrote:
> On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
> > On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
> > > From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> > > 
> > > Linking with this object file makes kexec_file_load(2) fail because of
> > > multiple unknown relocation types:
> > > 
> > > - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
> > > - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
> > > 
> > > All this hassle is needed for one single call to memcmp() from
> > > verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
> > > 
> > > Simply replace this memcmp() call with an explicit loop over those 32 bytes
> > > and remove the need to link with string.o and all the other object files
> > > that provide undefined symbols from that object file.
> > > 
> > > Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> > > Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
> > 
> > This version keeps the automation happy,
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Oddly enough, this breaks my builds.  I tried fixing the first one with
> something like

You say "tried", does that mean it also didn't work?
What's the config?

Cheers,
Conor.

> 
>    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
>    From: Palmer Dabbelt <palmer@rivosinc.com>
>    Date: Wed, 2 Aug 2023 20:22:33 -0700
>    Subject: [PATCH] RISC-V: Include io from timex
>    Without this I get some implicit declarations.
>      CC      arch/riscv/kernel/asm-offsets.s
>    In file included from linux/include/linux/timex.h:67,
>                     from linux/include/linux/time32.h:13,
>                     from linux/include/linux/time.h:60,
>                     from linux/include/linux/ktime.h:24,
>                     from linux/include/linux/timer.h:6,
>                     from linux/include/linux/workqueue.h:9,
>                     from linux/include/linux/mm_types.h:19,
>                     from linux/include/linux/mmzone.h:22,
>                     from linux/include/linux/gfp.h:7,
>                     from linux/include/linux/mm.h:7,
>                     from linux/arch/riscv/kernel/asm-offsets.c:10:
>    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
>    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit declaration of function 'readl_relaxed' [-Werror=implicit-function-declaration]
>       25 |         return readl_relaxed(((u32 *)clint_time_val));
>          |
>    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>    ---
>     arch/riscv/include/asm/timex.h | 1 +
>     1 file changed, 1 insertion(+)
>    diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h
>    index a06697846e69..1a4d181193e0 100644
>    --- a/arch/riscv/include/asm/timex.h
>    +++ b/arch/riscv/include/asm/timex.h
>    @@ -7,6 +7,7 @@
>     #define _ASM_RISCV_TIMEX_H
>     #include <asm/csr.h>
>    +#include <asm/io.h>
>     typedef unsigned long cycles_t;
> 
>    --    2.41.0
> 
> The other two look fine and are somewhat independent, so I've picked those up
> for fixes.
> 
> Thanks!
> 
> > 
> > Thanks,
> > Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-08-03 15:17         ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-08-03 15:17 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: petrtesarik, Paul Walmsley, aou, Conor Dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, linux-riscv, kexec, linux-kernel, duwe,
	roberto.sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 3333 bytes --]

On Thu, Aug 03, 2023 at 08:13:48AM -0700, Palmer Dabbelt wrote:
> On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
> > On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
> > > From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> > > 
> > > Linking with this object file makes kexec_file_load(2) fail because of
> > > multiple unknown relocation types:
> > > 
> > > - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
> > > - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
> > > 
> > > All this hassle is needed for one single call to memcmp() from
> > > verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
> > > 
> > > Simply replace this memcmp() call with an explicit loop over those 32 bytes
> > > and remove the need to link with string.o and all the other object files
> > > that provide undefined symbols from that object file.
> > > 
> > > Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> > > Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
> > 
> > This version keeps the automation happy,
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Oddly enough, this breaks my builds.  I tried fixing the first one with
> something like

You say "tried", does that mean it also didn't work?
What's the config?

Cheers,
Conor.

> 
>    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
>    From: Palmer Dabbelt <palmer@rivosinc.com>
>    Date: Wed, 2 Aug 2023 20:22:33 -0700
>    Subject: [PATCH] RISC-V: Include io from timex
>    Without this I get some implicit declarations.
>      CC      arch/riscv/kernel/asm-offsets.s
>    In file included from linux/include/linux/timex.h:67,
>                     from linux/include/linux/time32.h:13,
>                     from linux/include/linux/time.h:60,
>                     from linux/include/linux/ktime.h:24,
>                     from linux/include/linux/timer.h:6,
>                     from linux/include/linux/workqueue.h:9,
>                     from linux/include/linux/mm_types.h:19,
>                     from linux/include/linux/mmzone.h:22,
>                     from linux/include/linux/gfp.h:7,
>                     from linux/include/linux/mm.h:7,
>                     from linux/arch/riscv/kernel/asm-offsets.c:10:
>    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
>    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit declaration of function 'readl_relaxed' [-Werror=implicit-function-declaration]
>       25 |         return readl_relaxed(((u32 *)clint_time_val));
>          |
>    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>    ---
>     arch/riscv/include/asm/timex.h | 1 +
>     1 file changed, 1 insertion(+)
>    diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h
>    index a06697846e69..1a4d181193e0 100644
>    --- a/arch/riscv/include/asm/timex.h
>    +++ b/arch/riscv/include/asm/timex.h
>    @@ -7,6 +7,7 @@
>     #define _ASM_RISCV_TIMEX_H
>     #include <asm/csr.h>
>    +#include <asm/io.h>
>     typedef unsigned long cycles_t;
> 
>    --    2.41.0
> 
> The other two look fine and are somewhat independent, so I've picked those up
> for fixes.
> 
> Thanks!
> 
> > 
> > Thanks,
> > Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-08-03 15:17         ` Conor Dooley
  0 siblings, 0 replies; 42+ messages in thread
From: Conor Dooley @ 2023-08-03 15:17 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: petrtesarik, Paul Walmsley, aou, Conor Dooley, lihuafei1,
	liaochang1, masahiroy, keescook, akpm, heiko, ribalda, hi,
	lizhengyu3, linux-riscv, kexec, linux-kernel, duwe,
	roberto.sassu, petr


[-- Attachment #1.1: Type: text/plain, Size: 3333 bytes --]

On Thu, Aug 03, 2023 at 08:13:48AM -0700, Palmer Dabbelt wrote:
> On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
> > On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
> > > From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> > > 
> > > Linking with this object file makes kexec_file_load(2) fail because of
> > > multiple unknown relocation types:
> > > 
> > > - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
> > > - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
> > > 
> > > All this hassle is needed for one single call to memcmp() from
> > > verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
> > > 
> > > Simply replace this memcmp() call with an explicit loop over those 32 bytes
> > > and remove the need to link with string.o and all the other object files
> > > that provide undefined symbols from that object file.
> > > 
> > > Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> > > Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
> > 
> > This version keeps the automation happy,
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Oddly enough, this breaks my builds.  I tried fixing the first one with
> something like

You say "tried", does that mean it also didn't work?
What's the config?

Cheers,
Conor.

> 
>    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
>    From: Palmer Dabbelt <palmer@rivosinc.com>
>    Date: Wed, 2 Aug 2023 20:22:33 -0700
>    Subject: [PATCH] RISC-V: Include io from timex
>    Without this I get some implicit declarations.
>      CC      arch/riscv/kernel/asm-offsets.s
>    In file included from linux/include/linux/timex.h:67,
>                     from linux/include/linux/time32.h:13,
>                     from linux/include/linux/time.h:60,
>                     from linux/include/linux/ktime.h:24,
>                     from linux/include/linux/timer.h:6,
>                     from linux/include/linux/workqueue.h:9,
>                     from linux/include/linux/mm_types.h:19,
>                     from linux/include/linux/mmzone.h:22,
>                     from linux/include/linux/gfp.h:7,
>                     from linux/include/linux/mm.h:7,
>                     from linux/arch/riscv/kernel/asm-offsets.c:10:
>    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
>    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit declaration of function 'readl_relaxed' [-Werror=implicit-function-declaration]
>       25 |         return readl_relaxed(((u32 *)clint_time_val));
>          |
>    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>    ---
>     arch/riscv/include/asm/timex.h | 1 +
>     1 file changed, 1 insertion(+)
>    diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h
>    index a06697846e69..1a4d181193e0 100644
>    --- a/arch/riscv/include/asm/timex.h
>    +++ b/arch/riscv/include/asm/timex.h
>    @@ -7,6 +7,7 @@
>     #define _ASM_RISCV_TIMEX_H
>     #include <asm/csr.h>
>    +#include <asm/io.h>
>     typedef unsigned long cycles_t;
> 
>    --    2.41.0
> 
> The other two look fine and are somewhat independent, so I've picked those up
> for fixes.
> 
> Thanks!
> 
> > 
> > Thanks,
> > Conor.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
  2023-08-03 15:13       ` Palmer Dabbelt
  (?)
@ 2023-08-03 15:33         ` Petr Tesarik
  -1 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-08-03 15:33 UTC (permalink / raw)
  To: Palmer Dabbelt, Conor Dooley
  Cc: Paul Walmsley, aou, Conor Dooley, lihuafei1, liaochang1,
	masahiroy, keescook, akpm, heiko, ribalda, hi, lizhengyu3,
	linux-riscv, kexec, linux-kernel, duwe, roberto.sassu, petr

On 8/3/2023 5:13 PM, Palmer Dabbelt wrote:
> On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
>> On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
>>> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>>>
>>> Linking with this object file makes kexec_file_load(2) fail because of
>>> multiple unknown relocation types:
>>>
>>> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
>>> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>>>
>>> All this hassle is needed for one single call to memcmp() from
>>> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>>>
>>> Simply replace this memcmp() call with an explicit loop over those 32
>>> bytes
>>> and remove the need to link with string.o and all the other object files
>>> that provide undefined symbols from that object file.
>>>
>>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>>
>> This version keeps the automation happy,
>> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Oddly enough, this breaks my builds.  I tried fixing the first one with
> something like

FTR I have no idea how a patch to the purgatory code and its Makefile
can have any effect on the compilation of asm-offsets.s in another
directory.

Petr T

>    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
>    From: Palmer Dabbelt <palmer@rivosinc.com>
>    Date: Wed, 2 Aug 2023 20:22:33 -0700
>    Subject: [PATCH] RISC-V: Include io from timex
>       Without this I get some implicit declarations.
>         CC      arch/riscv/kernel/asm-offsets.s
>    In file included from linux/include/linux/timex.h:67,
>                     from linux/include/linux/time32.h:13,
>                     from linux/include/linux/time.h:60,
>                     from linux/include/linux/ktime.h:24,
>                     from linux/include/linux/timer.h:6,
>                     from linux/include/linux/workqueue.h:9,
>                     from linux/include/linux/mm_types.h:19,
>                     from linux/include/linux/mmzone.h:22,
>                     from linux/include/linux/gfp.h:7,
>                     from linux/include/linux/mm.h:7,
>                     from linux/arch/riscv/kernel/asm-offsets.c:10:
>    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
>    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit
> declaration of function 'readl_relaxed'
> [-Werror=implicit-function-declaration]
>       25 |         return readl_relaxed(((u32 *)clint_time_val));
>          |
>       Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>    ---
>     arch/riscv/include/asm/timex.h | 1 +
>     1 file changed, 1 insertion(+)
>       diff --git a/arch/riscv/include/asm/timex.h
> b/arch/riscv/include/asm/timex.h
>    index a06697846e69..1a4d181193e0 100644
>    --- a/arch/riscv/include/asm/timex.h
>    +++ b/arch/riscv/include/asm/timex.h
>    @@ -7,6 +7,7 @@
>     #define _ASM_RISCV_TIMEX_H
>         #include <asm/csr.h>
>    +#include <asm/io.h>
>         typedef unsigned long cycles_t;
> 
>    --    2.41.0
> 
> The other two look fine and are somewhat independent, so I've picked
> those up
> for fixes.
> 
> Thanks!
> 
>>
>> Thanks,
>> Conor.


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-08-03 15:33         ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-08-03 15:33 UTC (permalink / raw)
  To: Palmer Dabbelt, Conor Dooley
  Cc: Paul Walmsley, aou, Conor Dooley, lihuafei1, liaochang1,
	masahiroy, keescook, akpm, heiko, ribalda, hi, lizhengyu3,
	linux-riscv, kexec, linux-kernel, duwe, roberto.sassu, petr

On 8/3/2023 5:13 PM, Palmer Dabbelt wrote:
> On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
>> On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
>>> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>>>
>>> Linking with this object file makes kexec_file_load(2) fail because of
>>> multiple unknown relocation types:
>>>
>>> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
>>> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>>>
>>> All this hassle is needed for one single call to memcmp() from
>>> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>>>
>>> Simply replace this memcmp() call with an explicit loop over those 32
>>> bytes
>>> and remove the need to link with string.o and all the other object files
>>> that provide undefined symbols from that object file.
>>>
>>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>>
>> This version keeps the automation happy,
>> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Oddly enough, this breaks my builds.  I tried fixing the first one with
> something like

FTR I have no idea how a patch to the purgatory code and its Makefile
can have any effect on the compilation of asm-offsets.s in another
directory.

Petr T

>    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
>    From: Palmer Dabbelt <palmer@rivosinc.com>
>    Date: Wed, 2 Aug 2023 20:22:33 -0700
>    Subject: [PATCH] RISC-V: Include io from timex
>       Without this I get some implicit declarations.
>         CC      arch/riscv/kernel/asm-offsets.s
>    In file included from linux/include/linux/timex.h:67,
>                     from linux/include/linux/time32.h:13,
>                     from linux/include/linux/time.h:60,
>                     from linux/include/linux/ktime.h:24,
>                     from linux/include/linux/timer.h:6,
>                     from linux/include/linux/workqueue.h:9,
>                     from linux/include/linux/mm_types.h:19,
>                     from linux/include/linux/mmzone.h:22,
>                     from linux/include/linux/gfp.h:7,
>                     from linux/include/linux/mm.h:7,
>                     from linux/arch/riscv/kernel/asm-offsets.c:10:
>    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
>    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit
> declaration of function 'readl_relaxed'
> [-Werror=implicit-function-declaration]
>       25 |         return readl_relaxed(((u32 *)clint_time_val));
>          |
>       Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>    ---
>     arch/riscv/include/asm/timex.h | 1 +
>     1 file changed, 1 insertion(+)
>       diff --git a/arch/riscv/include/asm/timex.h
> b/arch/riscv/include/asm/timex.h
>    index a06697846e69..1a4d181193e0 100644
>    --- a/arch/riscv/include/asm/timex.h
>    +++ b/arch/riscv/include/asm/timex.h
>    @@ -7,6 +7,7 @@
>     #define _ASM_RISCV_TIMEX_H
>         #include <asm/csr.h>
>    +#include <asm/io.h>
>         typedef unsigned long cycles_t;
> 
>    --    2.41.0
> 
> The other two look fine and are somewhat independent, so I've picked
> those up
> for fixes.
> 
> Thanks!
> 
>>
>> Thanks,
>> Conor.


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies
@ 2023-08-03 15:33         ` Petr Tesarik
  0 siblings, 0 replies; 42+ messages in thread
From: Petr Tesarik @ 2023-08-03 15:33 UTC (permalink / raw)
  To: Palmer Dabbelt, Conor Dooley
  Cc: Paul Walmsley, aou, Conor Dooley, lihuafei1, liaochang1,
	masahiroy, keescook, akpm, heiko, ribalda, hi, lizhengyu3,
	linux-riscv, kexec, linux-kernel, duwe, roberto.sassu, petr

On 8/3/2023 5:13 PM, Palmer Dabbelt wrote:
> On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
>> On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
>>> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>>>
>>> Linking with this object file makes kexec_file_load(2) fail because of
>>> multiple unknown relocation types:
>>>
>>> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
>>> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>>>
>>> All this hassle is needed for one single call to memcmp() from
>>> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>>>
>>> Simply replace this memcmp() call with an explicit loop over those 32
>>> bytes
>>> and remove the need to link with string.o and all the other object files
>>> that provide undefined symbols from that object file.
>>>
>>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
>>
>> This version keeps the automation happy,
>> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Oddly enough, this breaks my builds.  I tried fixing the first one with
> something like

FTR I have no idea how a patch to the purgatory code and its Makefile
can have any effect on the compilation of asm-offsets.s in another
directory.

Petr T

>    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
>    From: Palmer Dabbelt <palmer@rivosinc.com>
>    Date: Wed, 2 Aug 2023 20:22:33 -0700
>    Subject: [PATCH] RISC-V: Include io from timex
>       Without this I get some implicit declarations.
>         CC      arch/riscv/kernel/asm-offsets.s
>    In file included from linux/include/linux/timex.h:67,
>                     from linux/include/linux/time32.h:13,
>                     from linux/include/linux/time.h:60,
>                     from linux/include/linux/ktime.h:24,
>                     from linux/include/linux/timer.h:6,
>                     from linux/include/linux/workqueue.h:9,
>                     from linux/include/linux/mm_types.h:19,
>                     from linux/include/linux/mmzone.h:22,
>                     from linux/include/linux/gfp.h:7,
>                     from linux/include/linux/mm.h:7,
>                     from linux/arch/riscv/kernel/asm-offsets.c:10:
>    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
>    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit
> declaration of function 'readl_relaxed'
> [-Werror=implicit-function-declaration]
>       25 |         return readl_relaxed(((u32 *)clint_time_val));
>          |
>       Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>    ---
>     arch/riscv/include/asm/timex.h | 1 +
>     1 file changed, 1 insertion(+)
>       diff --git a/arch/riscv/include/asm/timex.h
> b/arch/riscv/include/asm/timex.h
>    index a06697846e69..1a4d181193e0 100644
>    --- a/arch/riscv/include/asm/timex.h
>    +++ b/arch/riscv/include/asm/timex.h
>    @@ -7,6 +7,7 @@
>     #define _ASM_RISCV_TIMEX_H
>         #include <asm/csr.h>
>    +#include <asm/io.h>
>         typedef unsigned long cycles_t;
> 
>    --    2.41.0
> 
> The other two look fine and are somewhat independent, so I've picked
> those up
> for fixes.
> 
> Thanks!
> 
>>
>> Thanks,
>> Conor.


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: (subset) [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
  2023-07-26  9:53 ` Petr Tesarik
  (?)
@ 2023-08-09 14:35   ` Palmer Dabbelt
  -1 siblings, 0 replies; 42+ messages in thread
From: Palmer Dabbelt @ 2023-08-09 14:35 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	linux-riscv, kexec, linux-kernel, Petr Tesarik
  Cc: Torsten Duwe, Roberto Sassu, petr


On Wed, 26 Jul 2023 11:53:58 +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Applied, thanks!

[1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
      https://git.kernel.org/palmer/c/d0b4f95a5103
[3/3] riscv/kexec: load initrd high in available memory
      https://git.kernel.org/palmer/c/49af7a2cd5f6

Best regards,
-- 
Palmer Dabbelt <palmer@rivosinc.com>


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: (subset) [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-08-09 14:35   ` Palmer Dabbelt
  0 siblings, 0 replies; 42+ messages in thread
From: Palmer Dabbelt @ 2023-08-09 14:35 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	linux-riscv, kexec, linux-kernel, Petr Tesarik
  Cc: Torsten Duwe, Roberto Sassu, petr


On Wed, 26 Jul 2023 11:53:58 +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Applied, thanks!

[1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
      https://git.kernel.org/palmer/c/d0b4f95a5103
[3/3] riscv/kexec: load initrd high in available memory
      https://git.kernel.org/palmer/c/49af7a2cd5f6

Best regards,
-- 
Palmer Dabbelt <palmer@rivosinc.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: (subset) [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
@ 2023-08-09 14:35   ` Palmer Dabbelt
  0 siblings, 0 replies; 42+ messages in thread
From: Palmer Dabbelt @ 2023-08-09 14:35 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Conor Dooley,
	Li Huafei, Liao Chang, Masahiro Yamada, Kees Cook, Andrew Morton,
	Heiko Stuebner, Ricardo Ribalda, Alyssa Ross, Li Zhengyu,
	linux-riscv, kexec, linux-kernel, Petr Tesarik
  Cc: Torsten Duwe, Roberto Sassu, petr


On Wed, 26 Jul 2023 11:53:58 +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Applied, thanks!

[1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
      https://git.kernel.org/palmer/c/d0b4f95a5103
[3/3] riscv/kexec: load initrd high in available memory
      https://git.kernel.org/palmer/c/49af7a2cd5f6

Best regards,
-- 
Palmer Dabbelt <palmer@rivosinc.com>


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2023-08-09 14:36 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26  9:53 [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures Petr Tesarik
2023-07-26  9:53 ` Petr Tesarik
2023-07-26  9:53 ` Petr Tesarik
2023-07-26  9:53 ` [PATCH v2 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type Petr Tesarik
2023-07-26  9:53   ` Petr Tesarik
2023-07-26  9:53   ` Petr Tesarik
2023-07-26 16:30   ` Conor Dooley
2023-07-26 16:30     ` Conor Dooley
2023-07-26 16:30     ` Conor Dooley
2023-07-26  9:54 ` [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies Petr Tesarik
2023-07-26  9:54   ` Petr Tesarik
2023-07-26  9:54   ` Petr Tesarik
2023-07-26 16:33   ` Conor Dooley
2023-07-26 16:33     ` Conor Dooley
2023-07-26 16:33     ` Conor Dooley
2023-08-03 15:13     ` Palmer Dabbelt
2023-08-03 15:13       ` Palmer Dabbelt
2023-08-03 15:13       ` Palmer Dabbelt
2023-08-03 15:17       ` Conor Dooley
2023-08-03 15:17         ` Conor Dooley
2023-08-03 15:17         ` Conor Dooley
2023-08-03 15:33       ` Petr Tesarik
2023-08-03 15:33         ` Petr Tesarik
2023-08-03 15:33         ` Petr Tesarik
2023-07-26  9:54 ` [PATCH v2 3/3] riscv/kexec: load initrd high in available memory Petr Tesarik
2023-07-26  9:54   ` Petr Tesarik
2023-07-26  9:54   ` Petr Tesarik
2023-07-26 16:38   ` Conor Dooley
2023-07-26 16:38     ` Conor Dooley
2023-07-26 16:38     ` Conor Dooley
2023-07-26 18:27     ` Petr Tesarik
2023-07-26 18:27       ` Petr Tesarik
2023-07-26 18:27       ` Petr Tesarik
2023-08-01  9:27 ` [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures Petr Tesarik
2023-08-01  9:27   ` Petr Tesarik
2023-08-01  9:27   ` Petr Tesarik
2023-08-03 15:10 ` patchwork-bot+linux-riscv
2023-08-03 15:10   ` patchwork-bot+linux-riscv
2023-08-03 15:10   ` patchwork-bot+linux-riscv
2023-08-09 14:35 ` (subset) " Palmer Dabbelt
2023-08-09 14:35   ` Palmer Dabbelt
2023-08-09 14:35   ` Palmer Dabbelt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.