-
Notifications
You must be signed in to change notification settings - Fork 6
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
No Control-flow Enforcement Technology support #6
Comments
Koishi is able to link to boost.context for the fcontext functions, so you can try that first and it might just work. In Taisei build directory: You can also try the If your libc lacks ucontext, you can try https://github.com/kaniini/libucontext, but Koishi will have to be lightly massaged to work with it, because the function names are different. I'll look into backporting the CET stuff from boost later, but I can't promise anything, as I don't have any hardware to adequately test it on. |
Naturally, the MAP_STACK patch is also required on OpenBSD, CET or not. It's been merged now, and the koishi submodule has been updated on Taisei's |
Did you apply it to |
No, I only made the changes in
Yes, sorry if I wasn't clear. Omar shared an update to the port that includes his patch. I hit the CET protection with that patch applied.
I'll give this a shot next. |
I think you also need this for proper CET support boostorg/context@3484575 Which would require some C code changes to manage a shadow stack per fiber, so switching to a different backend probably won't help. |
You're right, @Akaricchi . Even with the
|
Sorry, that was a botched build (forgot to include the
|
I've been working on a new koishi backend for the past 2 days, based on boost.context's high-level callcc API. I believe it should work with CET, though I can't test that myself. It's in a mostly working state now. I'll post a PR for testing tomorrow after cleaning it up. |
@Akaricchi sadly, still no luck:
|
Please attach the build log (with |
Here you go https://gist.github.com/lgv5/725db362d823586f9d1fcd0e483f4f8d . I think the line steps you're interested into are 20 and 23, starting at https://gist.github.com/lgv5/725db362d823586f9d1fcd0e483f4f8d#file-make-log-txt-L411 . |
I think I need to see the preprocessed version of c++ -Isubprojects/koishi/src/libkoishi.a.p -I../taisei-1.4/subprojects/koishi/include -I/usr/local/include -fvisibility=hidden -flto -fcolor-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -O2 -pipe -g -fPIC -DBOOST_ALL_NO_LIB -DKOISHI_THREAD_LOCAL= -DKOISHI_HAVE_MMAP -DKOISHI_MAP_ANONYMOUS=MAP_ANONYMOUS -DKOISHI_HAVE_SYSCONF -DKOISHI_SC_PAGE_SIZE=_SC_PAGE_SIZE -DKOISHI_HAVE_GETPAGESIZE -DKOISHI_HAVE_ALIGNED_ALLOC -DKOISHI_HAVE_POSIX_MEMALIGN -DKOISHI_SJLJ_SIG -DBUILDING_KOISHI -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -Wall -Wpedantic -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Wmissing-prototypes -Wstrict-prototypes -o /tmp/boost_callcc.ii -E ../taisei-1.4/subprojects/koishi/src/boost_callcc/boost_callcc.cc It should output into |
See if |
Slightly different backtrace. OpenBSD currently ships Boost 1.80.0, and the whole
|
You have to update it then. Shadow stack support is the whole point. |
Long time no see, @Akaricchi ! I got back to this. It turns out I was missing a single |
Interesting find, thanks for looking into this. I have just pushed an Also, is there a reason why the extra endbr instruction on the C side needs to be there instead of at the end of |
It's also interesting that this works without shadow stack support. Does OpenBSD not enable that part of CET? |
Indeed, OpenBSD doesn't support shadow stacks. We only support the BTI bits.
I created PR #8 adding the macro definitions and |
Basically
It makes sense why koishi needs it. But |
Can you point me to the boost.context bits? |
There are a few calls to Trying to comprehend C++ code is giving me an aneurysm. |
Also, closing this as completed by #8, though we can continue the discussion here. If we ever need shadow stack support, it's probably better to create a separate issue. |
Much like @omar-polo at taisei-project/taisei#372 , I'm trying Taisei 1.4 in OpenBSD. Much like Omar, the game crashes at the beginning of the first level, but for a different reason: OpenBSD has CET enabled by default in -current and my machine does support it (11th gen Intel).
At the port level, I worked it around by removing CET enforcement, but it would be nice if this library could work without it. Boost has some workarounds for it which I tried to apply at least for my arch,
make_x86_64_sysv_elf_gas.S
, which is adding the_CET_ENDBR
macro at the beginning of each function. That isn't enough to solve it for me, as then I run into another issue:I have the core file around if it helps, and I'll gladly test patches.
The text was updated successfully, but these errors were encountered: