Bitcoin Forum
April 18, 2024, 10:01:49 AM
Welcome,
Guest
. Please
login
or
register
.
News
: Latest Bitcoin Core release:
26.0
[
Torrent
]
Home
Help
Search
Login
Register
More
Bitcoin Forum
>
Bitcoin
>
Development & Technical Discussion
>
GCC recommendation: -fstack-protector
Pages:
«
1
[
2
]
All
« previous topic
next topic »
Print
Author
Topic: GCC recommendation: -fstack-protector (Read 4670 times)
Matt Corallo
Hero Member
Offline
Activity: 755
Merit: 515
Re: GCC recommendation: -fstack-protector
July 12, 2011, 06:32:14 PM
#21
Quote from: John Smith on July 12, 2011, 06:19:43 PM
Huh, I understood that there is already a pull request for it, and it was planned to be integrated.
That was the plan, but the guy who wrote it has given up communicating and updating it with various suggestions. Its also (from what I hear from people with more autotools experience) very poorly coded. So it sits in a "there is no way we are going to pull this, please update it" state.
Bitcoin Core, rust-lightning,
http://bitcoinfibre.org
etc.
PGP ID: 07DF 3E57 A548 CCFB 7530 7091 89BB B866
3E2E65CE
1713434509
Hero Member
Offline
Posts: 1713434509
Ignore
1713434509
1713434509
#2
1713434509
Report to moderator
[BPIP] Who are your biggest merit fans? Who do you send all of your sMerit to? ..
Do you.. MATR?? O_o
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713434509
Hero Member
Offline
Posts: 1713434509
Ignore
1713434509
1713434509
#2
1713434509
Report to moderator
gmaxwell
Moderator
Legendary
Offline
Activity: 4158
Merit: 8382
Re: GCC recommendation: -fstack-protector
July 18, 2011, 01:26:51 AM
#22
It's probably worth mentioning that the default static linking defeats ASLR, ... which is probably a more important security enhancement than -fstack-protector.
The default build should probably not statically link— if you've got the libraries then you can dynamically link them. It should also be compiled -pie -fPIE.
There appears to be good general hardening advice here:
http://wiki.debian.org/Hardening
Matt Corallo
Hero Member
Offline
Activity: 755
Merit: 515
Re: GCC recommendation: -fstack-protector
July 18, 2011, 02:16:01 AM
#23
Quote from: gmaxwell on July 18, 2011, 01:26:51 AM
The default build should probably not statically link
Oh god how I'd love to not have to static link anything or build anything for Linux anymore. But as it stands now, thats not really an option. First, we use a development release of wx, meaning it is in no package repos anywhere so you cant require people to install that. Secondly, we use ECC which is stripped out of openssl on all redhat-based distros due to copyright concerns. Lastly, we don't have distro-packages so there is no way for us to create package dependencies for bitcoin aside from instillation instructions which gets very, very user unfriendly. When we make a switch to QT all that can go away and we can get into distro packages for everything (except redhat-based distros...). If you are talking about on windows, well, what other option is there? Either you ship your own libraries, in which case the argument is invalid, or you ship static, like every other sane program on Windows. Windows just doesn't have a way to get dependencies like Linux (really a shame, you'd think after this many years Microsoft and Apple could have caught up with Linux on this one).
Quote from: gmaxwell on July 18, 2011, 01:26:51 AM
It should also be compiled -pie -fPIE.
There appears to be good general hardening advice here:
http://wiki.debian.org/Hardening
By all means, pull request away
Bitcoin Core, rust-lightning,
http://bitcoinfibre.org
etc.
PGP ID: 07DF 3E57 A548 CCFB 7530 7091 89BB B866
3E2E65CE
wumpus
Hero Member
Offline
Activity: 812
Merit: 1022
No Maps for These Territories
Re: GCC recommendation: -fstack-protector
July 18, 2011, 02:43:13 AM
Last edit: July 18, 2011, 03:11:07 AM by John Smith
#24
It's indeed a good thing to static-link the distributed binaries. Nearly all projects that distribute distribution-agnostic binaries for Linux distribute a statically-linked version. The remaining ones package the .so's, as a poor-mans static linking
On the other hand, when building from source (and building distribution-specific) it doesn't have to default to static linking (and can include all the PIE you want :p). That's currently just an artifact of the inflexibility of "make". As mentioned, a configurable build system like autotools would address this by providing options such as --with-static.
BTW here some links about the PIE thing, I found it pretty interesting:
https://secure.wikimedia.org/wikipedia/en/wiki/Position-independent_code
https://wiki.ubuntu.com/Security/Features#Built%20as%20PIE
Most notably:
"PIE has a large (5-10%) performance penalty on architectures with small numbers of general registers (e.g. x86), ... PIE on x86_64 does not have the same penalties, and will eventually be made the default, but more testing is required"
So it should probably be enabled by default for x86_64 but not x86_32.
Bitcoin Core developer
[PGP]
Warning:
For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through
File
→
Backup Wallet
to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
gmaxwell
Moderator
Legendary
Offline
Activity: 4158
Merit: 8382
Re: GCC recommendation: -fstack-protector
July 18, 2011, 04:05:12 AM
#25
Quote from: John Smith on July 18, 2011, 02:43:13 AM
On the other hand, when building from source (and building distribution-specific) it doesn't have to default to static linking (and can include all the PIE you want :p). That's currently just an artifact of the inflexibility of "make". As mentioned, a configurable build system like autotools would address this by providing options such as --with-static.
Right, this was what I meant. Obviously the shipped binaries will need to be statically linked, alas. Thats still no reason to leave everyone else statically linked.
You don't need autotools for this: just add another target "make static-dist", or whatever.
For me, on Fedora, the static builds fail because the distribution doesn't ship with static versions of pretty much _anything_ because the overuse of static libraries has been a reoccurring security nightmare. So, really, for some people the failure to separate static and not static builds means that building simply doesn't work.
Oh, while we're talking about this— it was claimed upthread that bitcoin should already have -fstack-protector — I don't know about Ubuntu, but in fedora -fstack-protector is set via the default RPM cflags, and _not_ by modifying GCC. If the same is true on ubuntu, then bitcoind doesn't have it. Someone with ubuntu handy ought to compile the examples from that debian page and see if gcc in ubuntu is really providing the protection by default.
Quote
Most notably:
"PIE has a large (5-10%) performance penalty on architectures with small numbers of general registers (e.g. x86), ... PIE on x86_64 does not have the same penalties, and will eventually be made the default, but more testing is required"
So it should probably be enabled by default for x86_64 but not x86_32.
This is only the case for tight loop register starved cpu bound code. Bitcoin is usually I/O bound. I've been running bitcoin in _valgrind_ (which run most things things at 1/10th to 1/20th speed) and hardly notice any difference except while syncing up the blockchain.
I'm seriously doubtful that PIE is going to make a noticeable performance difference. Also, the libraries on any system are all already fpic, and all the crypto stuff is already in libraries, Moreover, there is a pretty easy answer to someone who wants more performance: use x86_64, which is generally true (esp for C++ code) with or without PIE.
wumpus
Hero Member
Offline
Activity: 812
Merit: 1022
No Maps for These Territories
Re: GCC recommendation: -fstack-protector
July 18, 2011, 04:52:13 AM
#26
Quote from: gmaxwell on July 18, 2011, 04:05:12 AM
Moreover, there is a pretty easy answer to someone who wants more performance: use x86_64, which is generally true (esp for C++ code) with or without PIE.
One would think that it is mainly the 32-bit systems that need every bit of extra performance
The only place in which performance matters, indeed, is the initial sync-up with the block chain. After that, traffic is so low that crypto speed doesn't matter much.
And I wouldn't be surprised either if much of the slowless on initial block chain download was caused by disk access, not CPU load. I once tried to bootstrap bitcoin on an USB stick. Bad idea
Quote from: gmaxwell on July 18, 2011, 04:05:12 AM
You don't need autotools for this: just add another target "make static-dist", or whatever.
Feel free to send a pull request.
Bitcoin Core developer
[PGP]
Warning:
For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through
File
→
Backup Wallet
to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
bcearl
(OP)
Full Member
Offline
Activity: 168
Merit: 103
Re: GCC recommendation: -fstack-protector
August 06, 2011, 11:54:57 AM
#27
Quote from: Matt Corallo on July 12, 2011, 06:16:58 PM
We do, we use make. For our purposes, it works fine if you have a sane build environment.
An environment with uupnp is not sane.
Misspelling protects against dictionary attacks NOT
Pages:
«
1
[
2
]
All
Print
Bitcoin Forum
>
Bitcoin
>
Development & Technical Discussion
>
GCC recommendation: -fstack-protector
« previous topic
next topic »
Jump to:
Please select a destination:
-----------------------------
Bitcoin
-----------------------------
=> Bitcoin Discussion
===> Legal
===> Press
===> Meetups
===> Important Announcements
=> Development & Technical Discussion
===> Wallet software
=====> Electrum
=====> Bitcoin Wallet for Android
=====> BitcoinJ
=====> Armory
=====> Mycelium
=====> Hardware wallets
=> Mining
===> Mining support
===> Pools
===> Mining software (miners)
===> Hardware
=====> Group buys
===> Mining speculation
=> Bitcoin Technical Support
=> Project Development
-----------------------------
Economy
-----------------------------
=> Economics
===> Speculation
=> Marketplace
===> Goods
=====> Computer hardware
=====> Digital goods
=======> Invites & Accounts
=====> Collectibles
===> Services
===> Currency exchange
===> Gambling
=====> Games and rounds
=====> Investor-based games
=====> Gambling discussion
===> Lending
=====> Long-term offers
===> Securities
===> Auctions
===> Service Announcements
=====> Micro Earnings
===> Service Discussion
=====> Web Wallets
=====> Exchanges
=> Trading Discussion
===> Scam Accusations
===> Reputation
-----------------------------
Other
-----------------------------
=> Meta
===> New forum software
===> Bitcoin Wiki
=> Politics & Society
=> Beginners & Help
=> Off-topic
=> Serious discussion
===> Ivory Tower
=> Archival
===> Корзина
===> CPU/GPU Bitcoin mining hardware
===> Chinese students
===> Obsolete (buying)
===> Obsolete (selling)
===> MultiBit
-----------------------------
Alternate cryptocurrencies
-----------------------------
=> Altcoin Discussion
=> Announcements (Altcoins)
===> Tokens (Altcoins)
=> Mining (Altcoins)
===> Pools (Altcoins)
=> Marketplace (Altcoins)
===> Service Announcements (Altcoins)
===> Service Discussion (Altcoins)
===> Bounties (Altcoins)
=> Speculation (Altcoins)
-----------------------------
Local
-----------------------------
=> العربية (Arabic)
===> العملات البديلة (Altcoins)
=====> النقاشات
===> إستفسارات و أسئلة المبتدئين
===> التعدين
===> النقاشات الأخرى
===> منصات التبادل
=> Bahasa Indonesia (Indonesian)
===> Marketplace (Bahasa Indonesia)
===> Mining (Bahasa Indonesia)
===> Altcoins (Bahasa Indonesia)
===> Trading dan Spekulasi
===> Ekonomi, Politik, dan Budaya
===> Topik Lainnya
=> Español (Spanish)
===> Mercado y Economía
=====> Servicios
=====> Trading y especulación
===> Hardware y Minería
===> Esquina Libre
===> Mercadillo
=====> Mexico
=====> Argentina
=====> España
=====> Centroamerica y Caribe
===> Primeros pasos y ayuda
===> Altcoins (criptomonedas alternativas)
=====> Minería de altcoins
=====> Servicios
=====> Tokens (Español)
=> 中文 (Chinese)
===> 跳蚤市场
===> 山寨币
===> 媒体
===> 挖矿
===> 离题万里
=> Hrvatski (Croatian)
===> Trgovina
===> Altcoins (Hrvatski)
=====> Announcements (Hrvatski)
===> Off-topic (Hrvatski)
=> Deutsch (German)
===> Anfänger und Hilfe
===> Mining (Deutsch)
===> Trading und Spekulation
===> Projektentwicklung
===> Off-Topic (Deutsch)
===> Treffen
===> Presse
===> Altcoins (Deutsch)
=====> Announcements (Deutsch)
===> Marktplatz
=====> Auktionen
=====> Suche
=====> Biete
=> Ελληνικά (Greek)
===> Αγορά
===> Mining Discussion (Ελληνικά)
===> Altcoins (Ελληνικά)
=====> Altcoin Announcements (Ελληνικά)
=====> Altcoin Mining (Ελληνικά)
=> עברית (Hebrew)
=> Français
===> Actualité et News
===> Débutants
===> Discussions générales et utilisation du Bitcoin
===> Mining et Hardware
===> Économie et spéculation
===> Place de marché
=====> Échanges
=====> Produits et services
=====> Petites annonces
===> Le Bitcoin et la loi
===> Wiki, documentation et traduction
===> Développement et technique
===> Vos sites et projets
===> Hors-sujet
===> Altcoins (Français)
=====> Annonces
=> India
===> Mining (India)
===> Marketplace (India)
===> Regional Languages (India)
===> Press & News from India
===> Alt Coins (India)
===> Buyer/ Seller Reputations (India)
===> Off-Topic (India)
=> Italiano (Italian)
===> Guide (Italiano)
===> Progetti
===> Discussioni avanzate e sviluppo
===> Trading, analisi e speculazione
===> Mercato
=====> Mercato valute
=====> Beni
=====> Servizi
=====> Esercizi commerciali
=====> Hardware/Mining (Italiano)
=====> Gambling (Italiano)
===> Accuse scam/truffe
===> Mining (Italiano)
===> Alt-Currencies (Italiano)
=====> Annunci
===> Raduni/Meeting (Italiano)
===> Crittografia e decentralizzazione
===> Off-Topic (Italiano)
=> 日本語 (Japanese)
===> アルトコイン
=> Nederlands (Dutch)
===> Markt
===> Gokken/lotterijen
===> Mining (Nederlands)
===> Beurzen
===> Alt Coins (Nederlands)
===> Off-topic (Nederlands)
===> Meetings (Nederlands)
=> Nigeria (Naija)
=> 한국어 (Korean)
===> 대체코인 Alt Coins (한국어)
=> Pilipinas
===> Altcoins (Pilipinas)
=====> Altcoin Announcements (Pilipinas)
===> Pamilihan
===> Others (Pilipinas)
=> Polski
===> Tablica ogłoszeń
===> Alternatywne kryptowaluty
=====> Nowe kryptowaluty i tokeny
=====> Tablica ogłoszeń (altcoiny)
=> Português (Portuguese)
===> Primeiros Passos (Iniciantes)
===> Economia & Mercado
===> Mineração em Geral
===> Desenvolvimento & Discussões Técnicas
===> Criptomoedas Alternativas
===> Brasil
===> Portugal
=> Русский (Russian)
===> Новички
===> Бизнес
=====> Барахолка
=====> Обменники
===> Идеи
===> Кодеры
===> Майнеры
===> Политика
===> Трейдеры
===> Альтернативные криптовалюты
=====> Токены
=====> Бayнти и aиpдpoпы
===> Хайпы
===> Работа
===> Разное
===> Oбcyждeниe Bitcoin
=====> Новости
=====> Юристы
=> Română (Romanian)
===> Anunturi importante
===> Offtopic
===> Market
=====> Discutii Servicii
===> Minerit
===> Tutoriale
===> Bine ai venit!
===> Presa
===> Altcoins (Monede Alternative)
=====> Anunturi Monede Alternative
=> Skandinavisk
=> Türkçe (Turkish)
===> Bitcoin Haberleri
===> Pazar Alanı
===> Madencilik
===> Ekonomi
===> Servisler
=====> Fonlar
===> Proje Geliştirme
===> Alternatif Kripto-Paralar
=====> Madencilik (Alternatif Kripto-Paralar)
=====> Duyurular (Alternatif Kripto-Paralar)
===> Konu Dışı
===> Yeni Başlayanlar & Yardım
===> Buluşmalar
=> Other languages/locations
Loading...