This revision was automatically updated to reflect the committed changes.
Closed by commit rL297298: [ubsan] Detect UB loads from bitfields (authored by
vedantk).
Changed prior to commit:
https://reviews.llvm.org/D30423?vs=90869&id=91041#toc
Repository:
rL LLVM
https://reviews.llvm.org/D304
vsk added a comment.
In https://reviews.llvm.org/D30423#695608, @filcab wrote:
> LGTM since my issue is only an issue on ObjC platforms and it seems those are
> the semantics it should have there.
Thanks for the review.
> P.S: If it documented that the only possible values for BOOL are YES an
filcab added a comment.
LGTM since my issue is only an issue on ObjC platforms and it seems those are
the semantics it should have there.
Comment at: test/CodeGenObjC/ubsan-bool.m:26
+ // OBJC: [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+ // OBJC: call void @__ubsa
vsk added inline comments.
Comment at: test/CodeGenObjC/ubsan-bool.m:26
+ // OBJC: [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+ // OBJC: call void @__ubsan_handle_load_invalid_value
+
filcab wrote:
> jroelofs wrote:
> > vsk wrote:
> > > jroelofs wrote
filcab added inline comments.
Comment at: test/CodeGenObjC/ubsan-bool.m:26
+ // OBJC: [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+ // OBJC: call void @__ubsan_handle_load_invalid_value
+
jroelofs wrote:
> vsk wrote:
> > jroelofs wrote:
> > > vsk wrote
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.
LGTM
Comment at: test/CodeGenObjC/ubsan-bool.m:26
+ // OBJC: [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+ // OBJC: call void @__ubsan_handle_load_invalid_valu
vsk added inline comments.
Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:21
+ // CHECK: call void @__ubsan_handle_load_invalid_value
+ return s->e1;
+}
vsk wrote:
> arphaman wrote:
> > Can we avoid the check if the bitfield is 2 bits wide?
> I don't think so,
vsk updated this revision to Diff 90869.
vsk added a comment.
- Improve objc test coverage per Jon's suggestions.
https://reviews.llvm.org/D30423
Files:
lib/CodeGen/CGAtomic.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGenCXX/ubsan-bitfields.cpp
test/CodeGenObjC/u
vsk added a comment.
In https://reviews.llvm.org/D30423#694003, @jroelofs wrote:
> I think this might miss loads from bitfield ivars.
I'll add a test that shows that this case is covered.
> Also, what about the conversion that happens for properties whose backing
> ivar is a bitfield? (or doe
jroelofs added a comment.
I think this might miss loads from bitfield ivars. Also, what about the
conversion that happens for properties whose backing ivar is a bitfield? (or
does that happen in the runtime? can't remember)
Comment at: test/CodeGenObjC/ubsan-bool.m:25
+ // O
vsk added a comment.
Thanks for the feedback!
Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:21
+ // CHECK: call void @__ubsan_handle_load_invalid_value
+ return s->e1;
+}
arphaman wrote:
> Can we avoid the check if the bitfield is 2 bits wide?
I don't think
arphaman added inline comments.
Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:21
+ // CHECK: call void @__ubsan_handle_load_invalid_value
+ return s->e1;
+}
Can we avoid the check if the bitfield is 2 bits wide?
Comment at: test/CodeGenObjC
vsk created this revision.
We frequently run into user bugs caused by UB loads of out-of-range values from
enum / BOOL bitfields. Teach UBSan to diagnose the issue.
https://reviews.llvm.org/D30423
Files:
lib/CodeGen/CGAtomic.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h
test
13 matches
Mail list logo