diff options
author | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2012-02-12 18:56:35 +0000 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2012-02-18 23:39:38 +0000 |
commit | 985213f2fede57896814a0d7f5d12b04cc05be5b (patch) | |
tree | dba5979a55b4d6a426815d208821d5a0fdf6fa06 /embedvar.h | |
parent | f0bcc49ad675e0a60f19580435d94bbee904084d (diff) | |
download | perl-985213f2fede57896814a0d7f5d12b04cc05be5b.tar.gz |
Remove gete?[ug]id caching
Currently we cache the UID/GID and effective UID/GID similarly to how
we used to cache getpid() before v5.14.0-251-g0e21945. Remove this
magical behavior in favor of always calling getpid(), getgid()
etc. This resolves RT #96208.
A minimal testcase for this is the following by Leon Timmermans
attached to RT #96208:
eval { require 'syscall.ph'; 1 } or eval { require 'sys/syscall.ph'; 1 } or die $@;
if (syscall(&SYS_setuid, $ARGV[0] + 0 || 1000) >= 0 or die "$!") {
printf "\$< = %d, getuid = %d\n", $<, syscall(&SYS_getuid);
}
I.e. if we call the sete?[ug]id() functions unbeknownst to perl the
$<, $>, $( and $) variables won't be updated. This results in the same
sort of issues we had with $$ before v5.14.0-251-g0e21945, and
getppid() before my v5.15.7-407-gd7c042c patch.
I'm completely eliminating the PL_egid, PL_euid, PL_gid and PL_uid
variables as part of this patch, this will break some CPAN modules,
but it'll be really easy before the v5.16.0 final to reinstate
them. I'd like to remove them to see what breaks, and how easy it is
to fix it.
These variables are not part of the public API, and the modules using
them could either use the Perl_gete?[ug]id() functions or are working
around the bug I'm fixing with this commit.
The new PL_delaymagic_(egid|euid|gid|uid) variables I'm adding are
*only* intended to be used internally in the interpreter to facilitate
the delaymagic in Perl_pp_sassign. There's probably some way not to
export these to programs that embed perl, but I haven't found out how
to do that.
Diffstat (limited to 'embedvar.h')
-rw-r--r-- | embedvar.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/embedvar.h b/embedvar.h index 81d28e7b44..24d99e9610 100644 --- a/embedvar.h +++ b/embedvar.h @@ -149,6 +149,10 @@ #define PL_defoutgv (vTHX->Idefoutgv) #define PL_defstash (vTHX->Idefstash) #define PL_delaymagic (vTHX->Idelaymagic) +#define PL_delaymagic_egid (vTHX->Idelaymagic_egid) +#define PL_delaymagic_euid (vTHX->Idelaymagic_euid) +#define PL_delaymagic_gid (vTHX->Idelaymagic_gid) +#define PL_delaymagic_uid (vTHX->Idelaymagic_uid) #define PL_destroyhook (vTHX->Idestroyhook) #define PL_diehook (vTHX->Idiehook) #define PL_doswitches (vTHX->Idoswitches) @@ -158,13 +162,11 @@ #define PL_e_script (vTHX->Ie_script) #define PL_efloatbuf (vTHX->Iefloatbuf) #define PL_efloatsize (vTHX->Iefloatsize) -#define PL_egid (vTHX->Iegid) #define PL_encoding (vTHX->Iencoding) #define PL_endav (vTHX->Iendav) #define PL_envgv (vTHX->Ienvgv) #define PL_errgv (vTHX->Ierrgv) #define PL_errors (vTHX->Ierrors) -#define PL_euid (vTHX->Ieuid) #define PL_eval_root (vTHX->Ieval_root) #define PL_eval_start (vTHX->Ieval_start) #define PL_evalseq (vTHX->Ievalseq) @@ -179,7 +181,6 @@ #define PL_formtarget (vTHX->Iformtarget) #define PL_generation (vTHX->Igeneration) #define PL_gensym (vTHX->Igensym) -#define PL_gid (vTHX->Igid) #define PL_glob_index (vTHX->Iglob_index) #define PL_globalstash (vTHX->Iglobalstash) #define PL_globhook (vTHX->Iglobhook) @@ -349,7 +350,6 @@ #define PL_tmps_stack (vTHX->Itmps_stack) #define PL_top_env (vTHX->Itop_env) #define PL_toptarget (vTHX->Itoptarget) -#define PL_uid (vTHX->Iuid) #define PL_unicode (vTHX->Iunicode) #define PL_unitcheckav (vTHX->Iunitcheckav) #define PL_unitcheckav_save (vTHX->Iunitcheckav_save) |