Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Aug 2018 07:45:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        emulation@FreeBSD.org
Subject:   [Bug 225105] Linux static golang binaries crash at startup
Message-ID:  <bug-225105-4077-zcBZQxbv2B@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-225105-4077@https.bugs.freebsd.org/bugzilla/>
References:  <bug-225105-4077@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D225105

Yanko Yankulov <yanko.yankulov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yanko.yankulov@gmail.com

--- Comment #11 from Yanko Yankulov <yanko.yankulov@gmail.com> ---
Hi guys,


Hit this a few weeks ago haven't notice the ticket, the sysarch call will t=
ry
to load the arguments from userspace and fail as they are on the kernel sta=
ck.
A working (but ugly) solution is to duplicate the code in linux_machdep:

--- a/sys/amd64/linux/linux_machdep.c
+++ b/sys/amd64/linux/linux_machdep.c
@@ -240,10 +240,14 @@ linux_arch_prctl(struct thread *td, struct
linux_arch_prctl_args *args)
                        error =3D EPERM;
                break;
        case LINUX_ARCH_SET_FS:
-               bsd_args.op =3D AMD64_SET_FSBASE;
-               bsd_args.parms =3D (void *)args->addr;
-               error =3D sysarch(td, &bsd_args);
-               if (error =3D=3D EINVAL)
+               if (args->addr < VM_MAXUSER_ADDRESS) {
+                       struct pcb *pcb =3D curthread->td_pcb;
+                       set_pcb_flags(pcb, PCB_FULL_IRET);
+                       pcb->pcb_fsbase =3D args->addr;
+                       td->td_frame->tf_fs =3D _ufssel;
+                       error =3D 0;
+               }
+               else
                        error =3D EPERM;

A better solution will be to change sysarch to accept addition parameter ab=
out
the location of the memory, but haven't have the time to explore this path =
yet.

Hope this helps.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-225105-4077-zcBZQxbv2B>