authorgravatar for biexelar@disroot.orgbiexelar <biexelar@disroot.org> 2022-08-31 02:31:47+00:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-08-30 22:31:47-04:00
log59e33b447b0502bdfa18909f4381360bb8f49b70
treee6fc69e9efb7109515f07e0d1c3a5cb88d1d24c0
parent56cfa8f22f69d813efedb1fa01fdcb7077ca0e5a
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

std.Thread: fix freeAndExit on x86_64-linux (#12693)

Previously, this function used incorrect registers for the munmap syscall, leading to detached threads not cleaning up. closes #12690 Co-authored-by: bxlr <biexelar@diroot.org>

1 files changed, 2 insertions(+), 5 deletions(-)

lib/std/Thread.zig+2-5
...@@ -769,16 +769,13 @@ const LinuxThreadImpl = struct {...@@ -769,16 +769,13 @@ const LinuxThreadImpl = struct {
769 ),769 ),
770 .x86_64 => asm volatile (770 .x86_64 => asm volatile (
771 \\ movq $11, %%rax771 \\ movq $11, %%rax
772 \\ movq %[ptr], %%rbx
773 \\ movq %[len], %%rcx
774 \\ syscall772 \\ syscall
775 \\ movq $60, %%rax773 \\ movq $60, %%rax
776 \\ movq $1, %%rdi774 \\ movq $1, %%rdi
777 \\ syscall775 \\ syscall
778 :776 :
779 : [ptr] "r" (@ptrToInt(self.mapped.ptr)),777 : [ptr] "{rdi}" (@ptrToInt(self.mapped.ptr)),
780 [len] "r" (self.mapped.len),778 [len] "{rsi}" (self.mapped.len),
781 : "memory"
782 ),779 ),
783 .arm, .armeb, .thumb, .thumbeb => asm volatile (780 .arm, .armeb, .thumb, .thumbeb => asm volatile (
784 \\ mov r7, #91781 \\ mov r7, #91