Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1513021 > unrolled thread

[PATCH v2] unix: escape all null bytes in abstract unix domain socket

Started byIsaac Boukris <iboukris@gmail.com>
First post2016-11-01 01:50 +0100
Last post2016-11-01 17:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] unix: escape all null bytes in abstract unix domain socket Isaac Boukris <iboukris@gmail.com> - 2016-11-01 01:50 +0100
    Re: [PATCH v2] unix: escape all null bytes in abstract unix domain  socket David Miller <davem@davemloft.net> - 2016-11-01 17:20 +0100

#1513021 — [PATCH v2] unix: escape all null bytes in abstract unix domain socket

FromIsaac Boukris <iboukris@gmail.com>
Date2016-11-01 01:50 +0100
Subject[PATCH v2] unix: escape all null bytes in abstract unix domain socket
Message-ID<syvr3-1lH-1@gated-at.bofh.it>
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed out to
proc the same way the null prefix is currently being
translated.

This helps for tools such as netstat, lsof and the proc
based implementation in ss to show all the significant
bytes of the name (instead of getting cut at the first
null occurrence).

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
---
 net/unix/af_unix.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 145082e..5d1c14a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2812,7 +2812,8 @@ static int unix_seq_show(struct seq_file *seq, void *v)
 				i++;
 			}
 			for ( ; i < len; i++)
-				seq_putc(seq, u->addr->name->sun_path[i]);
+				seq_putc(seq, u->addr->name->sun_path[i] ?:
+					 '@');
 		}
 		unix_state_unlock(s);
 		seq_putc(seq, '\n');
-- 
2.7.4

[toc] | [next] | [standalone]


#1513347 — Re: [PATCH v2] unix: escape all null bytes in abstract unix domain socket

FromDavid Miller <davem@davemloft.net>
Date2016-11-01 17:20 +0100
SubjectRe: [PATCH v2] unix: escape all null bytes in abstract unix domain socket
Message-ID<syJX4-2y5-31@gated-at.bofh.it>
In reply to#1513021
From: Isaac Boukris <iboukris@gmail.com>
Date: Tue,  1 Nov 2016 02:41:35 +0200

> Abstract unix domain socket may embed null characters,
> these should be translated to '@' when printed out to
> proc the same way the null prefix is currently being
> translated.
> 
> This helps for tools such as netstat, lsof and the proc
> based implementation in ss to show all the significant
> bytes of the name (instead of getting cut at the first
> null occurrence).
> 
> Signed-off-by: Isaac Boukris <iboukris@gmail.com>

Applied, thank you.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web