php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77044 Process Name has lots of null appended
Submitted: 2018-10-21 22:10 UTC Modified: 2018-10-21 22:31 UTC
From: d28b312d at opayq dot com Assigned:
Status: Open Package: FPM related
PHP Version: Irrelevant OS: CentOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: d28b312d at opayq dot com
New email:
PHP Version: OS:

 

 [2018-10-21 22:10 UTC] d28b312d at opayq dot com
Description:
------------
When php-fpm starts it seems to set a wild command line which causes problems with tools such as `pgrep -xf`.

Using: `cat /proc/<procid>/cmdline | hexdump -C`

For example, most normal tools:
00000000  2f 75 73 72 2f 6c 69 62  2f 70 6f 6c 6b 69 74 2d  |/usr/lib/polkit-|
00000010  31 2f 70 6f 6c 6b 69 74  64 00 2d 2d 6e 6f 2d 64  |1/polkitd.--no-d|
00000020  65 62 75 67 00                                    |ebug.|

But php-fpm processes:
00000000  70 68 70 2d 66 70 6d 3a  20 6d 61 73 74 65 72 20  |php-fpm: master |
00000010  70 72 6f 63 65 73 73 20  28 2f 65 74 63 2f 70 68  |process (/etc/ph|
00000020  70 2d 66 70 6d 2e 63 6f  6e 66 29 00 00 00 00 00  |p-fpm.conf).....|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00     |...............|

This applies to all php-fpm processes, and so far, _no_ other processes on my system , which leads me to believe it's a bug in php-fpm.

Expected result:
----------------
00000000  70 68 70 2d 66 70 6d 3a  20 6d 61 73 74 65 72 20  |php-fpm: master |
00000010  70 72 6f 63 65 73 73 20  28 2f 65 74 63 2f 70 68  |process (/etc/ph|
00000020  70 2d 66 70 6d 2e 63 6f  6e 66 29 00              |p-fpm.conf).|

Actual result:
--------------
00000000  70 68 70 2d 66 70 6d 3a  20 6d 61 73 74 65 72 20  |php-fpm: master |
00000010  70 72 6f 63 65 73 73 20  28 2f 65 74 63 2f 70 68  |process (/etc/ph|
00000020  70 2d 66 70 6d 2e 63 6f  6e 66 29 00 00 00 00 00  |p-fpm.conf).....|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00     |...............|

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-21 22:31 UTC] requinix@php.net
If this is to hide the argument list, which I suspect is the case, then a better trick may be to zero out all but the last byte.
http://netsplit.com/hiding-arguments-from-ps
If the kernel does what the article says then only argv[0] will be exposed, but if not then everything was still deleted.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC