Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/asm: riscv64 assembler does not check the shift amount input #57755

Closed
wdvxdr1123 opened this issue Jan 12, 2023 · 3 comments
Closed

cmd/asm: riscv64 assembler does not check the shift amount input #57755

wdvxdr1123 opened this issue Jan 12, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@wdvxdr1123
Copy link
Contributor

What did you do?

TEXT ·SLLI128(SB),NOSPLIT,$0-0
	MOV	rs+0(FP), A1
	SLLI	$128, A1, A2
	MOV	A2, rd+8(FP)
	RET

compile this assembly code with GOARCH=riscv64.

What did you expect to see?

got a error shift amount out of range 0 to 63

What did you see instead?

assemble successfully but got a illegal instruction fault in run time.

SIGILL: illegal instruction
PC=0x6494c m=0 sigcode=1
instruction bytes: 0x13 0x96 0x5 0x8 0x23 0x38 0xc1 0x0 0x67 0x80 0x0 0x0 0x0 0x0 0x0 0x0

goroutine 1 [running]:
main.SLLI128(0x1)
	riscv1/asm.s:9 +0x4 fp=0x3f84032768 sp=0x3f84032768 pc=0x6494c
main.main()
	riscv1/main.go:52 +0x28 fp=0x3f84032780 sp=0x3f84032768 pc=0x64928
runtime.main()
	runtime/proc.go:250 +0x218 fp=0x3f840327d8 sp=0x3f84032780 pc=0x3dcd8
runtime.goexit()
	runtime/asm_riscv64.s:512 +0x4 fp=0x3f840327d8 sp=0x3f840327d8 pc=0x61e7c

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 12, 2023
@gopherbot
Copy link

Change https://go.dev/cl/461755 mentions this issue: cmd/internal/obj/riscv: add check for invalid shift amount input

@cagedmantis cagedmantis changed the title cmd/asm: riscv64 assembler does not check the shift amout input cmd/asm: riscv64 assembler does not check the shift amount input Jan 13, 2023
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 13, 2023
@cagedmantis cagedmantis added this to the Backlog milestone Jan 13, 2023
@cagedmantis
Copy link
Contributor

/cc @golang/riscv64

@cagedmantis
Copy link
Contributor

/cc @golang/compiler

@golang golang locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants