-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: modify_ldt is optional in newer linux kernels, use set_thread_area instead #14795
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No 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? No Sign in to your account
Comments
I've got an error, I've confirmed it on the following environment.
|
You can also try to echo 1 > /proc/sys/modify_ldt as workaround. But this has security implications. |
Unfortunately the kernel config
|
With this patch, https://gist.github.com/stanaka/2b63a16d484692b3599f, which is based on the patch on this comment #386 (comment), linux/386 binary seems to work well on Amazon Linux 2016.03, of which kernel is 4.4.5. |
CL https://golang.org/cl/21190 mentions this issue. |
CL https://golang.org/cl/31753 mentions this issue. |
This is a cherry-pick of https://go-review.googlesource.com/21190 to release-branch-go1.4. Diff prepared by Ian Lance Taylor. linux/386 depends on modify_ldt system call, but recent Linux kernels can disable this system call. Any Go programs built as linux/386 crash with the message 'Trace/breakpoint trap'. The kernel config CONFIG_MODIFY_LDT_SYSCALL, which control enable/disable modify_ldt, is disabled on Amazon Linux 2016.03. This fixes this problem by using set_thread_area instead of modify_ldt on linux/386. Fixes #14795. Change-Id: I22a67d6119e5d24afaa01e2c2b8174991a8a9bf4 Reviewed-on: https://go-review.googlesource.com/31753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a cherry-pick of https://go-review.googlesource.com/21190 to release-branch-go1.4. Diff prepared by Ian Lance Taylor. linux/386 depends on modify_ldt system call, but recent Linux kernels can disable this system call. Any Go programs built as linux/386 crash with the message 'Trace/breakpoint trap'. The kernel config CONFIG_MODIFY_LDT_SYSCALL, which control enable/disable modify_ldt, is disabled on Amazon Linux 2016.03. This fixes this problem by using set_thread_area instead of modify_ldt on linux/386. Fixes golang#14795. Change-Id: I22a67d6119e5d24afaa01e2c2b8174991a8a9bf4 Reviewed-on: https://go-review.googlesource.com/31753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a cherry-pick of https://go-review.googlesource.com/21190 to release-branch-go1.4. Diff prepared by Ian Lance Taylor. linux/386 depends on modify_ldt system call, but recent Linux kernels can disable this system call. Any Go programs built as linux/386 crash with the message 'Trace/breakpoint trap'. The kernel config CONFIG_MODIFY_LDT_SYSCALL, which control enable/disable modify_ldt, is disabled on Amazon Linux 2016.03. This fixes this problem by using set_thread_area instead of modify_ldt on linux/386. Fixes golang#14795. Change-Id: I22a67d6119e5d24afaa01e2c2b8174991a8a9bf4 Reviewed-on: https://go-review.googlesource.com/31753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a cherry-pick of https://go-review.googlesource.com/21190 to release-branch-go1.4. Diff prepared by Ian Lance Taylor. linux/386 depends on modify_ldt system call, but recent Linux kernels can disable this system call. Any Go programs built as linux/386 crash with the message 'Trace/breakpoint trap'. The kernel config CONFIG_MODIFY_LDT_SYSCALL, which control enable/disable modify_ldt, is disabled on Amazon Linux 2016.03. This fixes this problem by using set_thread_area instead of modify_ldt on linux/386. Fixes golang#14795. Change-Id: I22a67d6119e5d24afaa01e2c2b8174991a8a9bf4 Reviewed-on: https://go-review.googlesource.com/31753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a cherry-pick of https://go-review.googlesource.com/21190 to release-branch-go1.4. Diff prepared by Ian Lance Taylor. linux/386 depends on modify_ldt system call, but recent Linux kernels can disable this system call. Any Go programs built as linux/386 crash with the message 'Trace/breakpoint trap'. The kernel config CONFIG_MODIFY_LDT_SYSCALL, which control enable/disable modify_ldt, is disabled on Amazon Linux 2016.03. This fixes this problem by using set_thread_area instead of modify_ldt on linux/386. Fixes golang#14795. Change-Id: I22a67d6119e5d24afaa01e2c2b8174991a8a9bf4 Reviewed-on: https://go-review.googlesource.com/31753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a cherry-pick of https://go-review.googlesource.com/21190 to release-branch-go1.4. Diff prepared by Ian Lance Taylor. linux/386 depends on modify_ldt system call, but recent Linux kernels can disable this system call. Any Go programs built as linux/386 crash with the message 'Trace/breakpoint trap'. The kernel config CONFIG_MODIFY_LDT_SYSCALL, which control enable/disable modify_ldt, is disabled on Amazon Linux 2016.03. This fixes this problem by using set_thread_area instead of modify_ldt on linux/386. Fixes golang#14795. Change-Id: I22a67d6119e5d24afaa01e2c2b8174991a8a9bf4 Reviewed-on: https://go-review.googlesource.com/31753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
see https://lkml.org/lkml/2015/7/21/759
we probably need to switch to use set_thread_area(2) instead for linux/386.
(do we need to apply this Go 1.4.4 so that Go 1.4 continues to run on
newer kernels with disabled modify_ldt? tentatively labeled Go1.4.4)
According to arch_prctl(2) man page: http://man7.org/linux/man-pages/man2/arch_prctl.2.html
Context switches for 64-bit segment bases are rather expensive. As
an optimization, if a 32-bit TLS base address is used, arch_prctl(2)
may use a real TLS entry as if set_thread_area(2) had been called,
instead of manipulating the segment base register directly.
so we probably could switch to set_thread_area even on linux/amd64,
but I see that glibc still uses arch_prctl(ARCH_SET_FS), so probably
the overhead is not that big a problem.
The text was updated successfully, but these errors were encountered: