Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22055

Is using canaries for bss or data-sections to detect overflows/smashing useful?

$
0
0

In our GCC-based C embedded system we are using the -ffunction-sections and -fdata-sections options to allow the linker, when linking the final executable, to remove unused (unreferenced) sections. This works well since years.

In the same system most of the data-structures and buffers are allocated statically (often as static-variables at file-scope).

Of course we have bugs, sometimes nasty ones, where we would like to quickly exclude the possibility of buffer-overflows.

One idea we have is to place canaries in between each bss-section and data-section - each one presenting exactly one symbol (because of -fdata-sections). Like the compiler is doing for functions-stacks when Stack-Smashing and StackProtection is activated. Checking these canaries could be done from the host by reading the canary-addresses "from time to time".

It seems that modifying the linker-script (placing manually the section and adding a canary-word in between) seems feasible, but does it make sense?

Is there a project or an article in the wild? Using my keywords I couldn't find anything.


Viewing all articles
Browse latest Browse all 22055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>