View previous topic :: View next topic |
Author |
Message |
quequero n00b
Joined: 03 Apr 2003 Posts: 29 Location: Italy
|
Posted: Mon Nov 28, 2005 9:58 pm Post subject: -fno-stack-protector |
|
|
Salve a tutti,
ho un piccolo e noioso problema che non riesco a risolvere ed avrei bisogno del vostro aiuto.
Ogni volta che provo a ricompilare le glibc ottengo questo errore:
Quote: |
cc1: error: unrecognized command line option "-fno-stack-protector"
|
Ho letto che si deve rimuovere l'use flag "vanilla" ed infatti nel mio make.conf e' disabilitato (con -vanilla) ed ho anche ricompilato gcc (con -vanilla e hardened) giusto per sicurezza. Per ricompilare le glibc utilizzo questo profilo:
Quote: |
[6] i686-pc-linux-gnu-3.4.4 *
|
Tuttavia anche ricompilando gcc con l'use "vanilla" (giusto per fare un test) non riesco a cavare ragno dal buco e cercando sul forum non ho proprio trovato altre soluzioni. Qualcuno puo' aiutarmi?
Grazie tante a tutti! _________________ -=Quequero=-
UIC Founder http://quequero.org
SpP/Member http://spippolatori.com |
|
Back to top |
|
|
shogun_panda Guru
Joined: 30 Jul 2004 Posts: 411 Location: Campobasso or Rome, Molise or Lazio, Italy, Europe, Earth, Solar system, Milk Way, Universe
|
Posted: Mon Nov 28, 2005 10:22 pm Post subject: Re: -fno-stack-protector |
|
|
quequero wrote: | Salve a tutti,
ho un piccolo e noioso problema che non riesco a risolvere ed avrei bisogno del vostro aiuto.
Ogni volta che provo a ricompilare le glibc ottengo questo errore:
Quote: |
cc1: error: unrecognized command line option "-fno-stack-protector"
|
Ho letto che si deve rimuovere l'use flag "vanilla" ed infatti nel mio make.conf e' disabilitato (con -vanilla) ed ho anche ricompilato gcc (con -vanilla e hardened) giusto per sicurezza. Per ricompilare le glibc utilizzo questo profilo:
Quote: |
[6] i686-pc-linux-gnu-3.4.4 *
|
Tuttavia anche ricompilando gcc con l'use "vanilla" (giusto per fare un test) non riesco a cavare ragno dal buco e cercando sul forum non ho proprio trovato altre soluzioni. Qualcuno puo' aiutarmi?
Grazie tante a tutti! |
Posta l'emerge info...Magari il problema è altrove... _________________ Greetings by the Shogun! - Home page
1-"Prima di dare consigli agli altri, sperimentateli su voi stessi..."
2-"In medio stat virtus!" |
|
Back to top |
|
|
quequero n00b
Joined: 03 Apr 2003 Posts: 29 Location: Italy
|
Posted: Tue Nov 29, 2005 12:11 am Post subject: |
|
|
Certo, ecco a te:
Quote: |
Portage 2.0.51.22-r3 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r2, 2.6.14.2 i686)
=================================================================
System uname: 2.6.14.2 i686 Pentium III (Katmai)
Gentoo Base System version 1.6.13
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [enabled]
dev-lang/python: 2.3.4-r1, 2.4.2
sys-apps/sandbox: 1.2.12
sys-devel/autoconf: 2.13, 2.59-r6
sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils: 2.15.92.0.2-r10
sys-devel/libtool: 1.5.20
virtual/os-headers: 2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -mtune=pentium3 -O3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium3 -mtune=pentium3 -O3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildpkg ccache distcc distlocks fixpackages sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="ftp://gentoo.inode.at/source/ http://www.mirror.ac.uk/sites/www.ibiblio.org/gentoo/ ftp://cs.ubishops.ca/pub/gentoo ftp://sunsite.ualberta.ca/pub/unix/Linux/gentoo ftp://ibiblio.org/pub/Linux/distributions/gento ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 acpi amuled bzip2 crypt expat gdbm hardened ipv6 md5sum mmx ncurses nls openssh pam pam_console pcre perl python readline sdl sse ssl truetype xml2 zlib userland_GNU kernel_linux elibc_glibc"
Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
|
Questi sono gli USE dal make.conf
Quote: |
USE="acpi amuled hardened md5sum mmx openssh pam_console sse -X -alsa -apm
-arts -avi -berkdb -bitmap-fonts -cups -eds -emboss -encode
-foomaticdb -fortran -gif -gnome -gpm -gstreamer -gtk -gtk2 -imlib
-jpeg -kde -libg++ -libwww -mad -mikmod -motif -mp3 -mpeg -ogg
-oggvorbis -opengl -oss -pdflib -png -qt -quicktime -spell -tcpd
-truetype-fonts -type1-fonts -udev -vanilla -vorbis -xmms -xv"
|
Ho anche disabilitato distcc... Nel caso che il problema provenisse da un altro compilatore all'interno
della rete ma niente da fare...
Grazie tante! _________________ -=Quequero=-
UIC Founder http://quequero.org
SpP/Member http://spippolatori.com |
|
Back to top |
|
|
randomaze Bodhisattva
Joined: 21 Oct 2003 Posts: 9985
|
Posted: Tue Nov 29, 2005 8:22 am Post subject: Re: -fno-stack-protector |
|
|
quequero wrote: |
Quote: |
cc1: error: unrecognized command line option "-fno-stack-protector"
|
|
Sembrerebbe che non viene valorizzata la prima parte del comando (che probabilmente sta in una variabile).
Ora, giusto per evitare di essere in una situazione simile proverei a ricompilare bash (con il gcc -vanilla). Non é detto che serva, ma male non fa
Puoi passarimi il link dove "hai letto"? Così gli do un occhio anche io.... _________________ Ciao da me! |
|
Back to top |
|
|
makoomba Bodhisattva
Joined: 03 Jun 2004 Posts: 1856
|
Posted: Tue Nov 29, 2005 9:57 am Post subject: |
|
|
posta gcc -v
edit:
anche equery uses gcc _________________ When all else fails, read the instructions. |
|
Back to top |
|
|
quequero n00b
Joined: 03 Apr 2003 Posts: 29 Location: Italy
|
Posted: Tue Nov 29, 2005 12:57 pm Post subject: |
|
|
Allora il link al post e' questo:
https://forums.gentoo.org/viewtopic-t-387353-highlight-fnostackprotector.html
Ma cercando "-fno-stack-protector" dicono tutti la stessa cosa.
Code: |
# gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with: /var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.4 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.4 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.4/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.4/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/include/g++-v3 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libmudflap --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.4 (Gentoo Hardened 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
|
e poi:
Code: |
# equery uses gcc
[ Searching for packages matching gcc... ]
[ Colour Code : set unset ]
[ Legend : Left column (U) - USE flags from make.conf ]
[ : Right column (I) - USE flags packages was installed with ]
[ Found these USE variables for sys-devel/gcc-3.4.4-r1 ]
U I
- - altivec : Adds support for optimizations for G4 and G5/ppc970 processors
- - bootstrap : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used during original system bootstrapping
- - build : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping.
- - fortran : Adds support for fortran (formally f77)
- - gcj : Enable building with gcj
- - gtk : Adds support for x11-libs/gtk+ (The GIMP Toolkit)
+ + hardened : activate default security enhancements for toolchain (gcc, glibc, binutils)
- - ip28 : Enable building a compiler capable of building a kernel for SGI Indigo2 Impact R10000 (IP28)
- - multilib : On 64bit systems, if you want to be able to compile 32bit and 64bit binaries
- - multislot : Allow for SLOTs to include minor version (3.3.4 instead of just 3.3)
- - n32 : Enable n32 ABI support on mips
- - n64 : Enable n64 ABI support on mips
+ + nls : <unknown>
- - nocxx : Disable support for C++ (DONT USE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)
- - objc : Build support for the Objective C code language
- - objc-gc : Build support for the Objective C code language Garbage Collector
- - vanilla : Do not add extra patches which change default behaviour
- - mudflap : Add support for mudflap, a pointer use checking library
- - nopie : Disable PIE support (NOT FOR GENERAL USE)
- - nossp : Disable SSP support (NOT FOR GENERAL USE)
- - boundschecking : add bounds checking patch by Haj Ten Brugge, this will DISABLE the hardened PIE+SSP patches
|
Ricompilare la bash non sembra aver risolto il problema purtroppo
Grazie di nuovo! _________________ -=Quequero=-
UIC Founder http://quequero.org
SpP/Member http://spippolatori.com |
|
Back to top |
|
|
randomaze Bodhisattva
Joined: 21 Oct 2003 Posts: 9985
|
Posted: Tue Nov 29, 2005 2:30 pm Post subject: |
|
|
quequero wrote: | + + hardened : activate default security enhancements for toolchain (gcc, glibc, binutils) |
Io proverei a disabilitare la USE hardened. Ma sarebbe un workaround/esperimento e non una soluzione definitiva _________________ Ciao da me! |
|
Back to top |
|
|
quequero n00b
Joined: 03 Apr 2003 Posts: 29 Location: Italy
|
|
Back to top |
|
|
.:chrome:. Advocate
Joined: 19 Feb 2005 Posts: 4588 Location: Brescia, Italy
|
Posted: Tue Nov 29, 2005 6:03 pm Post subject: Re: -fno-stack-protector |
|
|
-fno-stack-protector non esiste come opzine di GCC (versione 3.3). tu che versione hai?
ma soprattutto dove cacchio viene settata?
quequero wrote: | ho anche ricompilato gcc (con -vanilla e hardened) giusto per sicurezza |
hardened non è una flag che si deve impostare "tanto per fare" ed alla leggera.
anzi... non si importa per niente
viene ereditata quando si usa il profilo hardened. se non hai il profilo hardened rischi solo di fare danni. in generale è una flag che l'utente non dovrebbe mai toccare. |
|
Back to top |
|
|
quequero n00b
Joined: 03 Apr 2003 Posts: 29 Location: Italy
|
Posted: Tue Nov 29, 2005 6:15 pm Post subject: |
|
|
Come no, -fno-stack-protector viene aggiunta da ssp e fa parte di gcc sia 3.3 che 3.4!
E come puoi vedere dal mio gcc -v la ssp e' stata inclusa correttamente... Il mistero e'
perche' le libc non lo trovino anche usando -vanilla... Non riesco a veramente a capirne
il motivo :/
Grazie dell'aiuto di nuovo _________________ -=Quequero=-
UIC Founder http://quequero.org
SpP/Member http://spippolatori.com |
|
Back to top |
|
|
.:chrome:. Advocate
Joined: 19 Feb 2005 Posts: 4588 Location: Brescia, Italy
|
Posted: Tue Nov 29, 2005 6:52 pm Post subject: |
|
|
ma... non ho ancora capito... tu stai usando un profilo hardened o no?
a cosa punta /etc/make.profile?
se non stai usando il profilo hardened non è affatto normale che tu abbia quelle variabili |
|
Back to top |
|
|
quequero n00b
Joined: 03 Apr 2003 Posts: 29 Location: Italy
|
Posted: Tue Nov 29, 2005 7:20 pm Post subject: |
|
|
Dunque il profilo e':
Quote: |
# ls -l /etc/make.profile
lrwxrwxrwx 1 root root 48 Apr 16 2005 /etc/make.profile -> ../usr/portage/profiles/default-linux/x86/2005.0
|
Ma non trovo nulla di strano nell'avere gcc con le patch per l'hardening (oddio magari e' strano vederle
nel gcc -v anche se il gcc-profile in uso non e' hardened).
Su tutte le macchine della lan che NON usano il profilo hardened i profili per gcc che ho sono:
Quote: |
[1] i686-pc-linux-gnu-3.4.4 *
[2] i686-pc-linux-gnu-3.4.4-hardened
[3] i686-pc-linux-gnu-3.4.4-hardenednopie
[4] i686-pc-linux-gnu-3.4.4-hardenednopiessp
[5] i686-pc-linux-gnu-3.4.4-hardenednossp
|
Uhm sei proprio sicuro che queste opzioni non debbano esser presenti? Perche' se cosi fosse avrei
toppato grosso a configurare un bel po' di pc, ma mi pare strano :/
Semmai provo a postare nel gentoo forum intenazionale, vediamo che mi dicono, fammi sapere se hai
altri suggerimenti, grazie! _________________ -=Quequero=-
UIC Founder http://quequero.org
SpP/Member http://spippolatori.com |
|
Back to top |
|
|
makoomba Bodhisattva
Joined: 03 Jun 2004 Posts: 1856
|
Posted: Tue Nov 29, 2005 7:32 pm Post subject: |
|
|
beh, un pò di casino c'è, non si nega.
imposta il profilo hardened e prova a ricompilare le glibc _________________ When all else fails, read the instructions. |
|
Back to top |
|
|
.:chrome:. Advocate
Joined: 19 Feb 2005 Posts: 4588 Location: Brescia, Italy
|
Posted: Tue Nov 29, 2005 10:41 pm Post subject: |
|
|
quequero wrote: | non trovo nulla di strano nell'avere gcc con le patch per l'hardening (oddio magari e' strano vederle
nel gcc -v anche se il gcc-profile in uso non e' hardened). |
errore. gravissimo errore
la flag hardened come ti dicevo è ereditata dal profilo hardened, e non deve essere mai impostata dall'utente.
il motivo di questo? vedilo con i tuoi occhi: fai un sync, cambia il profilo in hardened, e poi fai un emerge -uDN world -ptv.
a quanto punto guarda quanti e quali pacchetti verranno ricompilati e con quali flag.
un profilo hardened per glibc implica un pesante cambiamento del metodo di indirizzamento ed allocazione della memoria (per citare solo uno dei cambiamenti), e se queste modifiche non vengono opportunamente propagate in tutto il sistema nessuno può garantire il corretto funzionamento di nessun software.
la prossima volta, prima di giocare con le flag, verifica di poterlo fare. sono certo di aver letto da qualche parte (forse nella documentazione di glibc) quello che tiho appena scritto.
permettimi poi un commento sul compilatore: hai notato che gcc-3.4.4 è considerato stabile su alcune architetture, ma non sulla x86, che tu usi? se mi parli di server, di rete, di sistemi hardened, io penso a macchine in produzione, e cambiare gcc per una versione non considerata stabile su una macchina in produzione, mi pare una pratica abbastanza stupida.
questo per avere cosa? un guadagno di qualche secondo nella compilazione di codice ad oggetti? |
|
Back to top |
|
|
quequero n00b
Joined: 03 Apr 2003 Posts: 29 Location: Italy
|
Posted: Wed Nov 30, 2005 2:51 am Post subject: |
|
|
Forse qui si sta facendo un sacco di rumore per nulla, puo' anche darsi che mi sbagli
ma _emerge -B glibc_ di sicuro non puo' far male al sistema... Quindi non venirmi a dire
di non giocare coi flag quando stavo semplicemente vedendo se il pacchetto veniva
compilato, d'accordo che non trovo soluzione al problema ma questo non vuol dire che
sono fresco di Gentoo... Negli anni qualcosa credo (spero) di averla imparata.
Il problema e' che pur non utilizzando un profilo hardened, e pur avendo le opzioni di
ssp in gcc, le glibc non se ne accorgono.
A mano riesco a compilare correttamente con tutte le opzioni di ssp:
Code: |
# gcc -fno-stack-protector -fno-stack-protector-all main.c -o main
# ./main
Funziono!
|
Un'altra cosa che faccio notare e' che -fno DISABILITA la feature di ssp, motivo per cui
non c'e' alcun pericolo nel ricompilare ed installare (cosa che comunque NON ho fatto) le
glibc. Ora torno alla domanda originale: perche' le glibc non trovano l'opzione per disabilitare
ssp mentre a mano tutto funziona senza alcun problema? Tutto qui!
Domani provo anche ad utilizzare il gcc 3.3 cosi vi faccio sapere se il problema era il
compilatore.
Grazie di nuovo _________________ -=Quequero=-
UIC Founder http://quequero.org
SpP/Member http://spippolatori.com |
|
Back to top |
|
|
|