Page MenuHomePhabricator

xiongji90 (xiongji90)
User

Projects

User does not belong to any projects.

User Details

User Since
Nov 1 2018, 7:20 PM (238 w, 2 d)

Recent Activity

Thu, May 11

xiongji90 committed rG2ed77846a916: This patch adds doc for __builtin_flt_rounds and __builtin_set_flt_rounds (authored by xiongji90).
This patch adds doc for __builtin_flt_rounds and __builtin_set_flt_rounds
Thu, May 11, 7:58 PM · Restricted Project, Restricted Project
xiongji90 closed D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.
Thu, May 11, 7:57 PM · Restricted Project, Restricted Project

Mon, May 8

xiongji90 added a comment to D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.

Hi, @rjmccall
I updated the patch to address your previous comments, could you help review again?
Thanks very much.

Mon, May 8, 12:54 AM · Restricted Project, Restricted Project
xiongji90 updated the diff for D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.

Address previous comments

Mon, May 8, 12:50 AM · Restricted Project, Restricted Project

Mar 28 2023

xiongji90 added a comment to D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.

Hi, @rjmccall and @sepavloff
In UserManual, we include a section Controlling Floating Point Behavior: https://github.com/llvm/llvm-project/blob/main/clang/docs/UsersManual.rst#controlling-floating-point-behavior , now we need to add a new section for floating-point environment, do we need to add the new section in parallel with Controlling Floating Point Behavior section or just put the section under Controlling Floating Point Behavior? And current Controlling Floating Point Behavior includes following description:
Clang provides a number of ways to control floating point behavior, including with command line options and source pragmas.
So, we need to update it to Clang provides a number of ways to control floating point behavior, including with command line options, source pragmas and builtins. and mention builtin_flt_rounds, builtin_set_flt_rounds in this section. Does this meet your expectation?

I think you should add a subsection to Controlling Floating Point Behavior about the floating-point environment. You should not mention these builtins there specifically — if you want an example function that reads or modifies the environment, you should use one of the standard APIs like the FLT_ROUNDS macro or the fesetround function. You should also add the documentation for these builtins where you've currently got it, and that documentation can cross-reference to Controlling Floating Point Behavior. Does that make sense?

Mar 28 2023, 1:20 AM · Restricted Project, Restricted Project
xiongji90 updated the diff for D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.

Add floating point environment section in UserManual.rst

Mar 28 2023, 1:18 AM · Restricted Project, Restricted Project

Mar 27 2023

xiongji90 added a comment to D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.

Hi, @rjmccall and @sepavloff
In UserManual, we include a section Controlling Floating Point Behavior: https://github.com/llvm/llvm-project/blob/main/clang/docs/UsersManual.rst#controlling-floating-point-behavior , now we need to add a new section for floating-point environment, do we need to add the new section in parallel with Controlling Floating Point Behavior section or just put the section under Controlling Floating Point Behavior? And current Controlling Floating Point Behavior includes following description:
Clang provides a number of ways to control floating point behavior, including with command line options and source pragmas.
So, we need to update it to Clang provides a number of ways to control floating point behavior, including with command line options, source pragmas and builtins. and mention builtin_flt_rounds, builtin_set_flt_rounds in this section. Does this meet your expectation?
Thanks very much.

Mar 27 2023, 1:44 AM · Restricted Project, Restricted Project

Mar 20 2023

xiongji90 added inline comments to D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.
Mar 20 2023, 11:47 PM · Restricted Project, Restricted Project

Mar 19 2023

xiongji90 updated the diff for D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.
Mar 19 2023, 11:35 PM · Restricted Project, Restricted Project
xiongji90 updated the diff for D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.

Combine description of builtin_flt_rounds and builtin_set_flt_rounds

Mar 19 2023, 11:27 PM · Restricted Project, Restricted Project
xiongji90 added inline comments to D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.
Mar 19 2023, 8:56 PM · Restricted Project, Restricted Project
xiongji90 updated the diff for D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.
Mar 19 2023, 8:51 PM · Restricted Project, Restricted Project

