[NSWI004] How to cause segmentation fault.

Jura Pelc jirik.pelc1998 at gmail.com
Fri Oct 30 18:55:44 CET 2020


Hello,

I am working on the implementation of free and I come across a conflict
between me as a C# programer and kernel C code.
```c
if((uintptr_t)ptr < heap_begin || (uintptr_t)ptr > heap_end)
{
    //TODO: segmentation fault
    return;
}
```
I want to safely determine that the user is dum and trying to free some
unknown memory.
For this, I can see some kind of range check for free and "throwing"
segmentation fault as interop.
I was thinking about
https://www.tutorialspoint.com/c_standard_library/c_function_raise.htm, but
I did not found this is the kernel.

So my question is, how to raise segmentation fault during free safely?

-- 

S pozdravem Jiří Pelc
Matematicko-fyzikální fakulta
Univerzita Karlova
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://d3s.mff.cuni.cz/pipermail/nswi004/attachments/20201030/521036e6/attachment.htm>


More information about the NSWI004 mailing list