Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#52232 - [gcc-multilib] "stack-protector" options are ignored

Attached to Project: Community Packages
Opened by Constantine (Hi-Angel) - Thursday, 22 December 2016, 09:29 GMT
Last edited by Levente Polyak (anthraxx) - Thursday, 22 December 2016, 11:13 GMT
Task Type Bug Report
Category Packages: Multilib
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
I don't know if the problem is upstream or downstream, so I'm reporting here.


Additional info:
* package version(s) 6.2.1-1

Steps to reproduce:

$ cat test.c
void test(const char* from, char* to, int n) {
for(int i=0; i<n; ++i)
to[i] = from[i];
}
$ gcc test.c -c -O0 -fno-stack-protector -o test-fno.o
$ gcc test.c -c -O0 -fstack-protector -o test-fyes.o
$ gcc test.c -c -O0 -fstack-protector-strong -o test-fstrong.o
$ md5sum *.o
549c76421fa3e2b62d4e26c69e7e6678 test-fno.o
549c76421fa3e2b62d4e26c69e7e6678 test-fstrong.o
549c76421fa3e2b62d4e26c69e7e6678 test-fyes.o
This task depends upon

Closed by  Levente Polyak (anthraxx)
Thursday, 22 December 2016, 11:13 GMT
Reason for closing:  Not a bug
Comment by Levente Polyak (anthraxx) - Thursday, 22 December 2016, 10:39 GMT
that will only have a stack protector when using -fstack-protector-all. The checks require a function local character array and uses the value of ssp-buffer-size (plus some other stuff on fstack-protector-strong) to determine if a canary check should be included. this is expected behavior in your test case.
Comment by Constantine (Hi-Angel) - Thursday, 22 December 2016, 10:51 GMT
Oh, indeed, confirming:

$ cat test.c
#include <stdlib.h>

char* test(const char* from, int n) {
char* buf = malloc(n);
for(int i=0; i<n; ++i)
buf[i] = from[i];
return buf;
}
$ gcc test.c -c -O0 -fno-stack-protector -o test-fno.o
$ gcc test.c -c -O0 -fstack-protector -o test-fyes.o
$ gcc test.c -c -O0 -fstack-protector-strong -o test-fstrong.o
$ md5sum *.o
72d9f80f0155b01d89a460adbf0097bf test-fno.o
da8f63de238338abc28a97717da486a2 test-fstrong.o
da8f63de238338abc28a97717da486a2 test-fyes.o

Btw, experiment shows: gcc defaults to "fno-stack-protector" which is what I actually wanted to know :ะท

I'm sorry. How do I close the bug?
Comment by Levente Polyak (anthraxx) - Thursday, 22 December 2016, 11:13 GMT
you could request a closure above, but i can do it :)

Loading...