[Bug 838551] New: syscall() truncates return value to 32 bits
bugzilla at redhat.com
bugzilla at redhat.com
Mon Jul 9 12:52:32 UTC 2012
https://bugzilla.redhat.com/show_bug.cgi?id=838551
Bug ID: 838551
QA Contact: extras-qa at fedoraproject.org
Severity: high
URL: https://rt.perl.org/rt3/Public/Bug/Display.html?id=113
980
Version: 16
Priority: unspecified
CC: cweyl at alumni.drew.edu, iarnell at gmail.com,
jplesnik at redhat.com, kasal at ucw.cz, lkundrak at v3.sk,
mmaslano at redhat.com,
perl-devel at lists.fedoraproject.org, ppisar at redhat.com,
psabata at redhat.com, rc040203 at freenet.de,
tcallawa at redhat.com
Assignee: mmaslano at redhat.com
Summary: syscall() truncates return value to 32 bits
Regression: ---
Story Points: ---
Classification: Fedora
OS: Unspecified
Reporter: ppisar at redhat.com
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 at 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the perl-devel
mailing list