Mar 15 2023

xiongji90 requested review of D146188: [Clang][DOC] Add documentation in for __builtin_flt_rounds and __builtin_set_flt_rounds.
Mar 15 2023, 8:09 PM · Restricted Project, Restricted Project

Mar 14 2023

xiongji90 committed rGb38aa2971711: Add __builtin_set_flt_rounds (authored by xiongji90).
Add __builtin_set_flt_rounds
Mar 14 2023, 7:57 PM · Restricted Project, Restricted Project
xiongji90 closed D145765: Add __builtin_set_flt_rounds.
Mar 14 2023, 7:57 PM · Restricted Project, Restricted Project

Mar 13 2023

xiongji90 added a comment to D145765: Add __builtin_set_flt_rounds.

Thanks for the additional tests! Can you also add a release note to clang/docs/ReleaseNotes.rst and document the new builtin in clang\docs\LanguageExtensions.rst?

Mar 13 2023, 11:59 PM · Restricted Project, Restricted Project
xiongji90 updated the diff for D145765: Add __builtin_set_flt_rounds.

Simplify test and update release doc

Mar 13 2023, 11:50 PM · Restricted Project, Restricted Project

Mar 12 2023

xiongji90 updated the diff for D145765: Add __builtin_set_flt_rounds.

Add SemaChecking test for incompatible input arguments for __builtin_set_flt_rounds.

Mar 12 2023, 10:55 PM · Restricted Project, Restricted Project
xiongji90 added inline comments to D145765: Add __builtin_set_flt_rounds.
Mar 12 2023, 10:00 PM · Restricted Project, Restricted Project
xiongji90 updated the diff for D145765: Add __builtin_set_flt_rounds.

Add semachecking test for unsupported platform.

Mar 12 2023, 8:54 PM · Restricted Project, Restricted Project

Mar 9 2023

xiongji90 added a comment to D145765: Add __builtin_set_flt_rounds.

Hi, @andrew.w.kaylor @rjmccall @sepavloff @aaron.ballman
This patch re-lands previous patch to add builtin_set_flt_rounds, previous patch broke PPC64 buildbot due to test case bug. Previously, tests for builtin_set_flt_rounds was located in CodeGen/builtin.c which would run on all triples but this builtin was restricted to work only on Intel and Arm platform, so the builtin.c will fail on targets such as PPC64. I move the test into a separate file and use following commands to run the lit test:
RUN: %clang_cc1 -triple x86_64-gnu-linux %s -emit-llvm -o - | FileCheck %s
RUN: %clang_cc1 -triple x86_64-windows-msvc %s -emit-llvm -o - | FileCheck %s
RUN: %clang_cc1 -triple aarch64-gnu-linux %s -emit-llvm -o - | FileCheck %s
RUN: %clang_cc1 -triple aarch64-windows-msvc %s -emit-llvm -o - | FileCheck %s
Could you help review again?

Mar 9 2023, 9:39 PM · Restricted Project, Restricted Project
xiongji90 requested review of D145765: Add __builtin_set_flt_rounds.
Mar 9 2023, 9:34 PM · Restricted Project, Restricted Project

Mar 8 2023

xiongji90 committed rGd4fcc692ee15: Disable test for __builtin_set_flt_rounds to avoid breaking PPC buildbot (authored by xiongji90).
Disable test for __builtin_set_flt_rounds to avoid breaking PPC buildbot
Mar 8 2023, 8:57 PM · Restricted Project, Restricted Project
xiongji90 committed rG24b823554acd: Add __builtin_set_flt_rounds (authored by xiongji90).
Add __builtin_set_flt_rounds
Mar 8 2023, 7:39 PM · Restricted Project, Restricted Project
xiongji90 closed D144454: Add builtin for llvm set rounding.
Mar 8 2023, 7:38 PM · Restricted Project, Restricted Project

