<< Back to previous view

[PCC-367] -fstack-protector on OpenBSD Created: 02/Jul/11  Updated: 05/Jul/11

Status: Resolved
Project: pcc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Pascal Stumpf Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: OpenBSD-current amd64

File Attachments: File pcc_ssp.diff    

 Description   
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.

 Comments   
Comment by Anders Magnusson [ 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.
Comment by Pascal Stumpf [ 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).
Comment by Iain Hibbert [ 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)
Comment by Anders Magnusson [ 05/Jul/11 10:24 PM ]
Thanks, added (with the ifdef name change from Iain Hibbert).
Generated at Mon Nov 24 14:55:59 CET 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.