D - Unsafe and doomed

Walter Bright newshound2 at digitalmars.com
Sun Jan 5 16:13:20 PST 2014


On 1/5/2014 3:59 PM, deadalnix wrote:
>>> because it is known to fool optimizer and cause really
>>> nasty bugs (typically, a pointer is dereferenced, so the optimizer assume it
>>> isn't null and remove null check after the dereference, and then the dereference
>>> is removed as it is dead.
>>
>> I'd like to see a case where this is nasty. I can't think of one.
>>
>
> A recent linux kernel exploit was caused by this. Reread carefully, this nasty
> behavior is created by the optimizer, and avoiding it mean preventing the
> optimizer to optimize aways loads, unless it can prove the pointer is non null.
> As D is meant to be fast, this limitation in the optimizer is highly undesirable.

I'd still like to see an example, even a contrived one.


More information about the Digitalmars-d mailing list