Mar 6 2023

xiongji90 added a comment to D144454: Add builtin for llvm set rounding.

Hi, @sepavloff
Do you have any concern about this patch?
Thanks very much.

Mar 6 2023, 3:52 PM · Restricted Project, Restricted Project
xiongji90 added a reviewer for D144454: Add builtin for llvm set rounding: sepavloff.
Mar 6 2023, 3:52 PM · Restricted Project, Restricted Project
xiongji90 added a comment to D144454: Add builtin for llvm set rounding.

Hi, @rjmccall and @sepavloff
I updated built name to "builtin_set_flt_rounds" as suggested and restrict the built to be used on x86, arm, aarch64 target. I did my local test on x86 and x86_64 and found arm and aarch64 code gen have already supported "llvm.set.rounding" :https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/ARM/ARMISelLowering.cpp#L6398 and https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L4528
So enabling the builtin on these targets should be OK. To document, is it ok to create another patch to add doc for both "
builtin_flt_rounds" and "__builtin_set_flt_rounds"?
Thanks very much.

Mar 6 2023, 12:28 AM · Restricted Project, Restricted Project

Mar 5 2023

xiongji90 updated the diff for D144454: Add builtin for llvm set rounding.

Update the builtin name to __builtin_set_flt_rounds and restrict it to be used only on x86, x86_64, arm, aarch64 target.

Mar 5 2023, 7:55 PM · Restricted Project, Restricted Project

Mar 2 2023

xiongji90 added a comment to D144454: Add builtin for llvm set rounding.

I see. If we're going to take the target-independent values specified by FLT_ROUNDS, then the original builtin name is more appropriate. Of course, this has the disadvantage of not allowing target-specific values that might exist beyond those specified in the standard; are we pretty certain that's not a problem in practice?

Working on x86, ARM, and AArch64 is great, but I'm a little worried about adding another builtin that works only on major targets and probably crashes on others. I suppose we've got some number of those already, though.

Mar 2 2023, 12:44 AM · Restricted Project, Restricted Project

Mar 1 2023

xiongji90 added a comment to D144454: Add builtin for llvm set rounding.

C standard function fesetround accepts rounding mode in the form of target-specific values like FE_TONEAREST. They usually represent corresponding bits in control register, so are different for different targets. llvm.set_rounding in contrast accepts rounding mode as target-independent value, the encoding is same as used in FLT_ROUNDS.

The difference between fesetround and llvm.set_rounding is same as for fegetround and FLT_ROUNDS. They differ in how rounding mode is specified, - as target-specific or as target-independent values respectively.

The intrinsic llvm.set_rounding was introduced to facilitate work on IR, because IR is (mainly) target-agnostic and defines like FE_TONEAREST are not available there. It would be nice to have a C builtin counterpart for FLT_ROUNDS, I don't know why the standard does not define it.

Implementation of fesetround with set_rounding would be very useful, but it requires translation of target-specific values for rounding mode into universal values and also checking availability of FPU, as fesetround returns value if rounding mode cannot be set. Both these checks are likely to require separate builtins.

Mar 1 2023, 9:58 PM · Restricted Project, Restricted Project
xiongji90 added a comment to D144454: Add builtin for llvm set rounding.

New builtins should be documented in the user manual.

There are standard pragmas for changing the rounding mode, right? What's the interaction between the ability to set this dynamically with a builtin call and those pragmas?

Hi, @rjmccall
Current status is LLVM has added llvm.get.rounding and llvm.set.rounding intrinsic and has also added "__builtin_flt_rounds" for llvm.get.rounding but there is no corresponding for llvm.set.rounding intrinisc. According to original patch to add llvm.set.rounding: https://reviews.llvm.org/D74729 and LLVM document for this intrinsic: https://llvm.org/docs/LangRef.html#id1506
The introduction of llvm.set.rounding intrinsic can provide same functionality as C library function "fesetround" and avoid unnecessary dependency on C library. Currently, this intrinsic can't benefit C/C++ developers since we don't have a corresponding builtin and we even can't add a C/C++ test for this intrinsic.

If this builtin is defined to have the same behavior as fesetround, the obvious name would be __builtin_fesetround. You seem to have patterned it off of __builtin_flt_rounds, but that is not an arbitrarily-chosen name, it's taken from the standard FLT_ROUNDS macro and is expected to work as an implementation of it.

We already understand how fesetround is supposed to interact with the standard pragmas about the FP environment, so that indirectly answers that part of my question. I assume you've modeled your intrinsic correctly in LLVM so that the optimizer understands it can't reorder the environment-sensitive math intrinsics around calls to the new intrinsic?

If this builtin is just an intrinsic implementation of fesetround, I don't think we need further documentation of it.

I assume the intrinsic is only implemented on certain targets? If so, we might need to restrict uses of the builtin as well (and make sure that __has_builtin only returns true on those targets).

Mar 1 2023, 7:54 PM · Restricted Project, Restricted Project
xiongji90 updated the diff for D144454: Add builtin for llvm set rounding.

Change the builtin name to __builtin_fesetround

Mar 1 2023, 6:55 PM · Restricted Project, Restricted Project
xiongji90 added a comment to D144454: Add builtin for llvm set rounding.

New builtins should be documented in the user manual.

There are standard pragmas for changing the rounding mode, right? What's the interaction between the ability to set this dynamically with a builtin call and those pragmas?

Mar 1 2023, 12:10 AM · Restricted Project, Restricted Project

Feb 28 2023

xiongji90 updated the diff for D144454: Add builtin for llvm set rounding.

Update test for llvm.set.rounding

Feb 28 2023, 11:58 PM · Restricted Project, Restricted Project
xiongji90 added a comment to D144454: Add builtin for llvm set rounding.

New builtins should be documented in the user manual.

There are standard pragmas for changing the rounding mode, right? What's the interaction between the ability to set this dynamically with a builtin call and those pragmas?

Feb 28 2023, 12:51 AM · Restricted Project, Restricted Project

Feb 21 2023

xiongji90 added a reviewer for D144454: Add builtin for llvm set rounding: andrew.w.kaylor.
Feb 21 2023, 12:44 AM · Restricted Project, Restricted Project
xiongji90 requested review of D144454: Add builtin for llvm set rounding.
Feb 21 2023, 12:44 AM · Restricted Project, Restricted Project

Nov 10 2022

xiongji90 abandoned D136317: Avoid inline optimization for unwind_phase2 and unwind_phase2_forced.
Nov 10 2022, 10:21 PM · Restricted Project, Restricted Project, Restricted Project
xiongji90 committed rG4fde94fb4329: [libunwind][NFC] Fix typo in libunwind debug string (authored by xiongji90).
[libunwind][NFC] Fix typo in libunwind debug string
Nov 10 2022, 5:33 AM · Restricted Project
xiongji90 closed D137529: [libunwind][NFC] FIx some typo in libunwind's debug string.
Nov 10 2022, 5:33 AM · Restricted Project, Restricted Project, Restricted Project
xiongji90 added a comment to D137529: [libunwind][NFC] FIx some typo in libunwind's debug string.

Hi, @MaskRay
Could you take a look at this PR? This trivial patch aims to fix a potential typo.

Nov 10 2022, 12:42 AM · Restricted Project, Restricted Project, Restricted Project

Nov 8 2022

xiongji90 committed rG4db687155bc1: [libunwind] Check corrupted return address in unwind_phase2 when CET is enabled. (authored by xiongji90).
[libunwind] Check corrupted return address in unwind_phase2 when CET is enabled.
Nov 8 2022, 10:13 PM · Restricted Project
xiongji90 closed D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.
Nov 8 2022, 10:12 PM · Restricted Project, Restricted Project, Restricted Project

Nov 6 2022

xiongji90 requested review of D137529: [libunwind][NFC] FIx some typo in libunwind's debug string.
Nov 6 2022, 10:59 PM · Restricted Project, Restricted Project, Restricted Project

Nov 1 2022

xiongji90 added a comment to D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.

Hi, @MaskRay
Unnecessary check in forced unwind is removed. This patch is to align with libgcc's behavior in stack unwinding process on CET enabled platform. libgcc added check in stacking unwinding phase2, we need to go through the stacks to count how many stack frames to skip when CET is enabled and we can enhance security by comparing return addr in normal stack against CET shadow stack at the same time. If return addr in the 2 stacks don't match, it means the normal stack has been corrupted by someone and we can report fatal error in advance.
We also ran libunwind, libcxx, libcxxabi tests with CET enabled with latest patch, all tests passed.

Nov 1 2022, 1:58 AM · Restricted Project, Restricted Project, Restricted Project
xiongji90 updated the diff for D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.
Nov 1 2022, 1:13 AM · Restricted Project, Restricted Project, Restricted Project
xiongji90 added inline comments to D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.
Nov 1 2022, 1:11 AM · Restricted Project, Restricted Project, Restricted Project
xiongji90 updated the diff for D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.
Nov 1 2022, 1:10 AM · Restricted Project, Restricted Project, Restricted Project

Oct 31 2022

xiongji90 added a comment to D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.

Is this check a libgcc behavior? Is it intended for just C++ exceptions (regular phase2) or also for _Unwind_ForcedUnwind?

Can you craft an example to demonstrate a failure caught by the new check? It is going to be brittle so I can understand that a test is likely inappropriate.

For C++ exceptions exception_object->exception_class != 0 is always true while for _Unwind_ForcedUnwind exception_class is typically zero, so I am not sure having the code in unwind_phase2_forced is useful...

Oct 31 2022, 10:35 PM · Restricted Project, Restricted Project, Restricted Project

Oct 28 2022

xiongji90 added a reviewer for D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2: MaskRay.
Oct 28 2022, 12:02 AM · Restricted Project, Restricted Project, Restricted Project

Oct 25 2022

xiongji90 added a comment to D136317: Avoid inline optimization for unwind_phase2 and unwind_phase2_forced.

Can you add the stacktrace to the description?

Oct 25 2022, 7:47 PM · Restricted Project, Restricted Project, Restricted Project
xiongji90 added a comment to D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.

Is there any way to validate correctness without a CET-capable machine?
Is there any emulator

Oct 25 2022, 5:51 PM · Restricted Project, Restricted Project, Restricted Project
xiongji90 added a comment to D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.

Hi, @hjl.tools
Could you take a look at this patch, we aim to align with libgcc's behavior in CET shadow stack unwinding process in order to enhance security.

Oct 25 2022, 1:32 AM · Restricted Project, Restricted Project, Restricted Project
xiongji90 requested review of D136667: Check return address stored in normal stack and CET shadow stack in unwind process phase2.
Oct 25 2022, 1:30 AM · Restricted Project, Restricted Project, Restricted Project

Oct 19 2022

xiongji90 updated the diff for D136317: Avoid inline optimization for unwind_phase2 and unwind_phase2_forced.
Oct 19 2022, 11:03 PM · Restricted Project, Restricted Project, Restricted Project
xiongji90 updated the diff for D136317: Avoid inline optimization for unwind_phase2 and unwind_phase2_forced.
Oct 19 2022, 10:55 PM · Restricted Project, Restricted Project, Restricted Project
xiongji90 added a comment to D136317: Avoid inline optimization for unwind_phase2 and unwind_phase2_forced.

Hi, @MaskRay and @compnerd
Could you help review this patch?
Thanks very much.

