[PATCH] D120596: [clang][CGStmt] fix crash on invalid asm statement

2022-03-02 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. Hi Fangrui @MaskRay, Thanks for your review. Could you please also help me landing it since I don't have write permission to the repo. Please use Tong Zhang Thanks and have a good one! - Tong Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://

[PATCH] D120596: [clang][CGStmt] fix crash on invalid asm statement

2022-03-02 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added inline comments. Comment at: clang/lib/CodeGen/CGStmt.cpp:2517 +else if (OutputTy->isFloatingPointTy()) Arg = Builder.CreateFPExt(Arg, OutputTy); } MaskRay wrote: > Shall we keep the assert (in a new `else` branch) just i

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-03-01 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. Hi Marco, @melver, Could you please help me landing it? I don't have write permission to the repo. Please use Tong Zhang Thanks, Tong Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D119816/new/ https://reviews.llvm.org/D1

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-28 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. Hi Marco, Yes I need help landing it. Please use Tong Zhang Thanks, - Tong Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D119816/new/ https://reviews.llvm.org/D119816 ___ cfe-c

[PATCH] D120596: [clang][CGStmt] fix crash on invalid asm statement

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 updated this revision to Diff 411577. ztong0001 added a comment. reformat code Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120596/new/ https://reviews.llvm.org/D120596 Files: clang/lib/CodeGen/CGStmt.cpp clang/test/CodeGen/X86/x86_

[PATCH] D120596: [clang][CGStmt] fix crash on invalid asm statement

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 updated this revision to Diff 411542. ztong0001 added a comment. reformat test code Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120596/new/ https://reviews.llvm.org/D120596 Files: clang/lib/CodeGen/CGStmt.cpp clang/test/CodeGen/X86

[PATCH] D120596: [clang][CGStmt] fix crash on invalid asm statement

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 created this revision. Herald added a subscriber: pengfei. ztong0001 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Clang is crashing on the following statement char var[9]; __asm__ ("" : "=r" (var) : "0" (var)); This is si

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. In D119816#3346575 , @kees wrote: > FWIW, related problems with `pskb_expand_head` were seen again here: > https://github.com/ClangBuiltLinux/linux/issues/1599 > > I have trouble reproducing it, but I think the kernel patch ther

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:757 SanOpts.set(SanitizerKind::HWAddress, false); + if (mask & SanitizerKind::LocalBounds) +Fn->addFnAttr(llvm::Attribute::NoSanitizeBounds); melver wrote: >

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 updated this revision to Diff 411457. ztong0001 added a comment. - update commit description - In: CodeGenFunction::StartFunction(), merge two checks(SanitizerKind::LocalBounds, SanitizerKind::ArrayBounds) into one(SanitizerKind::Bounds) - update test: clang/test/CodeGen/bounds-checkin

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:757 SanOpts.set(SanitizerKind::HWAddress, false); + if (mask & SanitizerKind::LocalBounds) +Fn->addFnAttr(llvm::Attribute::NoSanitizeBounds); ztong0001 wrote:

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:757 SanOpts.set(SanitizerKind::HWAddress, false); + if (mask & SanitizerKind::LocalBounds) +Fn->addFnAttr(llvm::Attribute::NoSanitizeBounds); melver wrote: >

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-25 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. In D119816#3345302 , @melver wrote: > Looks good. Few minor changes. > > I did some more digging, and it's only fsanitize=local-bounds, so please > verify this and also update the commit description. In fact, the Linux kernel

[PATCH] D119816: [SanitizerBounds] Add support for NoSanitizeBounds function

2022-02-24 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 updated this revision to Diff 411191. ztong0001 added a comment. Thank you, Marco! I have made the following changes: - extend clang/test/CodeGen/bounds-checking.c to include additional test for newly added nosanitize_bounds attribute - added a new pure IR test in llvm/test/Instrument

[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

2022-02-24 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 updated this revision to Diff 411040. ztong0001 edited the summary of this revision. ztong0001 added a comment. update patch and description as suggested by Marco Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D119816/new/ https://reviews.l

[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

2022-02-22 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. Thank you @melver. I will revise patch as suggested. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D119816/new/ https://reviews.llvm.org/D119816 ___ cfe-commits mailing list cfe

[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

2022-02-18 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. Thank you all! I have modified the summary, this patch focus on fixing non-working `__attribute__((no_sanitize("bounds"))) ` attribute. I will try to fix kernel `ksize()` related issue and `-fno-sanitize-undefined-trap-on-error` on separate patches. Repository: rG

[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

2022-02-18 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. In D119816#3332441 , @nlopes wrote: > The main issue is that the kernel is wrong. It has a bug. The sanitizer's > error is not a false-positive! > So what you are proposing is a band-aid. It's not a real solution and it's > ju

[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

2022-02-18 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. In D119816#3331797 , @melver wrote: > Right, I was able to repro this. The problem is the trap, which generally > sucks that no_sanitize still leaves in the trap. > > We also have -fno-sanitize-undefined-trap-on-error, which se

[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

2022-02-18 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 added a comment. In D119816#3331658 , @nlopes wrote: > Well, this patch is just a band-aid and a disaster waiting to happen. > If kmalloc is tagged with an `__attribute__` stating the allocation size, > then you can't dereference beyond that li

[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

2022-02-15 Thread Tong Zhang via Phabricator via cfe-commits
ztong0001 created this revision. Herald added subscribers: ormris, dexonsmith, jdoerfert, steven_wu, hiraditya. ztong0001 requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits. Adding __attribute__((no_sanitize("bounds"))) is not