G'day Rob,

Thanks for advising of this proposal.

I was wondering about the taint-related overhead. I'm not an XS programmer; however, I did some investigation using Devel::Peek and followed that up with some hunting around in perlguts.

I'm genuinely interested in learning about this. My investigations are potentially incomplete and my inferences could easily be wrong. Any constructive criticism would be welcome.

Without any implicit (setuid/getuid) or explicit (-T) taint checking:

$ perl -e 'use Devel::Peek; my $x = $ENV{PATH}; Dump $x' SV = PVMG(0x8000c68f0) at 0x80008a8b8 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) IV = 0 NV = 0 PV = 0x80008c2c0 "... long list of pathnames ..."\0 CUR = 2026 LEN = 2028 COW_REFCNT = 1 $ perl -e 'use Devel::Peek; my $x = q{$ENV{PATH}}; Dump $x' SV = PV(0x800004670) at 0x80008a8a8 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x80008e250 "$ENV{PATH}"\0 CUR = 10 LEN = 12 COW_REFCNT = 1

So, ignoring the hex numbers — which I assumed were related to memory locations, like HASH(0x800003c88), ARRAY(0x800003cd0), etc. — and the values directly related to the string content, it would seem that the elements taking part in any overhead are SV = PVMG (cf. SV = PV) and the additional IV and NV. I wasn't able to figure out exactly what that overhead might be.

Now, I could be barking up the wrong tree, which is entirely possible, and, if so, please correct my conclusions. It seems there is no overhead unless there are tainted variables. Is there something else going on that I've overlooked or, perhaps, that I'm simply unaware of?

For comparison and completeness, here's the Devel::Peek output when -T is used:

$ perl -Te 'use Devel::Peek; my $x = $ENV{PATH}; Dump $x' SV = PVMG(0x8000c8850) at 0x80008b7d8 REFCNT = 1 FLAGS = (GMG,SMG,POK,IsCOW,pPOK) IV = 0 NV = 0 PV = 0x80008de60 "... long list of pathnames ..."\0 CUR = 2026 LEN = 2028 COW_REFCNT = 1 MAGIC = 0x8000447c0 MG_VIRTUAL = &PL_vtbl_taint MG_TYPE = PERL_MAGIC_taint(t) MG_LEN = 1 $ perl -Te 'use Devel::Peek; my $x = q{$ENV{PATH}}; Dump $x' SV = PV(0x800004670) at 0x80008bee8 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x800090220 "$ENV{PATH}"\0 CUR = 10 LEN = 12 COW_REFCNT = 1

There's no change for the untainted $x. The tainted version has additional FLAGS and a new MAGIC section. I had found PERL_MAGIC_taint in perlguts and originally thought that was related to PVMG (but maybe that's wrong).

— Ken


In reply to Re: Proposed change regarding "Taint" support [overhead] by kcott
in thread Proposed change regarding "Taint" support by syphilis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.