Oct 19 2022, 10:48 PM · Restricted Project, Restricted Project, Restricted Project
xiongji90 requested review of D136317: Avoid inline optimization for unwind_phase2 and unwind_phase2_forced.
Oct 19 2022, 10:47 PM · Restricted Project, Restricted Project, Restricted Project

Oct 17 2022

xiongji90 added a comment to D136131: [CMake] Fix LIBUNWIND_ENABLE_CET build after D110005.

Hi, @MaskRay and @compnerd
Could you help review this little fix for libunwind CET build break?

Oct 17 2022, 10:57 PM · Restricted Project, Restricted Project, Restricted Project
xiongji90 requested review of D136131: [CMake] Fix LIBUNWIND_ENABLE_CET build after D110005.
Oct 17 2022, 10:57 PM · Restricted Project, Restricted Project, Restricted Project

Feb 14 2022

xiongji90 accepted D119697: [libunwind] Only include cet.h if __CET__ defined.
Feb 14 2022, 6:01 PM · Restricted Project, Restricted Project

Jan 9 2022

xiongji90 committed rG6fab27427581: Control-flow Enforcement Technology (CET), published by Intel, introduces (authored by xiongji90).
Control-flow Enforcement Technology (CET), published by Intel, introduces
Jan 9 2022, 6:51 PM
xiongji90 closed D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Jan 9 2022, 6:50 PM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Jan 9 2022, 5:30 PM · Restricted Project

Jan 5 2022

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Hi, @MaskRay and @compnerd
I have updated the patch based on your comments and may need your approval again.
Thanks very much for the review.

Jan 5 2022, 6:28 PM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Jan 5 2022, 6:26 PM · Restricted Project

Dec 23 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Hi, @compnerd
Kind ping~

Dec 23 2021, 5:24 PM · Restricted Project

Dec 12 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Hi, @compnerd
Kind ping~

Dec 12 2021, 6:38 PM · Restricted Project

Nov 16 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Hi, @compnerd
Could you check again if the latest update meets your requirement?
Thanks very much.

Nov 16 2021, 6:50 PM · Restricted Project

Oct 27 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Hi, @compnerd , @MaskRay and @manojgupta
I have updated the patches according to previous comments, could you help review it?

Oct 27 2021, 6:13 PM · Restricted Project

Oct 25 2021

xiongji90 added inline comments to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 25 2021, 4:11 AM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 25 2021, 4:10 AM · Restricted Project
xiongji90 added inline comments to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 25 2021, 4:07 AM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 25 2021, 3:59 AM · Restricted Project

Oct 14 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

If no customization is needed (like libc++/libc++abi D107560), why not just require explicit CXXFLAGS? I don't see a need for a new CMake option.

Oct 14 2021, 8:49 PM · Restricted Project
xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

If no customization is needed (like libc++/libc++abi D107560), why not just require explicit CXXFLAGS? I don't see a need for a new CMake option.

Oct 14 2021, 8:34 PM · Restricted Project

Oct 13 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Hi, @MaskRay
I removed endbr in builtin .S file according to your suggestion, could you help review again?
Thanks very much.

Oct 13 2021, 12:42 AM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 13 2021, 12:40 AM · Restricted Project

Oct 8 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Ugh, wait. Can functions like __floatundisf be indirect call targets? Compilers generate direct calls to them and we don't expect users to indirectly call them.

I also don't find AArch64 bti notation.

Hi, @MaskRay
I agree that we don't expect users to call those builtin functions indirectly but compiler doesn't have any mechanism to forbid users to do that currently. As long as those builtin functions are exported, user can call them directly or indirectly and this may lead to CET IBT violation.

That will be pilot error. Unsupporting that use case is ok.

If there is legitimate use case (I doubt), we can add endbr as needed. The defensive approach is unnecessary.

I suggest to keep the "endbr" here, keeping the "endbr" in builtin functions just adds several endbr instructions into final binary and it can make CET enabling more unified, all functions will start with "endbr" when IBT is enabled, it will also avoid crash when some users are playing tricks with those builtin function via indirect calls.

I believe libgcc has much fewer endbr annotations.

Thanks very much.

Oct 8 2021, 7:08 PM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 8 2021, 2:20 AM · Restricted Project
xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Ugh, wait. Can functions like __floatundisf be indirect call targets? Compilers generate direct calls to them and we don't expect users to indirectly call them.

I also don't find AArch64 bti notation.

Oct 8 2021, 1:55 AM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 8 2021, 1:36 AM · Restricted Project
xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

I tried to use it locally and ran into following issues:

ld.lld: warning: /usr/lib64/clang/14.0.0/lib/linux/clang_rt.crtbegin-x86_64.o: -z force-ibt: file does not have GNU_PROPERTY_X86_FEATURE_1_IBT property
ld.lld: warning: /usr/lib64/clang/14.0.0/lib/linux/clang_rt.crtend-x86_64.o: -z force-ibt: file does not have GNU_PROPERTY_X86_FEATURE_1_IBT property

Apparently crt* files are not built with fcf-protection=full flag.

Oct 8 2021, 12:54 AM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Oct 8 2021, 12:40 AM · Restricted Project

Oct 7 2021

xiongji90 added inline comments to D111185: Reland [sanitizer] Support Intel CET.
Oct 7 2021, 7:39 PM · Restricted Project
xiongji90 added inline comments to D111185: Reland [sanitizer] Support Intel CET.
Oct 7 2021, 7:13 PM · Restricted Project

Oct 4 2021

xiongji90 added a reviewer for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library: hjl.tools.
Oct 4 2021, 6:44 AM · Restricted Project

Sep 24 2021

xiongji90 added inline comments to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Sep 24 2021, 1:47 AM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Sep 24 2021, 1:30 AM · Restricted Project

Sep 22 2021

xiongji90 added a comment to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

Hi, @compnerd , @MaskRay and @efriedma

Sep 22 2021, 2:09 AM · Restricted Project

Sep 17 2021

xiongji90 added inline comments to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Sep 17 2021, 8:33 PM · Restricted Project
xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Sep 17 2021, 8:32 PM · Restricted Project

Sep 15 2021

xiongji90 updated the diff for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.

include <cet.h> and define CET endbr macros only when "CET" is defined. When using gcc or clang, "CET" is defined when -fcf-protection option is used.

Sep 15 2021, 11:19 PM · Restricted Project
xiongji90 added inline comments to D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Sep 15 2021, 7:59 PM · Restricted Project
xiongji90 added a reviewer for D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library: MaskRay.

Hi, @MaskRay
could you help review this patch?
Thanks very much.

Sep 15 2021, 5:00 AM · Restricted Project
xiongji90 requested review of D109811: [compiler-rt][CET] Enable CET for compiler-rt builtin library.
Sep 15 2021, 1:23 AM · Restricted Project

Aug 26 2021

xiongji90 committed rG21b25a1fb32e: [libunwind] Support stack unwind in CET environment (authored by xiongji90).
[libunwind] Support stack unwind in CET environment
Aug 26 2021, 1:14 AM
xiongji90 closed D105968: [libunwind][CET] Support exception handling stack unwind in CET environment.
Aug 26 2021, 1:14 AM · Restricted Project, Restricted Project

Aug 24 2021

xiongji90 added a comment to D105968: [libunwind][CET] Support exception handling stack unwind in CET environment.

There are still many unresolved comments. Please mark resolved ones as done and then click "Submit".

Hi, @MaskRay
Left unresolved comments are resolved and I also rebased the patch to latest llvm libunwind code.

Thanks very much.

You marked your own comments as "Done" but not reviewers' comments as "Done".

So I currently see 35 among 79 comments are done, while the rest are not.

Please mark resolved ones as done.

If you need a reviewer to commit this patch on your behalf, please provide git commit --amend --author="name <email>".

Aug 24 2021, 7:59 PM · Restricted Project, Restricted Project