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

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

Thread Previous
From:
Oleg Nesterov
Date:
July 6, 2012 01:06
Subject:
Re: [perl #113980] [PATCH] pp_syscall: "I32 retval" truncates thereturned value
Message ID:
20120705155048.GA8360@redhat.com
On 07/04, Bo Lindbergh via RT wrote:
>
> Quoth Oleg Nesterov:
> > --- a/pp_sys.c
> > +++ b/pp_sys.c
> > @@ -5456,7 +5456,7 @@ PP(pp_syscall)
> >    register I32 items = SP - MARK;
> >    unsigned long a[20];
> >    register I32 i = 0;
> > -    I32 retval = -1;
> > +    IV retval = -1;
> >
> >    if (PL_tainting) {
> > 	while (++MARK <= SP) {
>
> Note that this doesn't help if the syscall function itself is declared as
>
>    int syscall(int, ...);
>
> which is not unheard of.

Sure, this change is not needed in this case, but it doesn't hurt?
I am not familiar with perl's implementation but PUSHi(retval) and
Perl_sv_setiv() uses (IV)retval anyway, so I don't think this change
can make any difference.

If you meant that libc itself can be buggy (so that the library
function truncates the result of syscall), then perl can do nothing.

Or I misunderstood your point?

Oleg.


Thread Previous


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