Re: [PATCH] proc.5: Describe ambiguities in /proc/<pid>/maps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Elvira,

On 08/11/2018 05:32 AM, Elvira Khabirova wrote:
On Tue, 7 Aug 2018 14:40:17 +0200
"Michael Kerrisk (man-pages)" <mtk.manpages@xxxxxxxxx> wrote:

Hello,

On 19 July 2018 at 03:40, lineprinter <lineprinter@xxxxxxxxxxxx> wrote:
Pathname escaping is not done properly in /proc/<pid>/maps;
because of this, different pathnames may appear the same
(verified by experiment and reading the source code).

I verified the behavior, but could not find the relevant piece of the
source code. Could you point me at it please.

show_map_vma() from fs/proc/task_mmu.c uses seq_file_path() from fs/seq_file.c
to print the dentry name, which in turn calls seq_path() from the same
file. seq_path() uses d_path() from fs/d_path.c to get the path name;
this is where the " (deleted)" part comes from. This is followed by
mangling the string with mangle_path() (fs/seq_file.c); this function
only replaces those characters that were supplied in the "esc" argument
and does not bother with escaping anything else ('\\', for example).
The value of this argument comes without modifications from the initial
call of seq_file_path() by show_map_vma(), and that is "\n".

Thanks for the additional details. I've applied your patch, adding
the above details to the commit message.

Cheers,

Michael


Thanks,

Michael

---
  man5/proc.5 | 11 +++++++++++
  1 file changed, 11 insertions(+)

diff --git a/man5/proc.5 b/man5/proc.5
index e59bd3390..38663bdff 100644
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -1214,6 +1214,17 @@ short of running it through
  .BR strace (1),
  or similar.
  .IP
+.I pathname
+is shown unescaped except for newline characters, which are replaced
+with an octal escape sequence. As a result, it is not possible to determine
+whether the original pathname contained a newline character
+or the literal
+.I \\\012
+character sequence.
+.IP
+If the mapping is file-backed and the file has been deleted, the string
+" (deleted)" is appended to the pathname. Note that this is ambiguous too.
+.IP
  Under Linux 2.0, there is no field giving pathname.
  .TP
  .I /proc/[pid]/mem
--
2.18.0







[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux