1

After downloading ubuntu source from kernel.ubuntu.com, I tried to set configuration for arm64. When I do command below,

LANG=C fakeroot debian/rules ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- editconfigs

and select to change config for arm64, the config menu appears and below is the screen when I searched for STACKPROTECT (by /STACKPROTECT). I wanted to set STACKPROTECTOR_PER_TASK to 'y' but for that I have to set CC_HAVE_STACKPROTECTOR_SYSREG. But this seems to be related to the target processor and I'll have to select the arm64 processor (generation). Where can I set it? I couldn't find it in the General Setup.

enter image description here

1 Answer 1

2

Options that contain HAVE_ are generally things that depend on your build environment, not options per se.

You can see this one being defined in arch/arm64/Kconfig:

config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)

So you can test if your compiler supports it, for example my x86_64 gcc obviously doesn't support it but the aarch64 one (which would be used for an arm64 kernel build!) does for me:

$ echo "int main() { return 0; }" | gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
gcc: error: unrecognized argument in option ‘-mstack-protector-guard=sysreg’
gcc: note: valid arguments to ‘-mstack-protector-guard=’ are: global tls
$ echo "int main() { return 0; }" | aarch64-linux-gnu-gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
$

try that command and see why it fails, you might just need a newer gcc? People online complain the sp_el0 is not present in GCC 8, so I believe it was introduced around gcc 9 or 10.

2
  • Ah, yes that was the case, thanks so much! (I learned how to use the Kconfig info and what that def_bool statement means. which seems to be very useful). My aarch64-linux-gnu-gcc version is 7.5 and it complains about the options. I'll try to update the toolchain. Commented Jun 30, 2021 at 14:25
  • so I downloaded a newer compiler from developer.arm.com/tools-and-software/open-source-software/… and now those options are supported. Thanks! Commented Jun 30, 2021 at 14:44

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.