[PATCH] D147975: [StackProtector] don't check stack protector before calling nounwind functions

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 09:47:22 PDT 2023


nickdesaulniers added a comment.

In D147975#4263615 <https://reviews.llvm.org/D147975#4263615>, @xiangzhangllvm wrote:

> It is belong to user code change the stack guard value, it should not use stack protect.

I think these are distinct (multiple) canaries for distinct stacks.  The kernel has its own canary value that may be per-CPU IIUC (so has to be initialized for each CPU that is onlined). This canary is not shared with userspace AFAIK. Userspace has its own canary values for the userspace stacks, sometimes thread local, sometimes a single global per process.

> In my eye, Linux kernel should pay more attention on performance. Maybe we shouldn't build Linux kernel with stack-protector at all, especially if it has a lot of initialize_the_stack_canary() like functions.

The use of stack protectors to protect the Linux kernel is configurable, default on, and may be disabled.  The stack canaries are initialized once per CPU when the CPU is brough online IIUC, but I haven't compared each architecture's implementation.

> I still +1 for this patch.

Backport requested to clang-16: https://github.com/llvm/llvm-project/issues/62119. Thanks for the review and discussions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147975/new/

https://reviews.llvm.org/D147975



More information about the llvm-commits mailing list