<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hello,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I am working on the implementation of free and I come across a conflict between me as a C# programer and kernel C code.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">```c</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"></div>if((uintptr_t)ptr < heap_begin || (uintptr_t)ptr > heap_end) <br>{        <br>  //TODO: segmentation fault        <br>  return;<br>}<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">```</div><div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I want to safely determine that the user is dum and trying to free some unknown memory. </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">For this, I can see some kind of range check for free and "throwing" segmentation fault as interop.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I was thinking about <a href="https://www.tutorialspoint.com/c_standard_library/c_function_raise.htm">https://www.tutorialspoint.com/c_standard_library/c_function_raise.htm</a>, but I did not found this is the kernel.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">So my question is, how to raise segmentation fault during free safely?</div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="font-size:12.8px"><font face="georgia, serif"><br></font></span></div><div><font face="georgia, serif"><span style="font-size:12.8px">S pozdravem JiÅà Pelc</span></font></div><div><font face="georgia, serif"><span style="font-size:12.8px">Matematicko-fyzikálnà fakulta</span></font></div><div><font face="georgia, serif"><span style="font-size:12.8px">Univerzita Karlova</span></font></div></div></div></div></div></div>