Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37529173
en ru br
Репозитории ALT
S:2.0.11-alt3
5.1: 2.0.4-alt1
4.1: 2.0.3-alt5
4.0: 2.0.3-alt5
www.altlinux.org/Changes

Группа :: Система/Серверы
Пакет: apache2-mod_perl

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: mod_perl-2.0.7-alt-disable_prctl_set_name.patch
Скачать


Perl >= 5.13.1 sets the legacy process name in addition to the POSIX name on Linux,
see mg.c; Perl_magic_set() function, case '0'.
These legacy process name have changed via prctl(PR_SET_NAME, (unsigned long)s, 0, 0, 0) call,
and length of process name is limited to 16 chars by kernel.
Apache2 process name (/usr/sbin/httpd2) is 17 char length; so modperl_startup() will end
with truncated to 'httpd' process name - see
https://bugzilla.altlinux.org/show_bug.cgi?id=26892 and
https://bugzilla.redhat.com/show_bug.cgi?id=782369
Patch from RedHat (https://bugzilla.redhat.com/attachment.cgi?id=567625&action=diff) ends with
weird value of /proc/self/cmdline during script execution (i.e. "/usr/sbin//var/w" for script
/var/www/perl/foo.pl) and breaks up all tests due to error inside Perl's FindBin module.
Setting up PL_origalen=1 will disable updating the proctitle during $0 assigment,
that gives Apache process name (/usr/sbin/httpd2) in /proc/pid/cmdline during script execution.
(Old behavior, with Perl <= 5.13, gives truncated value like "/var/www/perl/fo").
Test script:
~~~~~~~~
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "\$0: - $0\n";
print "ps h:    ",`/bin/ps hww $$`;
print "ps hc:   ",`/bin/ps hcww $$`;
print "stat:    ",`cat /proc/$$/stat`;
print "cmdline: ",`cat /proc/$$/cmdline`;
print "\n";
~~~~~~~~
--- src/modules/perl/mod_perl.c
+++ src/modules/perl/mod_perl.c
@@ -275,7 +275,11 @@ PerlInterpreter *modperl_startup(server_rec *s, apr_pool_t *p)
      * have set it to '-e'. Being magic-aware ensures that some
      * OS-specific magic will happen (i.e. setproctitle() on *BSDs)
      */
-    PL_origalen = strlen(argv[0]) + 1;
+/*   PL_origalen = strlen(argv[0]) + 1;*/
+/* PL_origalen on Perl >= 5.13.1 is calling prctl(PR_SET_NAME, ...) to set /proc/pid/comm .
+   Kernel have limits strings in PR_SET_NAME to 16 bytes, and length of "/usr/sbin/httpd2" is 17.
+   PL_origalen=1 don't let $0 assignment update the proctitle and embedding[0] at all. */
+    PL_origalen = 1;
     sv_setpv_mg(get_sv("0",0), argv[0]);
 
     perl_run(perl);
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin