[Bug 838551] New: syscall() truncates return value to 32 bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=838551

            Bug ID: 838551
        QA Contact: extras-qa@xxxxxxxxxxxxxxxxx
          Severity: high
               URL: https://rt.perl.org/rt3/Public/Bug/Display.html?id=113
                    980
           Version: 16
          Priority: unspecified
                CC: cweyl@xxxxxxxxxxxxxxx, iarnell@xxxxxxxxx,
                    jplesnik@xxxxxxxxxx, kasal@xxxxxx, lkundrak@xxxxx,
                    mmaslano@xxxxxxxxxx,
                    perl-devel@xxxxxxxxxxxxxxxxxxxxxxx, ppisar@xxxxxxxxxx,
                    psabata@xxxxxxxxxx, rc040203@xxxxxxxxxx,
                    tcallawa@xxxxxxxxxx
          Assignee: mmaslano@xxxxxxxxxx
           Summary: syscall() truncates return value to 32 bits
        Regression: ---
      Story Points: ---
    Classification: Fedora
                OS: Unspecified
          Reporter: ppisar@xxxxxxxxxx
              Type: Bug
     Documentation: ---
          Hardware: x86_64
        Mount Type: ---
            Status: ASSIGNED
         Component: perl
           Product: Fedora

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@xxxxxxxxxx>
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/perl-devel



[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux