Subject: | taint problems with 6.32 Date::Manip::Parse |
Hi, Having taint issues with Date::Manip::Parse 6.32. Other os and perl version info in attached file.
On one of our systems, it worked; another failed the taint check and the module didn't successfully load.
My colleague tracked it down to the contents of /etc/sysconfig/clock. One was America/Detroit and the
other was America/New York. Of course, our staging server was Detroit and our production server was
New York.
I'm guessing you check this file for a time zone, do a sanity check, and then fail back to another method if
the sanity check fails. Two-word values cause the failure; well, at least, America/El Salvador also failed.
When this fails, we've noticed in strace output that it calls /bin/date; this is what causes the taint check to
fail. Modifying the module source to explicitly set the $ENV{PATH}, or doing it in our own code in a BEGIN
block, of course fixes the problem.
Here's a test run showing the issue.
/etc/sysconfig@top% cat ~danno/boof.pl
#!/opt/perl-5.16.0/bin/perl -T
use Date::Manip;
$foo= ParseDate("1 January 2012");
print "foo is $foo\n";
and a test run:
/etc/sysconfig@top% cat /etc/sysconfig/clock.ny
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="America/New York"
/etc/sysconfig@top% cat /etc/sysconfig/clock.detroit
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="America/Detroit"
/etc/sysconfig@top% sudo cp /etc/sysconfig/clock.ny /etc/sysconfig/clock
/etc/sysconfig@top% ~danno/boof.pl
Undefined subroutine &Date::Manip::ParseDate called at /usr/csg-nas/danno/boof.pl line 4.
/etc/sysconfig@top% sudo cp /etc/sysconfig/clock.detroit /etc/sysconfig/clock
/etc/sysconfig@top% ~danno/boof.pl
foo is 2012010100:00:00
I'm not exactly sure what I want you to do about this, but one obvious answer is that you shouldn't be
looking at /etc/sysconfig/clock on red hat systems, as per the comment in the file.
Intermittent failures are a bitch. I'd rather have it fail taint, period, than have it borked in some time zones
and not in others.
thanks!
Subject: | versions.txt |
[root@top sysconfig]# /opt/perl-5.16.0/bin/perl -e 'use Date::Manip; print DateManipVersion(1),"\n";'
6.32 [america/detroit]
[root@top sysconfig]# /opt/perl-5.16.0/bin/perl -V
Summary of my perl5 (revision 5 version 16 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.32-220.17.1.el6.x86_64, archname=x86_64-linux
uname='linux staging.icpsr.umich.edu 2.6.32-220.17.1.el6.x86_64 #1 smp thu apr 26 13:37:13 edt 2012 x86_64 x86_64 x86_64 gnulinux '
config_args='-Dprefix=/opt/perl-5.16.0 -A ccflags=-fPIC -des'
hint=previous, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fPIC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -fPIC',
optimize='-O2',
cppflags='-fPIC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include -fPIC -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include -I/opt/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC'
ccversion='', gccversion='4.4.6 20120305 (Red Hat 4.4.6-4)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector'
libpth=/lib64 /usr/lib64 /usr/lib64/mysql /opt/oracle/lib
libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.12.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.12'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
Built under linux
Compiled at Jul 19 2012 16:29:45
@INC:
/opt/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux
/opt/perl-5.16.0/lib/site_perl/5.16.0
/opt/perl-5.16.0/lib/5.16.0/x86_64-linux
/opt/perl-5.16.0/lib/5.16.0
.
[root@top sysconfig]# uname -a
Linux top.icpsr.umich.edu 2.6.32-279.2.1.el6.x86_64 #1 SMP Thu Jul 5 21:08:58 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@top sysconfig]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@top sysconfig]# yum check-update
Loaded plugins: downloadonly, product-id, protectbase, refresh-packagekit, rhnplugin, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel-x86_64-server-6 | 1.8 kB 00:00
rhel-x86_64-server-optional-6 | 1.8 kB 00:00
rhel-x86_64-server-supplementary-6 | 1.8 kB 00:00
rhn-tools-rhel-x86_64-server-6 | 1.6 kB 00:00
0 packages excluded due to repository protections
device-mapper-multipath.x86_64 0.4.9-56.el6_3.1 rhel-x86_64-server-6
device-mapper-multipath-libs.x86_64 0.4.9-56.el6_3.1 rhel-x86_64-server-6
kpartx.x86_64 0.4.9-56.el6_3.1 rhel-x86_64-server-6
[root@top sysconfig]#