[PATCH] lib/cobalt: only compile __real___open[64]_2 wrappers if fortified

Jan Kiszka jan.kiszka at siemens.com
Fri Sep 11 10:55:41 CEST 2020


On 11.09.20 10:32, Jan Leupold via Xenomai wrote:
> If Xenomai itself is not compiled with FORTIFY_SOURCE then the function
> declarations for __open_2() and __open64_2() are not available.
> __STD(__open_2(...)) will not link in this case (would be a very special
> use case anyway?).
> 

That seems like a reasonable approach.

BUT: This must be part of v3 of your patch (version your patches,
please). And there are two more things in that patch which I missed
yesterday. Will comment in the original thread.

Jan

> Signed-off-by: Jan Leupold <leupold at rsi-elektrotechnik.de>
> ---
>  lib/cobalt/wrappers.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c
> index 5d86607de..5ff6b63bc 100644
> --- a/lib/cobalt/wrappers.c
> +++ b/lib/cobalt/wrappers.c
> @@ -205,6 +205,7 @@ int __real_open64(const char *path, int oflag, ...)
>  }
>  #endif
>  
> +#if __USE_FORTIFY_LEVEL > 0
>  __weak
>  int __real___open_2(const char *path, int oflag)
>  {
> @@ -216,6 +217,7 @@ int __real___open64_2(const char *path, int oflag)
>  {
>      return __open64_2(path, oflag);
>  }
> +#endif // __USE_FORTIFY_LEVEL > 0
>  
>  __weak
>  int __real_socket(int protocol_family, int socket_type, int protocol)
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list