Opened 11 years ago

Last modified 7 years ago

#742 closed defect (Fixed)

tor cannot be compiled on recent gcc wth fortify option

Reported by: misc Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.1.2.19
Severity: Keywords:
Cc: misc, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Using gcc 4.3.1, tor cannot be compiled, and show this error :

gcc -DHAVE_CONFIG_H -I. -I../.. -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables -I/usr/kerberos/include -Wall -g -O2 -MT crypto.o -MD -MP -MF .deps/crypto.Tpo -c -o crypto.o crypto.c
In function 'open',

inlined from 'finish_daemon' at util.c:2073:

/usr/include/bits/fcntl2.h:51: erreur: call to 'open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
mv -f .deps/compat.Tpo .deps/compat.Po

it seems to be a well know problem ( https://hardened.gentooexperimental.org/secure/ticket/29 ) due to some laxism in previous glibc and gcc.

Since the code around line 2073 of util.c is just trying to open /dev/null with O_CREAT, i think we can safely remove the flag from the argument.

Morever, if /dev/null do not exist, we should not create it as a simple file, so this is better to abort in case of problem.

[Automatically added by flyspray2trac: Operating System: Other Linux]

Child Tickets

Attachments (1)

tor-0.1.2.19.gcc_fortify.patch (0 bytes) - added by misc 11 years ago.
patch against latest stable release

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by misc

patch against latest stable release

comment:1 Changed 11 years ago by misc

This patch is against the latest release, but the code din't changed in subversion. The patch only remove O_CREATE, and was applied in latest tor package in mandriva developpement version, as tor was not compilable otherwise.

comment:2 Changed 11 years ago by nickm

Wow. This bug has been in Tor since 0.0.2pre19. That's one of the oldest ones in a while. Thanks!

comment:3 Changed 11 years ago by nickm

Fix applied in trunk, 0.2.0 branch, and 0.1.2 branch.

comment:4 Changed 11 years ago by nickm

flyspray2trac: bug closed.

comment:5 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.