Bug 838551 - syscall() truncates return value to 32 bits
Summary: syscall() truncates return value to 32 bits
Alias: None
Product: Fedora
Classification: Fedora
Component: perl
Version: 16
Hardware: x86_64
OS: Unspecified
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL: https://rt.perl.org/rt3/Public/Bug/Di...
Depends On:
TreeView+ depends on / blocked
Reported: 2012-07-09 12:52 UTC by Petr Pisar
Modified: 2012-09-20 20:39 UTC (History)
11 users (show)

Fixed In Version: perl-5.16.1-233.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-09-20 20:39:03 UTC
Type: Bug

Attachments (Terms of Use)

Description Petr Pisar 2012-07-09 12:52:32 UTC
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 08:44:02 UTC
perl 5.14.2 and 5.16.1 are affected.

Comment 2 Fedora Update System 2012-09-11 13:26:32 UTC
perl-5.16.1-230.fc18 has been submitted as an update for Fedora 18.

Comment 3 Fedora Update System 2012-09-11 16:53:33 UTC
perl-5.14.2-214.fc17 has been submitted as an update for Fedora 17.

Comment 4 Fedora Update System 2012-09-11 17:03:08 UTC
perl-5.14.2-200.fc16 has been submitted as an update for Fedora 16.

Comment 5 Fedora Update System 2012-09-11 19:12:32 UTC
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:
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2012-09-14 12:04:19 UTC
perl-5.16.1-231.fc18 has been submitted as an update for Fedora 18.

Comment 7 Fedora Update System 2012-09-14 12:17:20 UTC
perl-5.14.2-215.fc17 has been submitted as an update for Fedora 17.

Comment 8 Fedora Update System 2012-09-14 12:18:35 UTC
perl-5.14.2-201.fc16 has been submitted as an update for Fedora 16.

Comment 9 Fedora Update System 2012-09-20 20:39:03 UTC
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.