Skip to content

toolchain: fix for building blu_spark kernel using google's aosp toolchains. addresses error: undefined symbol 'stack_chk_guard';#1

Closed
micfogas wants to merge 1 commit intoengstk:blu_spark-16from
micfogas:blu_spark-16
Closed

toolchain: fix for building blu_spark kernel using google's aosp toolchains. addresses error: undefined symbol 'stack_chk_guard';#1
micfogas wants to merge 1 commit intoengstk:blu_spark-16from
micfogas:blu_spark-16

Conversation

@micfogas
Copy link
Copy Markdown

details: this patch checks for CC_IS_AOSP_CLANG before
stackprotector. if it is, then global stack-
protector guard is used, instead of per-task
and sysreg (using a canary instead of TLS).

            blu_spark KCFLAGS changes from aosp kernel
            source tree in /Makefile cause final linking
            of vmlinux.o to fail with per-task stack-
            protector guard. this patch is designed to
            resolve the error without modifying blu_spark
            code.

    credit: micfogas

signed-off-by: micfogas tech@technotic.us

                aosp toolchains. addresses error:
                        undefined symbol 'stack_chk_guard';

details:        this patch checks for CC_IS_AOSP_CLANG before
                stackprotector. if it is, then global stack-
                protector guard is used, instead of per-task
                and sysreg (using a canary instead of TLS).

                blu_spark KCFLAGS changes from aosp kernel
                source tree in /Makefile cause final linking
                of vmlinux.o to fail with per-task stack-
                protector guard. this patch is designed to
                resolve the error without modifying blu_spark
                code.

        credit: micfogas

signed-off-by: micfogas <tech@technotic.us>
@engstk
Copy link
Copy Markdown
Owner

engstk commented Jan 30, 2026

This doesn't make much sense outside of forks, not aiming to build with exp higher clang.
It builds fine with clang-r487747c, which is the stable ABI used across all production android14-6.1 trees.
Any clang 17.X will work fine and that should what we would expect for better API compatibility.
Also global vs. per-task(sysreg) lowers security a bit.

@engstk engstk closed this Jan 30, 2026
@micfogas
Copy link
Copy Markdown
Author

micfogas commented Feb 1, 2026

I'm curious about your build environment. I determined that the CFLAG '-mcpu=cortex-a55' in your Makefile is the cause of this problem on both of my build systems. Both Almalinux 10 and Ubuntu 22.04.

I am aware that global vs. per_task is less secure. It was an older patch I made and yes, even 487747c has this issue. I build primarily with 19.0.1 (r536225) due to some optimizations with clang 19 over 17, particularly with CFI.

I am far from an advanced kernel dev, and I've been doing it for maybe only 6 months. I started learning to build for my Pixel 6 Pro (device target raven, kernel target raviole) from forking your kernel source. I then requested the source for 250916 (qpr2 b3) and then 251205 (qpr2 release) from Google, which gave me the full Bazel/kleaf systems, though I've stuck to keeping KMI compatibility creating only Image.lz4.

I provided the patch (I suppose simply omitting the problem CFLAG would be better, I'm not sure on all the optimizations that cortex-a55 adds) as a workaround without modifying your code any, including your Makefile optimizations.

Do you have any insight on why that CFLAG would cause an issue with stack guard? Thanks for your time.

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

Successfully merging this pull request may close these issues.

2 participants