All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] feature_test_macros.7: document -D_FORTIFY_SOURCE=3
@ 2022-10-13 21:06 Sam James
  2022-10-13 22:41 ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: Sam James @ 2022-10-13 21:06 UTC (permalink / raw)
  To: Alejandro Colomar, Michael Kerrisk; +Cc: linux-man, Sam James

Reference: https://developers.redhat.com/blog/2021/04/16/broadening-compiler-checks-for-buffer-overflows-in-_fortify_source
Reference: https://developers.redhat.com/articles/2022/09/17/gccs-new-fortification-level
Signed-off-by: Sam James <sam@gentoo.org>
---
 man7/feature_test_macros.7 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7
index cdd962f7f..f057c1c87 100644
--- a/man7/feature_test_macros.7
+++ b/man7/feature_test_macros.7
@@ -634,9 +634,23 @@ and result in compiler warnings;
 other checks take place at run time,
 and result in a run-time error if the check fails.
 .IP
+With
+.B _FORTIFY_SOURCE
+set to 3, additional checking is added to intercept some function
+calls used with an argument of variable size where the compiler can
+deduce an upper bound for its value.
+For example, a program where malloc's size argument is variable
+can now be fortified.
+.IP
 Use of this macro requires compiler support, available with
 .BR gcc (1)
 since version 4.0.
+.IP
+For use of
+.B _FORTIFY_SOURCE
+set to 3, then
+.BR gcc (1)
+version 12.0 or later is required.
 .SS Default definitions, implicit definitions, and combining definitions
 If no feature test macros are explicitly defined,
 then the following feature test macros are defined by default:
-- 
2.38.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] feature_test_macros.7: document -D_FORTIFY_SOURCE=3
  2022-10-13 21:06 [PATCH v2] feature_test_macros.7: document -D_FORTIFY_SOURCE=3 Sam James
@ 2022-10-13 22:41 ` Alejandro Colomar
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2022-10-13 22:41 UTC (permalink / raw)
  To: Sam James; +Cc: linux-man


[-- Attachment #1.1: Type: text/plain, Size: 1765 bytes --]

Hi Sam,

On 10/13/22 23:06, Sam James wrote:
> Reference: https://developers.redhat.com/blog/2021/04/16/broadening-compiler-checks-for-buffer-overflows-in-_fortify_source
> Reference: https://developers.redhat.com/articles/2022/09/17/gccs-new-fortification-level
> Signed-off-by: Sam James <sam@gentoo.org>

Patch applied.

Cheers,

Alex

> ---
>   man7/feature_test_macros.7 | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7
> index cdd962f7f..f057c1c87 100644
> --- a/man7/feature_test_macros.7
> +++ b/man7/feature_test_macros.7
> @@ -634,9 +634,23 @@ and result in compiler warnings;
>   other checks take place at run time,
>   and result in a run-time error if the check fails.
>   .IP
> +With
> +.B _FORTIFY_SOURCE
> +set to 3, additional checking is added to intercept some function
> +calls used with an argument of variable size where the compiler can
> +deduce an upper bound for its value.
> +For example, a program where malloc's size argument is variable
> +can now be fortified.

I reflowed this text a little bit (rationale: semantic newlines), and 
also formatted malloc(3).

The mention to malloc(3) was useful, IMO :)

> +.IP
>   Use of this macro requires compiler support, available with
>   .BR gcc (1)
>   since version 4.0.
> +.IP
> +For use of
> +.B _FORTIFY_SOURCE
> +set to 3, then
> +.BR gcc (1)
> +version 12.0 or later is required.

And reworded this a bit.

>   .SS Default definitions, implicit definitions, and combining definitions
>   If no feature test macros are explicitly defined,
>   then the following feature test macros are defined by default:

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-13 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 21:06 [PATCH v2] feature_test_macros.7: document -D_FORTIFY_SOURCE=3 Sam James
2022-10-13 22:41 ` Alejandro Colomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.