Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2024 07:09:56 +0200
From:      =?ISO-8859-1?Q?J=F6rg?= Sonnenberger <joerg@bec.de>
To:        Kyle Evans <kevans@freebsd.org>, dev-commits-src-all@freebsd.org
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>, Pedro Giffuni <pfg@freebsd.org>
Subject:   Re: git: be04fec42638 - main - Import _FORTIFY_SOURCE implementation from NetBSD
Message-ID:  <4888579.OV4Wx5bFTl@britannica.bec.de>
In-Reply-To: <1413980952.1357400.1716093599901@mail.yahoo.com>
References:  <02326b5e-a1fe-4411-a869-d21f9a76130c@email.android.com> <6276b721-6c7b-41cd-9d1b-4169e86ec5e9@FreeBSD.org> <1413980952.1357400.1716093599901@mail.yahoo.com>

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

[-- Attachment #1 --]
On Sunday, May 19, 2024 6:39:59 AM GMT+2 Pedro Giffuni wrote:
>  FWIW .. and let me be clear I haven't worked on this in ages and I am not planning to retake this either...
> clang just couldn't do the static  fortify_source checks  due to the way llvm uses an intermediate representation; the size just couldn't be handled in the preprocessor.

That hasn't been true for a long time. __builtin_object_size is only
folded in the frontend if it absolutely has to because the context
requires an Integer Constant Expression, otherwise it is folded only
if the answer is definite. In all other cases it is left for the IR passes to
lower.

> fortify_source does replace some key libc functions with memory checking alternatives and that turns out to be annoying when debugging.

Since the wrapper functions are always_inline, they are pretty much invisible to debuggers.

Joerg

[-- Attachment #2 --]
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">On Sunday, May 19, 2024 6:39:59 AM GMT+2 Pedro Giffuni wrote:</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt;&nbsp; FWIW .. and let me be clear I haven't worked on this in ages and I am not planning to retake this either...</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; clang just couldn't do the static  fortify_source checks  due to the way llvm uses an intermediate representation; the size just couldn't be handled in the preprocessor.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">That hasn't been true for a long time. __builtin_object_size is only</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">folded in the frontend if it absolutely has to because the context</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">requires an Integer Constant Expression, otherwise it is folded only</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">if the answer is definite. In all other cases it is left for the IR passes to</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">lower.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt; fortify_source does replace some key libc functions with memory checking alternatives and that turns out to be annoying when debugging.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Since the wrapper functions are always_inline, they are pretty much invisible to debuggers.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Joerg</p>
</body>
</html>

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