lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 13 May 2024 01:58:09 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "John Hubbard" <jhubbard@...dia.com>, "Mirsad Todorovac"
 <mtodorovac69@...il.com>, <linux-kselftest@...r.kernel.org>
Cc: "Dave Hansen" <dave.hansen@...ux.intel.com>, "Shuah Khan"
 <shuah@...nel.org>, <linux-sgx@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>, "Edward Liaw" <edliaw@...gle.com>
Subject: Re: [PATCH v1 1/1] selftests/sgx: Fix the implicit declaration of
 asprintf() compiler error

On Fri May 10, 2024 at 11:52 PM EEST, John Hubbard wrote:
> On 5/10/24 1:37 PM, Mirsad Todorovac wrote:
> ...
> > The fix defines __USE_GNU before including <stdio.h> in case it isn't already
> > defined. After this intervention the module compiles OK.
>
> Instead of interventions, I believe the standard way to do this is to simply
> define _GNU_SOURCE before including the header file(s). For example, the
> following also fixes the compilation failure on Ubuntu:
>
> diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
> index 9820b3809c69..bb6e795d06e2 100644
> --- a/tools/testing/selftests/sgx/main.c
> +++ b/tools/testing/selftests/sgx/main.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /*  Copyright(c) 2016-20 Intel Corporation. */
>   
> +#define _GNU_SOURCE
>   #include <cpuid.h>
>   #include <elf.h>
>   #include <errno.h>
>
>
> However, that's not required, because Edward Liaw is already on v4 of
> a patchset[1] that fixes up the _GNU_SOURCE problem for all selftests.
>
> [1] https://lore.kernel.org/all/20240510000842.410729-2-edliaw@google.com/
>
> thanks,


Yeah this and also

Link: https://man7.org/linux/man-pages/man3/asprintf.3.html

And those crazy dumps could go away. The code does not use per man page
aprintf correctly and that is exactly the rationale. It is enough then
to just tell that not having _GNU_SOURCE results a compilation error.

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