Liste des Groupes | Revenir à cl c |
On Fri, 13 Jun 2025 09:21 pozz wrote:
However this strategy assumes you already know there's some
instruction that write to the array at an out-of-bound position.
Yes, though I see Kaz's idea is to proactively protect all memory used
by the program. It's an interesting concept, though not particularly
practical.
I think the situation of the original post is different. His program
crashed infrequently, very infrequently, and he didn't know anything
about the cause. I think it was a very big effort to link the crash
to the array (in another source module) and to the out-of-bound
access of the array.
You are spot on indeed. Huge program with lots of modules, processing
millions of data entries every minute. Realizing that the issue was an
out of bounds situation was challenging because the symptoms were in a
totally different part of the program. Very confusing.
Hence why I was wondering if there is any way to make invalid memory
accesses *within the same program* generate a segfault, so next time I
have to deal with such self-sabotaging program I know at least which
module (compilation unit) to look at. Since then I learned that:
- There is no readily available mechanism for this today on x86
- CHERI shows great promise, possibly in the coming years
- mprotect() can offer some degree of protection but must be used
carefully, as it primarily safeguards against writes in general rather
than restricting which parts of the code can access memory
Mateusz
Les messages affichés proviennent d'usenet.