Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2015 17:12:39 +0200
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        Pedro Giffuni <pfg@FreeBSD.org>
Cc:        freebsd-ports@FreeBSD.org, Oliver Pinter <oliver.pinter@hardenedbsd.org>
Subject:   Re: [CFdiscussion] ports and FORTIFY_SOURCE
Message-ID:  <20150902151239.GE61752@ivaldir.etoilebsd.net>
In-Reply-To: <55E49E1E.2080005@FreeBSD.org>
References:  <55E49E1E.2080005@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--lteA1dqeVaWQ9QQl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 31, 2015 at 01:34:06PM -0500, Pedro Giffuni wrote:
> Dear ports developers;
>=20
> This year I mentored Oliver Pinter's GSoC project [1] to port
> FORTIFY_SOURCE to FreeBSD. The project was more complex than we
> thought initially but it was successful.
>=20
> For those of you that haven't heard of it, it's a trick supported by=20
> libc to enable bounds-checking on common string and memory functions.
> The code has gone through extensive testing with both clang and the
> base gcc. It should work fine with newer gcc but it is untested there.
>=20
> To activate it you will just need to add -D_FORTIFY_SOURCE=3D1 (or 2) in
> the CFLAGS and that will transparently add the extra checks. The code
> is non invasive but some ports (firefox, emacs) actually choose to run
> with this flag on by default and an exp-run found some errors in those
> cases.
>=20
> There are currently two remaining PRs with patches for mail/ifile=20
> (202572) and net-p2p/namecoin (2012603), getting those committed soon
> would avoid traumas in the ports tree once FORTIFY_SOURCE is committed.
>=20
> In the future it would be nice to support a flag within ports to enable
> or disable this extra flag for specific ports. I am unsure exactly how
> to do it, it could be something as simple as
>=20
> USE_FORTIFY=3D	yes
> or as complex as
> USES=3D 	compiler:fortify=3D0
> (0 disables it, 1 is standard for clang. 2 is standard for gcc)
>=20
IMHO it should be done the exact same way as SSP was added. meaning always
activated and ports that are not playing safely with it should explicitly
disable it via:
FORTIFY_UNSAFE=3Dyes

and a WITHOUt_FORTIFY (like we have a WITHOUT_SSP) should be added for peop=
le
willing to entirely remove it.

Bapt

--lteA1dqeVaWQ9QQl
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlXnEecACgkQ8kTtMUmk6EwQdgCffT7vMVak+Dz160XaM6Fej66S
jnYAn22ast2/OmH+HZ8W22WTHFYLFzes
=UuRe
-----END PGP SIGNATURE-----

--lteA1dqeVaWQ9QQl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150902151239.GE61752>