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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 19 Mar 2024 23:16:15 +0100
From: Sam Ravnborg <sam@...nborg.org>
To: Koakuma <koachan@...tonmail.com>
Cc: "sparclinux@...r.kernel.org" <sparclinux@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
	"arnd@...db.de" <arnd@...db.de>
Subject: Re: [sparc] Use of -fcall-used-* flags in Makefile?

Hi Koakuma,

On Sat, Mar 16, 2024 at 02:59:42PM +0000, Koakuma wrote:
> Hello, first time poster so apologies if I posted to the wrong list.
> 
> Anyone knows why the SPARC makefiles (arch/sparc/Makefile and
> arch/sparc/vdso/Makefile) set `-fcall-used-g5` and  `-fcall-used-g7`
> in their CFLAGS?

sparc32 uses:
-fcall-used-g5 -fcall-used-g7


sparc64 uses:
-ffixed-g4 -ffixed-g5 -fcall-used-g7


For sparc64:

-ffixed-g4 is added because sparc64 uses the g4 register to hold the
pointer to the current task. See:

    arch/sparc/include/asm/current.h line 18.


g2, g5, g7 all have their specific use or assumptions.

>From arch/sparc/include/asm/ttable.h: 

 * Further note that we cannot use the g2, g4, g5, and g7 alternate
 * globals in the spill routines, check out the save instruction in
 * arch/sparc64/kernel/etrap.S to see what I mean about g2, and
 * g4/g5 are the globals which are preserved by etrap processing
 * for the caller of it.  The g7 register is the return pc for
 * etrap.  Finally, g6 is the current thread register so we cannot
 * us it in the spill handlers either.  Most of these rules do not
 * apply to fill processing, only g6 is not usable.
 */


Looking at https://github.com/gcc-mirror/gcc/blob/master/gcc/config/sparc/sparc.h
I read that:

   On v9 systems:
   g1,g5 are free to use as temporaries, and are free to use between calls
   ...
   g6-g7 are reserved for the operating system (or application in
   embedded case).

Based on the above I would assume gcc do not change behaviour with or
without -fcall-used-g7.

I do not have a sparc64 system at my hands - and for this qemu may not
cut it. But it would be super if someone with a working sparc64 target
could verify if the kernel could be built and works without
-fcall-used-g7.


For sparc32 the above file says:

    g5 through g7 are reserved for the operating system.

So again - it looks like -fcall-used-g5 -fcall-used-g7 should have no
effect here and verification on a real target would be nice.

	Sam

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