Bug 21075

Summary: unused assigment to %g4 in sparc/sparc{64,32}/clone.S
Product: glibc Reporter: Ivo Raisr <ivo.raisr>
Component: libcAssignee: Adhemerval Zanella <adhemerval.zanella>
Status: RESOLVED FIXED    
Severity: minor CC: adhemerval.zanella, drepper.fsp, ivo.raisr
Priority: P2 Flags: fweimer: security-
Version: 2.25   
Target Milestone: 2.26   
Host: Target:
Build: Last reconfirmed:
Attachments: proposed patch
patch reviewed by Adhemerval Zanella

Description Ivo Raisr 2017-01-23 18:24:23 UTC
Function __clone in sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
contains an unused assignment to %g4:
        mov     %i2, %g4

Register %g4 is not used anywhere afterwards.

Previous assignments to %g2 and %g3 make sense, because 'fn' and 'arg' arguments
need to be preserved across __NR_clone system call.
However there is no need to preserve 'flags' argument - it is used only for
__NR_clone system call (where it is passed in %o0).
Comment 1 Ivo Raisr 2017-01-23 18:26:20 UTC
Reported against latest glibc git upstream.
Comment 2 Ivo Raisr 2017-01-23 19:04:06 UTC
glibc version: checked git master at 2017-01-23 18:00 UTC.
building on and for: sparc64-unknown-linux-gnu
configure options: none
kernel: Linux 4.1.12-81.el6uek.sparc64
gcc version: 7.0.0 20170117 (experimental) (GCC) 
GNU ld (GNU Binutils) version: 2.28.51.20170118

I will provide a patch shortly.
Comment 3 Ivo Raisr 2017-01-26 10:54:56 UTC
File sysdeps/unix/sysv/linux/sparc/sparc32/clone.S contains the same problem.
The attached patch fixes both cases.
Comment 4 Ivo Raisr 2017-01-26 10:55:27 UTC
Created attachment 9775 [details]
proposed patch
Comment 5 Ivo Raisr 2017-01-31 13:21:53 UTC
Tested successfully in both sparcv9-linux-gnu and sparc64-linux-gnu.
Comment 6 Ivo Raisr 2017-01-31 13:23:07 UTC
Created attachment 9784 [details]
patch reviewed by Adhemerval Zanella
Comment 7 Sourceware Commits 2017-02-06 13:31:24 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  0b20e02c976ddd89a4adaa3a0c26baec3e275161 (commit)
      from  df3a4e104fb63f96f05b29931dd83e272c2b7936 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0b20e02c976ddd89a4adaa3a0c26baec3e275161

commit 0b20e02c976ddd89a4adaa3a0c26baec3e275161
Author: Ivo Raisr <ivo.raisr@oracle.com>
Date:   Mon Feb 6 10:49:50 2017 -0200

    sparc: Remove unused assignment in __clone
    
    It is no longer needed to preserve the flags parameter to `clone' since
    the commit c579f48edba88380635ab98cb612030e3ed8691e (Remove cached
    PID/TID in clone).
    
    Testing was performed successfully on sparcv9/Linux.
    
    	[BZ #21075]
    	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__clone): Remove
    	unused assignment.
    	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Likewise.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                     |    7 +++++++
 sysdeps/unix/sysv/linux/sparc/sparc32/clone.S |    1 -
 sysdeps/unix/sysv/linux/sparc/sparc64/clone.S |    1 -
 3 files changed, 7 insertions(+), 2 deletions(-)
Comment 8 Adhemerval Zanella 2017-02-06 13:32:21 UTC
Fixed in 2.26 (0b20e02c976ddd8).
Comment 9 Adhemerval Zanella 2017-02-16 17:18:22 UTC
As per last comment.