develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000308.006] use in Safe compartments

From:
Matt Sergeant
Date:
March 8, 2000 11:04
Subject:
[ID 20000308.006] use in Safe compartments
Message ID:
200003081904.TAA18062@dougal.sergeant.org

This is a bug report for perl from matt@sergeant.org,
generated with the help of perlbug 1.26 running under perl 5.00503.


-----------------------------------------------------------------
[Please enter your report here]

Witness:

use Safe;
my $c = Safe->new;
$c->permit(qw/:browse require/);
$c->share('$$');
$c->reval('use English; print $PID;');
die $@ if $@
__END__
Undefined subroutine &Exporter::import called at /usr/lib/perl5/5.00503/English.pm line 47.
BEGIN failed--compilation aborted at (eval 2) line 1.

The problem is that 'use' in a safe compartment doesn't remove the
barrier that safe compartments can't look in other packages, so

use Exporter;

doesn't allow you to call &Exporter::import like you can outside
of a safe compartment.

My theory is that we need a sort of peephole, so that if you allow the
require permit, and you use() a module, you should get a peephole into
that package's namespace.

(The motivation for this is a Safe compartment for mod_perl - without
this functionality it's useless).

[Please do not change anything below this line]
-----------------------------------------------------------------

---
This perlbug was built using Perl 5.00503 - Tue Apr 13 04:04:31 CEST 1999
It is being executed now by  Perl 5.00557 - Fri Jul 16 22:00:43 /etc/localtime 1999.

Site configuration information for perl 5.00503:

Configured by root at Tue Apr 13 04:04:31 CEST 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.2.5-4, archname=i386-linux
    uname='linux vador 2.2.5-4 #1 tue apr 6 19:46:00 edt 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=pgcc-2.91.60 19981201 (egcs-1.1.1 release)
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.00503:
    /usr/lib/perl5/5.00503/i386-linux
    /usr/lib/perl5/5.00503
    /usr/lib/perl5/site_perl/5.005/i386-linux
    /usr/lib/perl5/site_perl/5.005
    .

---
Environment for perl 5.00503:
    HOME=/home/matt
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/bin:/usr/bin::/usr/X11R6/bin:/var/qmail/bin:/usr/local/sbin:/usr/local/jdk1.2/bin:/opt/sybase/bin:/home/matt/bin:/usr/local/jdk1.2/bin:/opt/sybase/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash



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