develooper Front page | perl.perl5.porters | Postings from July 2012

Re: [perl #113980] [PATCH] pp_syscall: "I32 retval" truncates thereturned value

Thread Previous | Thread Next
From:
Oleg Nesterov
Date:
July 11, 2012 03:57
Subject:
Re: [perl #113980] [PATCH] pp_syscall: "I32 retval" truncates thereturned value
Message ID:
20120709125353.GA3872@redhat.com
On 07/08, Father Chrysostomos via RT wrote:
>
> On Thu Jul 05 02:15:16 2012, oleg@redhat.com wrote:
> > -------------------------------------------------------------------
> > #!/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";
> >
>
> Thank you.  I’ll have to adjust this a bit to turn it into a test.  Does
> $^O give you ‘linux’?

Yes,

> There is a possibility that another OS might have a plain file called
> /proc/self/maps whose contents just happen to match the regular
> expression, resulting in an invalid syscall, and perhaps a crash.
>
> So we should skip early if $^O is not appropriate.

Yes, yes, sure.

Bu just in case, please note $^O eq 'linux' is not enough.

The test-case assumes 64-bit linux and perl should be compiled
as 64-bit application too. Otherwise syscall(25) means stime()
and should be skipped.

Oleg.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About