On 7/30/24 16:46, Jonathan M. Wilbur wrote:
Hello,

I recently pushed a commit (e4d874d88a2ef874a9c2fd7c47d3d3a35ae986e2) that fixes code being placed in ELF sections that do not have the executable bit set. This happens when a function is annotated with __attribute__((section(".some_section"))), or when a section is defined via inline assembly. In the latter case, it is assumed that the inline assembly actually contains code, which will not always be the case, but should be the case the vast majority of the time. When the instruction pointer points to code in a non-executable section, a segmentation fault occurs.

I have included two files that recreate both of these bugs in tests/exec_section_in_c.c and tests/exec_section_in_asm.c. The patch is included on this email.

If anybody has any feedback, I would be curious to know if the blind addition of the executable flag to sections defined in assembly will be a problem: particularly if there is widespread usage of the writeable flag for these, which might elicit segmentation faults from the combined use of the writeable and executable flags for the same page.

Same as previous mail:

You probably did not run 'make test'.

Tests should go into 'tests/tests2' directory.

Some tests do not run.

Looks like you have to revert the patch.
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to