[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 23 10:36:46 PST 2020


MaskRay added a comment.

In D72222#1836645 <https://reviews.llvm.org/D72222#1836645>, @nickdesaulniers wrote:

> In D72222#1836610 <https://reviews.llvm.org/D72222#1836610>, @MaskRay wrote:
>
> > In D72222#1836409 <https://reviews.llvm.org/D72222#1836409>, @peter.smith wrote:
> >
> > > Although this particular commit will not be at fault, it is the option that enables the feature which is the earliest I can bisect the fault to. There are 3 files in linux that assert fail on the Implement the 'patchable-function attribute'. The files in question are kasan/quarantine.c, mm/slab_common.c and mm/slub.c .
> > >
> > > I reproduced with
> > >
> > >   make CC=/path/to/clang/install/clang ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTGCC=gcc allmodconfig
> > >
> > >
> > > You can get the log files for the build, which is from clang-10
> > >  https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/ci/tcwg_kernel/llvm-release-aarch64-mainline-allmodconfig (4: update: llvm-linux: 19676)
> > >
> > > If the patchable functions is intended for clang-10 we'll need to make sure any fix is merged to clang-10.
> >
> >
> > This commit was made before release/10.x branch. Maybe the easiest thing is to revert the driver change in release/10.x (CC @hans), before we had a better understanding of the problem.
>
>
> If you have cycles to debug the assertions quickly, maybe it's a simple fix that doesn't require a revert?
>
> > (Eventually I think the Linux kernel should have a better configure time test than a simple `whether the compiler accepts -fpatchable-function-entry=2,0?`)
>
> Maybe, but I would prefer to avoid such autoconf like detection. `cc-option` in the kernel is relatively simple and hardened at this point.


I will need to read your other qemu command lines to learn how to debug.

The problem may be that the Linux kernel expects a different behavior from Clang's. We don't have to be hurry. If we decide to revert it in release/10.x, we can do that just a few days before 10.0.0 is released. (That was why I separated these patches...) I am more concerned of whether the GCC side will eventually fix the flaws (https://gcc.gnu.org/ml/gcc/2020-01/msg00067.html).
(I really dislike how the feature was developed on the GCC side. Yet another Linux-kernel specific GCC option when there are already 4 existing options for the same feature)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72222





More information about the cfe-commits mailing list