Skip to content

Commit fbd5648

Browse files
ifranzkijschmidb
authored andcommitted
Fix s390_kimd/kmld_shake inline assemblies
The KIMD and LKMD instructions update the source register pair during processing. Declare the source registers as output registers and also add the '+' constraint to them. This fixes a segfault in the shake functions when libica is compiled with clang on Ubuntu 22.04 Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
1 parent 4e976cf commit fbd5648

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/include/s390_crypto.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,11 @@ static inline int s390_kimd_shake(unsigned long func, void *param,
524524
int ret = -1;
525525

526526
__asm__ volatile(
527-
"0: .insn rre,0xb93e0000,%1,%5\n\t" /* KIMD opcode */
527+
"0: .insn rre,0xb93e0000,%3,%1\n\t" /* KIMD opcode */
528528
" brc 1,0b\n\t" /* handle partial completion */
529529
" la %0,0\n\t"
530-
: "+d" (ret), "+a"(__dest), "+d"(__dest_len)
531-
: "d"(__func), "a"(__param), "a"(__src), "d"(__src_len)
530+
: "+d" (ret), "+a"(__src), "+d"(__src_len), "+a"(__dest), "+d"(__dest_len)
531+
: "d"(__func), "a"(__param)
532532
: "cc", "memory"
533533
);
534534

@@ -578,11 +578,11 @@ static inline int s390_klmd_shake(unsigned long func, void *param,
578578
int ret = -1;
579579

580580
__asm__ volatile(
581-
"0: .insn rre,0xb93f0000,%1,%5\n\t" /* KLMD opcode */
581+
"0: .insn rre,0xb93f0000,%3,%1\n\t" /* KLMD opcode */
582582
" brc 1,0b\n\t" /* handle partial completion */
583583
" la %0,0\n\t"
584-
: "+d" (ret), "+a"(__dest), "+d"(__dest_len)
585-
: "d"(__func), "a"(__param), "a"(__src), "d"(__src_len)
584+
: "+d" (ret), "+a"(__src), "+d"(__src_len), "+a"(__dest), "+d"(__dest_len)
585+
: "d"(__func), "a"(__param)
586586
: "cc", "memory"
587587
);
588588

0 commit comments

Comments
 (0)