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

compilation error where cf-protection=return isn't available #6

Open
myyc opened this issue May 6, 2021 · 3 comments
Open

compilation error where cf-protection=return isn't available #6

myyc opened this issue May 6, 2021 · 3 comments

Comments

@myyc
Copy link

myyc commented May 6, 2021

i suspect it has to do with my CPU (AMD Ryzen 5 5600X).

error: option 'cf-protection=return' cannot be specified on this target
error: option 'cf-protection=branch' cannot be specified on this target

my knowledge of llvm is very little so i don't know how much of a deal-breaker removing this is, but it compiles nevertheless disregard, i tried it, it seems to work fine.

bonus: not worth including this in a separate ticket, but on arch linux you need to add vim to the dependencies since apparently xxd is included there – my excuse for not having vim installed is that i use neovim which apparently doesn't ship xxd.

@harporoeder
Copy link
Owner

Oh thanks for pointing out the xxd issue. It is annoying how Arch packages that but oh well. I will update the package list in the README, and also the PKGBUILD for the AUR.

As to your primary problem: I'm not sure what the context is of your error. Is this during the compilation of the eBPF or during the compilation of the main application? Are you adding a flag somewhere to resolve this? Except for enabling compilation warnings I don't really have any build flags in the CMake file.

@myyc
Copy link
Author

myyc commented May 7, 2021

sorry i should elaborate more as i did some work to fix the PKGBUILD to sort this out. so, i'm not sure where this happens because you don't seem to specify any weird CFLAGS, but for some reason cf-protection=return gets added, and it breaks the build. i edited PKGBUILD to sort it out, but it's a hack and i would not recommend it.

build() {
    cd "$srcdir/ebpfsnitch-$pkgver"
    mkdir build && cd build
    cmake -D CMAKE_INSTALL_PREFIX="/usr/bin" ..
    # the following two lines are the CFLAGS in the cmake cache, minus cf-protection=return
    cmake -D CMAKE_C_FLAGS:STRING="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS         -Wformat -Werror=format-security         -fstack-clash-protection" ..
    cmake -D CMAKE_CXX_FLAGS:STRING="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS         -Wformat -Werror=format-security         -fstack-clash-protection" ..
   make
}

@harporoeder
Copy link
Owner

Hey @myyc I have a follow up.

I had a friend reproduce this on a couple machines I would of expected it to work on so this does not seem to be a weird one off issue. I'll try and get a fix up in the near future.

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

2 participants