Bug 21075 - unused assigment to %g4 in sparc/sparc{64,32}/clone.S
Summary: unused assigment to %g4 in sparc/sparc{64,32}/clone.S
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.25
: P2 minor
Target Milestone: 2.26
Assignee: Adhemerval Zanella
Depends on:
Reported: 2017-01-23 18:24 UTC by Ivo Raisr
Modified: 2017-02-16 17:18 UTC (History)
3 users (show)

See Also:
Last reconfirmed:
fweimer: security-

proposed patch (479 bytes, patch)
2017-01-26 10:55 UTC, Ivo Raisr
Details | Diff
patch reviewed by Adhemerval Zanella (479 bytes, patch)
2017-01-31 13:23 UTC, Ivo Raisr
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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:

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 cvs-commit@gcc.gnu.org 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 -----------------------------------------------------------------

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.