<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">That's precisely that what I missed. Thanks.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">pá 30. 10. 2020 v 19:12 odesílatel Petr Tuma <<a href="mailto:petr.tuma@d3s.mff.cuni.cz">petr.tuma@d3s.mff.cuni.cz</a>> napsal:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I guess your point is how to do an equivalent of an `assert` statement (that is, announce a fatal error and stop the execution) ? For that, there already is an `assert` macro in `debug.h` ... or did you have something else in mind ?<br>
<br>
Petr<br>
<br>
<br>
On 30/10/2020 18:55, Jura Pelc wrote:<br>
> Hello,<br>
> <br>
> I am working on the implementation of free and I come across a conflict between me as a C# programer and kernel C code.<br>
> ```c<br>
> if((uintptr_t)ptr < heap_begin || (uintptr_t)ptr > heap_end)<br>
> {<br>
>  Â  Â  //TODO: segmentation fault<br>
>  Â  Â  return;<br>
> }<br>
> ```<br>
> I want to safely determine that the user is dum and trying to free some unknown memory.<br>
> For this, I can see some kind of range check for free and "throwing" segmentation fault as interop.<br>
> I was thinking about <a href="https://www.tutorialspoint.com/c_standard_library/c_function_raise.htm" rel="noreferrer" target="_blank">https://www.tutorialspoint.com/c_standard_library/c_function_raise.htm</a> <<a href="https://www.tutorialspoint.com/c_standard_library/c_function_raise.htm" rel="noreferrer" target="_blank">https://www.tutorialspoint.com/c_standard_library/c_function_raise.htm</a>>, but I did not found this is the kernel.<br>
> <br>
> So my question is, how to raise segmentation fault during free safely?<br>
> <br>
> -- <br>
> <br>
> S pozdravem Jiří Pelc<br>
> Matematicko-fyzikální fakulta<br>
> Univerzita Karlova<br>
> <br>
> _______________________________________________<br>
> NSWI004 mailing list<br>
> <a href="mailto:NSWI004@d3s.mff.cuni.cz" target="_blank">NSWI004@d3s.mff.cuni.cz</a><br>
> <a href="https://d3s.mff.cuni.cz/mailman/listinfo/nswi004" rel="noreferrer" target="_blank">https://d3s.mff.cuni.cz/mailman/listinfo/nswi004</a><br>
> <br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="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>