This is not an eclass issue. For systems where -fstack-check is enabled, it is done through a gcc specfile. This has the advantage of applying to all compiled output, regardless of whether the compiler is run by Portage or whether the ebuild respects CC, CFLAGS, etc. Unfortunately, this leads to:proteusx wrote:Does anyone know if -fstack-check is set for non-hardened profiles?
These things are now buried under layers of labyrinthine eclasses.
Not easy to tell what is happening.
Nice idea, but incorrect implementation. Since the feature is done through the specfile, you will not see it on the command line even when it is active.Tony0945 wrote:All I can think of is a local ebuild that compiles something innocuous like "main(){exit(0);}" and looking at the screen output.
EDIT:Froze an emerge with CTRL-S Found this lineCode: Select all
x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe -fno-strict-aliasing -Wstrict-prototypes -Wall -D_GNU_SOURCE -c ping.c -DUSE_OPENSSL -o ping.o
You can pass a variable (I believe it is just V=1) to tell the kernel build system to show the full command line. However, as above, you won't see -fstack-check on the command line.Tony0945 wrote:There is a new kernel so I'll compile that too and try to catch the gcc lines, If you are not upgrading a kernel you can always rebuild your current kernel.
EDIT2:
Kernel compiles with stuff likeI have no idea what's buried in the CC macro. Hopefully, someone more adept than I knows how to expand it.Code: Select all
CC drivers/acpi/acpica/utxferror.o
To check whether your gcc defaults to using -fstack-check, you can use gcc -dumpspecs to show the full specfile (and try to parse that language to answer the question), or you can compile a trivial C program to assembly and inspect whether gcc includes in the assembly the typical stack check prologue.
Code: Select all
$ cat a.c
void f()
{
}
$ gcc-7.2.0 -O2 -no-pie -S -o - a.c
.file "a.c"
.text
.p2align 4,,15
.globl f
.type f, @function
f:
.LFB0:
.cfi_startproc
subq $4152, %rsp
orq $0, (%rsp)
addq $4128, %rsp
.cfi_def_cfa_offset 32
movq %fs:40, %rax
movq %rax, 8(%rsp)
xorl %eax, %eax
movq 8(%rsp), %rax
xorq %fs:40, %rax
jne .L5
addq $24, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L5:
.cfi_restore_state
call __stack_chk_fail@PLT
.cfi_endproc
.LFE0:
.size f, .-f
.ident "GCC: (Gentoo Hardened 7.2.0 p1.1) 7.2.0"
.section .note.GNU-stack,"",@progbits
Code: Select all
$ gcc-7.2.0 -O2 -no-pie -S -o - a.c -fno-stack-check
.file "a.c"
.text
.p2align 4,,15
.globl f
.type f, @function
f:
.LFB0:
.cfi_startproc
subq $24, %rsp
.cfi_def_cfa_offset 32
movq %fs:40, %rax
movq %rax, 8(%rsp)
xorl %eax, %eax
movq 8(%rsp), %rax
xorq %fs:40, %rax
jne .L5
addq $24, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L5:
.cfi_restore_state
call __stack_chk_fail@PLT
.cfi_endproc
.LFE0:
.size f, .-f
.ident "GCC: (Gentoo Hardened 7.2.0 p1.1) 7.2.0"
.section .note.GNU-stack,"",@progbits




