[NSWI004] How to cause segmentation fault.

Jura Pelc jirik.pelc1998 at gmail.com
Fri Oct 30 19:23:04 CET 2020


That's precisely that what I missed. Thanks.

pá 30. 10. 2020 v 19:12 odesílatel Petr Tuma <petr.tuma at d3s.mff.cuni.cz>
napsal:

> Hi,
>
> 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 ?
>
> Petr
>
>
> On 30/10/2020 18:55, Jura Pelc wrote:
> > 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 <
> 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
> >
> > _______________________________________________
> > NSWI004 mailing list
> > NSWI004 at d3s.mff.cuni.cz
> > https://d3s.mff.cuni.cz/mailman/listinfo/nswi004
> >
>


-- 

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/7068824d/attachment.htm>


More information about the NSWI004 mailing list