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]
Message-ID: <819a5450-127b-ecd2-ac01-c58e848fba1d@cs.kuleuven.be>
Date:   Wed, 23 Aug 2023 14:57:48 +0200
From:   Jo Van Bulck <jo.vanbulck@...kuleuven.be>
To:     Jarkko Sakkinen <jarkko@...nel.org>, kai.huang@...el.com,
        linux-sgx@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     dave.hansen@...ux.intel.com
Subject: Re: [PATCH v3 9/9] selftests/sgx: Specify freestanding environment
 for enclave compilation

On 22.08.23 12:14, Jarkko Sakkinen wrote:
> Do you still need nostdfiles and nostartfiles with freestanding?

Thanks, good question. I tested that compiling with only -ffreestanding 
yields:

/* snipped */
/usr/local/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/rcrt1.o: in 
function `_start':
(.text+0x24): undefined reference to `main'
/* snipped */

So we definitely still need -nostartfiles to prevent the compiler/linker 
from introducing the standard system startup functions. However, in my 
understanding, -nostdlib (which is what I assume you mean with 
nostdfiles) already implies the individual options -nodefaultlibs and 
-nostartfiles.

Thus, we definitely still need -nostartfiles and I'm not 100% sure we 
don't need -nostdlib (though it compiles fine for me with only 
-nostartfiles). Gcc only specifies:

-ffreestanding
Assert that compilation targets a freestanding environment.  This 
implies -fno-builtin. A freestanding environment is one in which the 
standard library may not exist, and program startup may not necessarily 
be at "main".

Bottom line: I suggest to keep -nostdlib to be sure and remove 
-nostartfiles (as it is redundant). I'll include this in the next  patch 
iteration.

Best,
Jo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