<div dir="ltr"><div><div><div>For what it's worth, I need stack probes as well. My language usecase has two relevant properties:<br></div>1. The language guarantees total memory safety/sandboxing. Malicious programs are unable to negatively affect the rest of the system beyond consuming resources.<br></div>2. The user of the language is allowed significant expressive power, letting him manipulate the stack.<br></div>Stack probes prevent users of a language from skipping over the guard page; it's the last memory hole to be plugged once the rest of the system is secure. I think in general, any language that has these two properties will require either stack probes or a much more complicated system (like geordi, segmented stacks, or obsessive loading of allocated memory). A great number of languages fall into this situation.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 27, 2015 at 3:44 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yeah, the function attributes section of LangRef is a reasonable place to put stuff like this:<div><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_LangRef.html-23function-2Dattributes&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=9SIQM2l9LBT0fy7gjw3gZ_JGUTA7MIRtzMSZmlqBtHI&s=R92M4dbBo9gOD8RfWBKDtYxbDkJFmKDuX_aVP3Wx5IE&e=" target="_blank">http://llvm.org/docs/LangRef.html#function-attributes</a></div><div><br></div><div>I think we should add this. I also know that LLILAC needs something like this as well. I propose the following:</div><div>- Add a string attribute called "stack-probe-symbol"="foo".</div><div>- The presence of this attribute indicates that stack probes should be emitted, even on non-Windows OSs.</div><div>- (future work) For LLILAC, if this attribute is present but the string is empty, this can be a signal that the check must be emitted inline, either as a sequence of stores or a loop.</div><div><br></div><div>This also addresses David's concern with the hardcoded __probestack symbol name.</div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Sun, Jul 26, 2015 at 2:23 AM, John Kåre Alsaker <span dir="ltr"><<a href="mailto:john.mailinglists@gmail.com" target="_blank">john.mailinglists@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Since David Majnemer doesn't seem overly eager to merge my patches,<br>
let's see if we can't figure things out here.<br>
<br>
I noticed a string function attribute appeared in LangRef.rst, would<br>
that be the correct place to document this?<br>
<br>
For reference:<br>
</span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9653&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=9SIQM2l9LBT0fy7gjw3gZ_JGUTA7MIRtzMSZmlqBtHI&s=gV_4pNmG2FALSPJQnNAjqjGyIRfdizkPb8iOmuKtSf8&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D9653</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9654&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=9SIQM2l9LBT0fy7gjw3gZ_JGUTA7MIRtzMSZmlqBtHI&s=FWQzb_lQwqWGOu9ERJCGtouQpV0sCATZiW3nESlX4hU&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D9654</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9858&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=9SIQM2l9LBT0fy7gjw3gZ_JGUTA7MIRtzMSZmlqBtHI&s=ceno8V9VFeBJBroOdwCco5sUIbSxH9vlZQoPnkGe9b8&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D9858</a><span class=""><br>
<br>
On Wed, Aug 6, 2014 at 5:34 PM, John Kåre Alsaker<br></span>
<<a href="mailto:john.mailinglists@gmail.com" target="_blank">john.mailinglists@gmail.com</a>> wrote:<br>
> I updated <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D4717&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=9SIQM2l9LBT0fy7gjw3gZ_JGUTA7MIRtzMSZmlqBtHI&s=ibz-wRihBgpHNnNZPBdBfNEk9rzM_RKH_9aputdPTYA&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D4717</a> and also wrote an __probestack<br>
> implementation:<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Zoxc_compiler-2Drt_compare_llvm-2Dmirror-3Amaster...stprobe&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=9SIQM2l9LBT0fy7gjw3gZ_JGUTA7MIRtzMSZmlqBtHI&s=EzU7LhO9y-f1kS1q6Yr76NSnyLRtOQ7LJeFru3G9wDU&e=" rel="noreferrer" target="_blank">https://github.com/Zoxc/compiler-rt/compare/llvm-mirror:master...stprobe</a><span class=""><br>
><br>
<span>> Which instruction would be the preferable one to probe with? I used OR since<br>
> that's what GCC/libgcc does, but I don't see why that would be better than a<br>
> write.<br>
><br>
><br>
><br>
</span></span><span class=""><span>> On Tue, Aug 5, 2014 at 7:34 PM, Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br>
>><br>
>> On Tue, Aug 5, 2014 at 8:53 AM, John Kåre Alsaker<br>
</span></span><span class=""><div><div>>> <<a href="mailto:john.mailinglists@gmail.com" target="_blank">john.mailinglists@gmail.com</a>> wrote:<br>
>>><br>
>>> Would the __probestack functions be a suitable addition to compiler-rt?<br>
>>> Does it already have __chkstk or is that provided by something else on<br>
>>> Windows? I noticed that libgcc implemented them in cygwin.S.<br>
>><br>
>><br>
>> It seems reasonable to put them in compiler-rt/lib/builtins.<br>
>><br>
>> I don't think anyone is currently using compiler-rt's builtins on Windows,<br>
>> so it doesn't have __chkstk. Typically that is provided by the Cygwin,<br>
>> MinGW, or MSVC C runtime.<br>
><br>
><br>
</div></div></span></blockquote></div><br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>