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

getcontext fail with EFAULT on E2K #585

Open
ivmai opened this issue Nov 21, 2023 · 2 comments
Open

getcontext fail with EFAULT on E2K #585

ivmai opened this issue Nov 21, 2023 · 2 comments

Comments

@ivmai
Copy link
Owner

ivmai commented Nov 21, 2023

Source: master (92abef5)
Host: Linux 5.4.0-6.9-e8c2 / e2k-v5
Occurrence: ~1/30

Not observed on release-8_2.

How to reproduce (after the modification of code, see below):
gcc -I include -I libatomic_ops/src -D GC_THREADS -D GC_ASSERTIONS -O0 -g -o gctest tests/gctest.c extra/gc.c -lpthread -ldl
while :; do ./gctest; done

Output:
GC Warning: getcontext failed: using another register retrieval method...

Instrument the source code (to abort on getcontext instead of warning):

diff --git a/mach_dep.c b/mach_dep.c
index b51f4f66..8ec8be8e 100644
--- a/mach_dep.c
+++ b/mach_dep.c
@@ -345,6 +345,7 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
         if (getcontext(&ctxt) < 0) {
           WARN("getcontext failed:"
                " using another register retrieval method...\n", 0);
+         abort();
           /* getcontext() is broken, do not try again.          */
           /* E.g., to workaround a bug in Docker ubuntu_32bit.  */
         } else {

Note: when reproducing this case, please ignore other gctest failures.

@ivmai
Copy link
Owner Author

ivmai commented Nov 21, 2023

getcontext() implementation in E2K (which returns EFAULT in some cases):
https://github.com/OpenE2K/linux/blob/linux-5.4.193-mcst/arch/e2k/fast_syscalls/protected.c#L274

@ivmai
Copy link
Owner Author

ivmai commented Apr 15, 2024

Seems to be fixed on the kernel side.
I will test when the kernel is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant