[RFC 0/2] tools: Add shmsnoop/sofdsnoop tools


Jiri Olsa
 

hi,
this is RFC patchset on 2 tools that our customer wants
and perhaps would like to see them upstream.

The sofdsnoop traces FDs passed through unix sockets:

# ./sofdsnoop
ACTION TID COMM SOCKET FD NAME
SEND 2576 Web Content 24:socket:[39763] 51 /dev/shm/org.mozilla.ipc.2576.23874
RECV 2576 Web Content 49:socket:[809997] 51
SEND 2576 Web Content 24:socket:[39763] 58 N/A
...

The shmsnoop tool to trace System V shared memory syscalls:

# ./shmsnoop.py
PID COMM SYS RET ARGs
19813 server SHMGET 10000 key: 0x78020001, size: 20, shmflg: 0x3b6 (IPC_CREAT|0666)
19813 server SHMAT 7f1cf8b1f000 shmid: 0x10000, shmaddr: 0x0, shmflg: 0x0
19816 client SHMGET 10000 key: 0x78020001, size: 20, shmflg: 0x1b6 (0666)
...

They are still under testing/review, but I'd like to
have some upstream folks opinions on these.

thanks,
jirka


---
Jiri Olsa (2):
tools: Add shmsnoop to spy on shm* syscalls
tools: Add sofdsnoop to spy on fds passed through socket

README.md | 2 +
man/man8/shmsnoop.8 | 74 +++++++++++++++++++++++++
man/man8/spfdsnoop.8 | 85 +++++++++++++++++++++++++++++
snapcraft/snapcraft.yaml | 6 ++
tests/python/test_tools_smoke.py | 8 +++
tools/shmsnoop.py | 335 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/shmsnoop_example.txt | 66 ++++++++++++++++++++++
tools/sofdsnoop.py | 355 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/sofdsnoop_example.txt | 69 +++++++++++++++++++++++
9 files changed, 1000 insertions(+)
create mode 100644 man/man8/shmsnoop.8
create mode 100644 man/man8/spfdsnoop.8
create mode 100755 tools/shmsnoop.py
create mode 100644 tools/shmsnoop_example.txt
create mode 100755 tools/sofdsnoop.py
create mode 100644 tools/sofdsnoop_example.txt


Brendan Gregg
 

On Thu, Nov 8, 2018 at 6:47 AM Jiri Olsa <jolsa@...> wrote:

hi,
this is RFC patchset on 2 tools that our customer wants
and perhaps would like to see them upstream.

The sofdsnoop traces FDs passed through unix sockets:

# ./sofdsnoop
ACTION TID COMM SOCKET FD NAME
SEND 2576 Web Content 24:socket:[39763] 51 /dev/shm/org.mozilla.ipc.2576.23874
RECV 2576 Web Content 49:socket:[809997] 51
SEND 2576 Web Content 24:socket:[39763] 58 N/A
...

The shmsnoop tool to trace System V shared memory syscalls:

# ./shmsnoop.py
PID COMM SYS RET ARGs
19813 server SHMGET 10000 key: 0x78020001, size: 20, shmflg: 0x3b6 (IPC_CREAT|0666)
19813 server SHMAT 7f1cf8b1f000 shmid: 0x10000, shmaddr: 0x0, shmflg: 0x0
19816 client SHMGET 10000 key: 0x78020001, size: 20, shmflg: 0x1b6 (0666)
...

They are still under testing/review, but I'd like to
have some upstream folks opinions on these.
Tools look excellent, thanks! When you're ready, could you submit as a
github bcc PR? thanks,

Brendan


thanks,
jirka


---
Jiri Olsa (2):
tools: Add shmsnoop to spy on shm* syscalls
tools: Add sofdsnoop to spy on fds passed through socket

README.md | 2 +
man/man8/shmsnoop.8 | 74 +++++++++++++++++++++++++
man/man8/spfdsnoop.8 | 85 +++++++++++++++++++++++++++++
snapcraft/snapcraft.yaml | 6 ++
tests/python/test_tools_smoke.py | 8 +++
tools/shmsnoop.py | 335 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/shmsnoop_example.txt | 66 ++++++++++++++++++++++
tools/sofdsnoop.py | 355 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/sofdsnoop_example.txt | 69 +++++++++++++++++++++++
9 files changed, 1000 insertions(+)
create mode 100644 man/man8/shmsnoop.8
create mode 100644 man/man8/spfdsnoop.8
create mode 100755 tools/shmsnoop.py
create mode 100644 tools/shmsnoop_example.txt
create mode 100755 tools/sofdsnoop.py
create mode 100644 tools/sofdsnoop_example.txt