Bug 838551 - syscall() truncates return value to 32 bits
syscall() truncates return value to 32 bits
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: perl (Show other bugs)
16
x86_64 Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Petr Pisar
Fedora Extras Quality Assurance
https://rt.perl.org/rt3/Public/Bug/Di...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-09 08:52 EDT by Petr Pisar
Modified: 2012-09-20 16:39 EDT (History)
11 users (show)

See Also:
Fixed In Version: perl-5.16.1-233.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-20 16:39:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Petr Pisar 2012-07-09 08:52:32 EDT
There is problem when calling generic syscall() function on 64-bit architectures. The return value is clamped to 32 bits.

Can be reproduced with mmap or mremap syscalls:

> #!/usr/bin/perl -w
> use strict;
>
> sub find_vdso()
> {
>       open my $maps, '<', '/proc/self/maps' or die;
>       /^(.*?)-.*\[vdso\]$/ and return hex $1 for <$maps>;
> }
> 
> my $vdso_addr = find_vdso || die 'not 64-bit linux?';
>
> my $ret = syscall 25,         # __NR_mremap
>               $vdso_addr,     # old_addr
>               1,              # old_len
>               1,              # new_len
>               0,              # flags
>               0;              # new_addr (unused)
>
> $ret == $vdso_addr or die "FAILED\n";

Fixed in upstream commit:

commit f9344c91a4ca48288bba30dc94a2d712d0659670
Author: Oleg Nesterov <oleg@redhat.com>
Date:   Wed Jul 4 08:21:15 2012 -0700

    [perl #113980] pp_syscall: "I32 retval" truncates the returned value
    
    I noticed today that syscall(9, ...) (mmap) doesn't work for me.
    
    The problem is obvious, pp_syscall() uses I32 for retval and the
    "long" address doesn't fit into "int".
    
    The one-liner below should fix the problem.
Comment 1 Petr Pisar 2012-09-11 04:44:02 EDT
perl 5.14.2 and 5.16.1 are affected.
Comment 2 Fedora Update System 2012-09-11 09:26:32 EDT
perl-5.16.1-230.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/perl-5.16.1-230.fc18
Comment 3 Fedora Update System 2012-09-11 12:53:33 EDT
perl-5.14.2-214.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/perl-5.14.2-214.fc17
Comment 4 Fedora Update System 2012-09-11 13:03:08 EDT
perl-5.14.2-200.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/perl-5.14.2-200.fc16
Comment 5 Fedora Update System 2012-09-11 15:12:32 EDT
Package perl-5.16.1-230.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing perl-5.16.1-230.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-13814/perl-5.16.1-230.fc18
then log in and leave karma (feedback).
Comment 6 Fedora Update System 2012-09-14 08:04:19 EDT
perl-5.16.1-231.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/perl-5.16.1-231.fc18
Comment 7 Fedora Update System 2012-09-14 08:17:20 EDT
perl-5.14.2-215.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/perl-5.14.2-215.fc17
Comment 8 Fedora Update System 2012-09-14 08:18:35 EDT
perl-5.14.2-201.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/perl-5.14.2-201.fc16
Comment 9 Fedora Update System 2012-09-20 16:39:03 EDT
perl-5.16.1-231.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.