Re: [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e

Daniel Kiss
2020-09-17T11:39:12Z

> On 17 Sep 2020, at 13:04, Mark Rutland <mark.rutland@arm.com> wrote:
>
> On Wed, Sep 16, 2020 at 10:30:42PM +0100, Daniel Kiss wrote:
>>
>> Thanks for the summary -- yeah, that was my suspicion, that some
>> attribute was being lost somewhere. And I think if we generalize this,
>> and don't just try to attach "frame-pointer" attr to the function, we
>> probably also solve the BTI issue that Mark still pointed out with
>> these module_ctor/dtors.
>>
>> I was trying to see if there was a generic way to attach all the
>> common attributes to the function generated here:
>> https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Utils/
>> ModuleUtils.cpp#L122
>> -- but we probably can't attach all attributes, and need to remove a
>> bunch of them again like the sanitizers (or alternatively just select
>> the ones we need). But, I'm still digging for the function that
>> attaches all the common attributes…
>>
>>
>> We had the problem with not just the sanitisers. Same problem pops with
>> functions
>> that created elsewhere in clang (e.g _clang_call_terminate ) or llvm.
>>
>> In case of BTI the flag even controllable by function attributes which makes it
>> more trickier so
>> the module flags found the only reliable way to pass this information down.
>> Scanning existing functions is fragile for data only compilation units for
>> example.
>>
>> Our solution, not generic enough but might help.
>> https://reviews.llvm.org/D85649
>
> Thanks for the pointer -- I've subscribed to that now.
>
> Just to check my understanding, is the issue that generated functions
> don't implicitly get function attributes like
> "branch-target-enforcement", and so the BTI insertion pass skips those?
Yes, that is correct.

>
> I'm guessing that it's unlikely this'll be fixed for an LLVM 11 release?
> On the kernel side I guess we'll have to guard affected features as
> being incompatible with BTI until there's a viable fix on the compiler
> side. :/
I don’t know but I have motivation to backport all PAC/BTI fixes to LLVM11.0.1.

>
> Thanks,
> Mark.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.