[LLVMdev] RFC: change BoundsChecking.cpp to use address-based tests

Kevin Schoedel kevin.p.schoedel at intel.com
Tue Dec 4 17:50:34 PST 2012


At 10:30 pm +0000 2012/12/04, Nuno Lopes wrote:
>Please send in your suggestions :)

I'm still giving thought (in the background right now) to the possibility
of using pointer-based tests to leverage address-generation units. The
missing case you outline...

>The scenario is as follows:
> - an object is allocated in the last page of the address space
> - obj is byte addressable (e.g., a char buffer)
> - ptr points to the last few bytes of the address space (with a large
>offset, but starting in bounds)
> - the information read/written is large and therefore there's an overflow
>in the memory addresses that are accessed.
>
>In this case, you'll have ptr > lowerbound and end < upperbound. The bad
>part is that end < ptr.

... is one that might be allowed to pass bounds checking in environments
that are "big and sane", where "big" means "has an MMU" and "sane" means
"faults on references to address 0". On small targets a third test could be
made for (end < ptr), and in principle the (ptr >= lowerbound) test can be
removed in the same cases as the (constant Offset >= 0) can be now.

I don't have a coherent new proposal yet though, let alone numbers to show
that this would be worthwhile.

-- 
Kevin Schoedel kevin.p.schoedel at intel.com +1-519-772-2580
SSG-DPD-ECDL-DMP - Intel Dynamic Mobility and Parallelism



More information about the llvm-dev mailing list