xref: /illumos-gate/usr/src/lib/ssp_ns/common/ssp_ns.c (revision 6a817834)
1*6a817834SRobert Mustacchi /*
2*6a817834SRobert Mustacchi  * This file and its contents are supplied under the terms of the
3*6a817834SRobert Mustacchi  * Common Development and Distribution License ("CDDL"), version 1.0.
4*6a817834SRobert Mustacchi  * You may only use this file in accordance with the terms of version
5*6a817834SRobert Mustacchi  * 1.0 of the CDDL.
6*6a817834SRobert Mustacchi  *
7*6a817834SRobert Mustacchi  * A full copy of the text of the CDDL should have accompanied this
8*6a817834SRobert Mustacchi  * source.  A copy of the CDDL is also available via the Internet at
9*6a817834SRobert Mustacchi  * http://www.illumos.org/license/CDDL.
10*6a817834SRobert Mustacchi  */
11*6a817834SRobert Mustacchi 
12*6a817834SRobert Mustacchi /*
13*6a817834SRobert Mustacchi  * Copyright 2020 Oxide Computer Company
14*6a817834SRobert Mustacchi  */
15*6a817834SRobert Mustacchi 
16*6a817834SRobert Mustacchi #include <sys/ccompile.h>
17*6a817834SRobert Mustacchi 
18*6a817834SRobert Mustacchi /*
19*6a817834SRobert Mustacchi  * To impement gcc's stack protector library, the compiler emits a function call
20*6a817834SRobert Mustacchi  * to a symbol which can be called absolutely. As a result, to make that happen,
21*6a817834SRobert Mustacchi  * we mimic what gcc does with libssp and create an archive file that can be
22*6a817834SRobert Mustacchi  * used in the specs file to pull this in directly. This is a bit of a pain, but
23*6a817834SRobert Mustacchi  * that's the best we can do given the architecture that we have.
24*6a817834SRobert Mustacchi  *
25*6a817834SRobert Mustacchi  * Warning: This is a static archive. Nothing beyond the call for
26*6a817834SRobert Mustacchi  * __stack_chk_fail_local and calls to committed interfaces should be here. As
27*6a817834SRobert Mustacchi  * this implementation will be linked into programs, one should exercise care to
28*6a817834SRobert Mustacchi  * make sure we don't expose anything else here.
29*6a817834SRobert Mustacchi  */
30*6a817834SRobert Mustacchi 
31*6a817834SRobert Mustacchi extern void __stack_chk_fail(void);
32*6a817834SRobert Mustacchi 
33*6a817834SRobert Mustacchi void __HIDDEN
__stack_chk_fail_local(void)34*6a817834SRobert Mustacchi __stack_chk_fail_local(void)
35*6a817834SRobert Mustacchi {
36*6a817834SRobert Mustacchi 	__stack_chk_fail();
37*6a817834SRobert Mustacchi }
38