Issue Details (XML | Word | Printable)

Key: PCC-367
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Pascal Stumpf
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

-fstack-protector on OpenBSD

Created: 02/Jul/11 06:00 PM   Updated: 05/Jul/11 10:24 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File pcc_ssp.diff (0.6 kB)

Environment: OpenBSD-current amd64


 Description  « Hide
Code compiled with stack protection fails to link on OpenBSD atm. pcc should use the functions provided as part of OpenBSD's libc, __guard and __stack_smash_handler. I don't really know what to do about __stack_chk_canary, though.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 02/Jul/11 06:09 PM
Have you verified that it works with the OpenBSD routines or must we rewrite something?
I\m not sure how this code works.

Pascal Stumpf added a comment - 02/Jul/11 06:29 PM
Yes, protection against a simple testcase works:


#include <stdio.h>

int
main()
{
        foo();
}

void
foo()
{
        char a[10];

        gets(a);
}

(with input > 10 characters). One would only have to add support for printing the function name to the syslog (__stack_smash_handler() can take the function name as first argument).

Iain Hibbert added a comment - 04/Jul/11 11:11 AM
except that the patch is wrong, please use

#ifdef os_openbsd

so that pcc can be cross-compiled correctly..

(in the long term, I would like to see such #ifdef removed from ccom,
perhaps replaced by a configure variable)

Anders Magnusson added a comment - 05/Jul/11 10:24 PM
Thanks, added (with the ifdef name change from Iain Hibbert).