Run a given command once another given command starts running #106

Open
opened 2026-09-13 17:31:02 +02:00 by Benjamin_Loison · 20 comments
Owner

Related to #105.

Related to #105.
Author
Owner
Would help [Benjamin-Loison/android/issues/25](https://github.com/Benjamin-Loison/android/issues/25).
Author
Owner

Not just the program name is relevant, as irrelevant such program executions before the one I am looking for.

Not just the program name is relevant, as irrelevant such program executions before the one I am looking for.
Author
Owner
https://chat.mistral.ai/chat/c8805e4b-2a4b-44a2-863f-ce21cf482548
Author
Owner

I assume that the command that should be detected if not polled, should last enough to ask its command line arguments.

I assume that the command that should be detected if not polled, should last enough to ask its command line arguments.
Author
Owner
inotifywait --monitor /proc/
Output:
Setting up watches.
Watches established.
/proc/ OPEN meminfo
/proc/ ACCESS meminfo
/proc/ CLOSE_NOWRITE,CLOSE meminfo

While ran sleep 5.

```bash inotifywait --monitor /proc/ ``` <details> <summary>Output:</summary> ``` Setting up watches. Watches established. /proc/ OPEN meminfo /proc/ ACCESS meminfo /proc/ CLOSE_NOWRITE,CLOSE meminfo ``` </details> While ran `sleep 5`.
Author
Owner
inotifywait --recursive --monitor /proc/
Output:
Setting up watches.  Beware: since -r was given, this may take a while!
Failed to watch /proc/; upper limit on inotify watches reached!
Please increase the amount of inotify watches allowed per user via `/proc/sys/fs/inotify/max_user_watches'.
```bash inotifywait --recursive --monitor /proc/ ``` <details> <summary>Output:</summary> ``` Setting up watches. Beware: since -r was given, this may take a while! Failed to watch /proc/; upper limit on inotify watches reached! Please increase the amount of inotify watches allowed per user via `/proc/sys/fs/inotify/max_user_watches'. ``` </details>
Author
Owner
cat /proc/sys/fs/inotify/max_user_watches
65536
```bash cat /proc/sys/fs/inotify/max_user_watches ``` ``` 65536 ```
Author
Owner
https://chatgpt.com/share/6aa6cb63-38f4-83ed-877d-f7be7f9b64f5
Author
Owner

Listening to given program invocations, then investigate command line arguments would be fine.

Listening to given program invocations, then investigate command line arguments would be fine.
Author
Owner
https://chat.mistral.ai/chat/87957f08-3b5b-462d-bec0-b7b78aae1ead
Author
Owner

Could investigate Using auditd.

Could investigate *Using `auditd`*.
Author
Owner
Bash script:
sudo bpftrace -e '
tracepoint:syscalls:sys_enter_execve
/str(args.filename) == "/usr/bin/sleep"/
{
    system("/usr/bin/touch /home/ubuntu/proof");
}
'
Output:
stdin:5:5-48: ERROR: system() is an unsafe function being used in safe mode
    system("/usr/bin/touch /home/ubuntu/proof");
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<details> <summary>Bash script:</summary> ```bash sudo bpftrace -e ' tracepoint:syscalls:sys_enter_execve /str(args.filename) == "/usr/bin/sleep"/ { system("/usr/bin/touch /home/ubuntu/proof"); } ' ``` </details> <details> <summary>Output:</summary> ``` stdin:5:5-48: ERROR: system() is an unsafe function being used in safe mode system("/usr/bin/touch /home/ubuntu/proof"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` </details>
Author
Owner

DuckDuckGo and Google search "is an unsafe function being used in safe mode".

DuckDuckGo and Google search `"is an unsafe function being used in safe mode"`.
Author
Owner

https://chat.mistral.ai/chat/a63abce1-2e77-4752-928a-698503c0875d

Bash script:
sudo bpftrace --unsafe -e '
tracepoint:syscalls:sys_enter_execve
/str(args.filename) == "/usr/bin/sleep"/
{
    system("/usr/bin/touch /home/ubuntu/proof");
}
'
Attaching 1 probe...

hangs even after:

but proof is correctly created.

https://chat.mistral.ai/chat/a63abce1-2e77-4752-928a-698503c0875d <details> <summary>Bash script:</summary> ```bash sudo bpftrace --unsafe -e ' tracepoint:syscalls:sys_enter_execve /str(args.filename) == "/usr/bin/sleep"/ { system("/usr/bin/touch /home/ubuntu/proof"); } ' ``` </details> ``` Attaching 1 probe... ``` hangs even after: but `proof` is correctly created.
Author
Owner
tree /proc/$(pidof sleep)/
Output:
/proc/8075/
├── attr
│   ├── apparmor
│   │   ├── current
│   │   ├── exec
│   │   └── prev
│   ├── current
│   ├── exec
│   ├── fscreate
│   ├── keycreate
│   ├── prev
│   ├── smack
│   │   └── current
│   └── sockcreate
├── autogroup
├── auxv
├── cgroup
├── clear_refs
├── cmdline
├── comm
├── coredump_filter
├── cwd -> /home/ubuntu
├── environ
├── exe -> /usr/bin/sleep
├── fd
│   ├── 0 -> /dev/pts/3
│   ├── 1 -> /dev/pts/3
│   └── 2 -> /dev/pts/3
├── fdinfo
│   ├── 0
│   ├── 1
│   └── 2
├── gid_map
├── io
├── ksm_merging_pages
├── ksm_stat
├── latency
├── limits
├── loginuid
├── map_files
│   ├── ac9ddbb90000-ac9ddbb95000 -> /usr/bin/sleep
│   ├── ac9ddbbaf000-ac9ddbbb0000 -> /usr/bin/sleep
│   ├── ac9ddbbb0000-ac9ddbbb1000 -> /usr/bin/sleep
│   ├── e20258657000-e202586b0000 -> /usr/lib/locale/C.utf8/LC_CTYPE
│   ├── e202586b0000-e2025884a000 -> /usr/lib/aarch64-linux-gnu/libc.so.6
│   ├── e2025884a000-e2025885d000 -> /usr/lib/aarch64-linux-gnu/libc.so.6
│   ├── e2025885d000-e20258860000 -> /usr/lib/aarch64-linux-gnu/libc.so.6
│   ├── e20258860000-e20258862000 -> /usr/lib/aarch64-linux-gnu/libc.so.6
│   ├── e20258890000-e20258891000 -> /usr/lib/locale/C.utf8/LC_NUMERIC
│   ├── e20258891000-e20258892000 -> /usr/lib/locale/C.utf8/LC_TIME
│   ├── e20258892000-e20258893000 -> /usr/lib/locale/C.utf8/LC_COLLATE
│   ├── e20258893000-e202588ba000 -> /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1
│   ├── e202588ba000-e202588bb000 -> /usr/lib/locale/C.utf8/LC_MONETARY
│   ├── e202588bb000-e202588bc000 -> /usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES
│   ├── e202588bc000-e202588bd000 -> /usr/lib/locale/C.utf8/LC_PAPER
│   ├── e202588bd000-e202588be000 -> /usr/lib/locale/C.utf8/LC_NAME
│   ├── e202588be000-e202588bf000 -> /usr/lib/locale/C.utf8/LC_ADDRESS
│   ├── e202588bf000-e202588c0000 -> /usr/lib/locale/C.utf8/LC_TELEPHONE
│   ├── e202588c0000-e202588c1000 -> /usr/lib/locale/C.utf8/LC_MEASUREMENT
│   ├── e202588c1000-e202588c8000 -> /usr/lib/aarch64-linux-gnu/gconv/gconv-modules.cache
│   ├── e202588c8000-e202588c9000 -> /usr/lib/locale/C.utf8/LC_IDENTIFICATION
│   ├── e202588d1000-e202588d3000 -> /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1
│   └── e202588d3000-e202588d5000 -> /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1
├── maps
├── mem
├── mountinfo
├── mounts
├── mountstats
├── net
│   ├── anycast6
│   ├── arp
│   ├── connector
│   ├── dev
│   ├── dev_mcast
│   ├── dev_snmp6
│   │   ├── br-26c8c9b8fdee
│   │   ├── br-342afae0def9
│   │   ├── docker0
│   │   ├── enp0s6
│   │   ├── lo
│   │   ├── lxcbr0
│   │   ├── veth22744fa
│   │   └── virbr0
│   ├── fib_trie
│   ├── fib_triestat
│   ├── icmp
│   ├── icmp6
│   ├── if_inet6
│   ├── igmp
│   ├── igmp6
│   ├── ip6_flowlabel
│   ├── ip6_mr_cache
│   ├── ip6_mr_vif
│   ├── ip_mr_cache
│   ├── ip_mr_vif
│   ├── ip_tables_matches
│   ├── ip_tables_names
│   ├── ip_tables_targets
│   ├── ipv6_route
│   ├── mcfilter
│   ├── mcfilter6
│   ├── netfilter
│   │   └── nf_log
│   ├── netlink
│   ├── netstat
│   ├── packet
│   ├── protocols
│   ├── psched
│   ├── ptype
│   ├── raw
│   ├── raw6
│   ├── route
│   ├── rpc
│   │   ├── auth.unix.gid
│   │   │   ├── channel
│   │   │   ├── content
│   │   │   └── flush
│   │   └── auth.unix.ip
│   │       ├── channel
│   │       ├── content
│   │       └── flush
│   ├── rt6_stats
│   ├── rt_acct
│   ├── rt_cache
│   ├── snmp
│   ├── snmp6
│   ├── sockstat
│   ├── sockstat6
│   ├── softnet_stat
│   ├── stat
│   │   ├── arp_cache
│   │   ├── ndisc_cache
│   │   └── rt_cache
│   ├── tcp
│   ├── tcp6
│   ├── tls_stat
│   ├── udp
│   ├── udp6
│   ├── udplite
│   ├── udplite6
│   ├── unix
│   ├── vlan
│   │   └── config
│   ├── wireless
│   └── xfrm_stat
├── ns
│   ├── cgroup -> cgroup:[4026531835]
│   ├── ipc -> ipc:[4026531839]
│   ├── mnt -> mnt:[4026531832]
│   ├── net -> net:[4026531833]
│   ├── pid -> pid:[4026531836]
│   ├── pid_for_children -> pid:[4026531836]
│   ├── time -> time:[4026531834]
│   ├── time_for_children -> time:[4026531834]
│   ├── user -> user:[4026531837]
│   └── uts -> uts:[4026531838]
├── numa_maps
├── oom_adj
├── oom_score
├── oom_score_adj
├── pagemap
├── patch_state
├── personality
├── projid_map
├── root -> /
├── sched
├── schedstat
├── sessionid
├── setgroups
├── smaps
├── smaps_rollup
├── stack
├── stat
├── statm
├── status
├── syscall
├── task
│   └── 8075
│       ├── attr
│       │   ├── apparmor
│       │   │   ├── current
│       │   │   ├── exec
│       │   │   └── prev
│       │   ├── current
│       │   ├── exec
│       │   ├── fscreate
│       │   ├── keycreate
│       │   ├── prev
│       │   ├── smack
│       │   │   └── current
│       │   └── sockcreate
│       ├── auxv
│       ├── cgroup
│       ├── children
│       ├── clear_refs
│       ├── cmdline
│       ├── comm
│       ├── cwd -> /home/ubuntu
│       ├── environ
│       ├── exe -> /usr/bin/sleep
│       ├── fd
│       │   ├── 0 -> /dev/pts/3
│       │   ├── 1 -> /dev/pts/3
│       │   └── 2 -> /dev/pts/3
│       ├── fdinfo
│       │   ├── 0
│       │   ├── 1
│       │   └── 2
│       ├── gid_map
│       ├── io
│       ├── ksm_merging_pages
│       ├── ksm_stat
│       ├── latency
│       ├── limits
│       ├── loginuid
│       ├── maps
│       ├── mem
│       ├── mountinfo
│       ├── mounts
│       ├── net
│       │   ├── anycast6
│       │   ├── arp
│       │   ├── connector
│       │   ├── dev
│       │   ├── dev_mcast
│       │   ├── dev_snmp6
│       │   │   ├── br-26c8c9b8fdee
│       │   │   ├── br-342afae0def9
│       │   │   ├── docker0
│       │   │   ├── enp0s6
│       │   │   ├── lo
│       │   │   ├── lxcbr0
│       │   │   ├── veth22744fa
│       │   │   └── virbr0
│       │   ├── fib_trie
│       │   ├── fib_triestat
│       │   ├── icmp
│       │   ├── icmp6
│       │   ├── if_inet6
│       │   ├── igmp
│       │   ├── igmp6
│       │   ├── ip6_flowlabel
│       │   ├── ip6_mr_cache
│       │   ├── ip6_mr_vif
│       │   ├── ip_mr_cache
│       │   ├── ip_mr_vif
│       │   ├── ip_tables_matches
│       │   ├── ip_tables_names
│       │   ├── ip_tables_targets
│       │   ├── ipv6_route
│       │   ├── mcfilter
│       │   ├── mcfilter6
│       │   ├── netfilter
│       │   │   └── nf_log
│       │   ├── netlink
│       │   ├── netstat
│       │   ├── packet
│       │   ├── protocols
│       │   ├── psched
│       │   ├── ptype
│       │   ├── raw
│       │   ├── raw6
│       │   ├── route
│       │   ├── rpc
│       │   │   ├── auth.unix.gid
│       │   │   │   ├── channel
│       │   │   │   ├── content
│       │   │   │   └── flush
│       │   │   └── auth.unix.ip
│       │   │       ├── channel
│       │   │       ├── content
│       │   │       └── flush
│       │   ├── rt6_stats
│       │   ├── rt_acct
│       │   ├── rt_cache
│       │   ├── snmp
│       │   ├── snmp6
│       │   ├── sockstat
│       │   ├── sockstat6
│       │   ├── softnet_stat
│       │   ├── stat
│       │   │   ├── arp_cache
│       │   │   ├── ndisc_cache
│       │   │   └── rt_cache
│       │   ├── tcp
│       │   ├── tcp6
│       │   ├── tls_stat
│       │   ├── udp
│       │   ├── udp6
│       │   ├── udplite
│       │   ├── udplite6
│       │   ├── unix
│       │   ├── vlan
│       │   │   └── config
│       │   ├── wireless
│       │   └── xfrm_stat
│       ├── ns
│       │   ├── cgroup -> cgroup:[4026531835]
│       │   ├── ipc -> ipc:[4026531839]
│       │   ├── mnt -> mnt:[4026531832]
│       │   ├── net -> net:[4026531833]
│       │   ├── pid -> pid:[4026531836]
│       │   ├── pid_for_children -> pid:[4026531836]
│       │   ├── time -> time:[4026531834]
│       │   ├── time_for_children -> time:[4026531834]
│       │   ├── user -> user:[4026531837]
│       │   └── uts -> uts:[4026531838]
│       ├── numa_maps
│       ├── oom_adj
│       ├── oom_score
│       ├── oom_score_adj
│       ├── pagemap
│       ├── patch_state
│       ├── personality
│       ├── projid_map
│       ├── root -> /
│       ├── sched
│       ├── schedstat
│       ├── sessionid
│       ├── setgroups
│       ├── smaps
│       ├── smaps_rollup
│       ├── stack
│       ├── stat
│       ├── statm
│       ├── status
│       ├── syscall
│       ├── uid_map
│       └── wchan
├── timens_offsets
├── timers
├── timerslack_ns
├── uid_map
└── wchan

36 directories, 298 files
```bash tree /proc/$(pidof sleep)/ ``` <details> <summary>Output:</summary> ``` /proc/8075/ ├── attr │   ├── apparmor │   │   ├── current │   │   ├── exec │   │   └── prev │   ├── current │   ├── exec │   ├── fscreate │   ├── keycreate │   ├── prev │   ├── smack │   │   └── current │   └── sockcreate ├── autogroup ├── auxv ├── cgroup ├── clear_refs ├── cmdline ├── comm ├── coredump_filter ├── cwd -> /home/ubuntu ├── environ ├── exe -> /usr/bin/sleep ├── fd │   ├── 0 -> /dev/pts/3 │   ├── 1 -> /dev/pts/3 │   └── 2 -> /dev/pts/3 ├── fdinfo │   ├── 0 │   ├── 1 │   └── 2 ├── gid_map ├── io ├── ksm_merging_pages ├── ksm_stat ├── latency ├── limits ├── loginuid ├── map_files │   ├── ac9ddbb90000-ac9ddbb95000 -> /usr/bin/sleep │   ├── ac9ddbbaf000-ac9ddbbb0000 -> /usr/bin/sleep │   ├── ac9ddbbb0000-ac9ddbbb1000 -> /usr/bin/sleep │   ├── e20258657000-e202586b0000 -> /usr/lib/locale/C.utf8/LC_CTYPE │   ├── e202586b0000-e2025884a000 -> /usr/lib/aarch64-linux-gnu/libc.so.6 │   ├── e2025884a000-e2025885d000 -> /usr/lib/aarch64-linux-gnu/libc.so.6 │   ├── e2025885d000-e20258860000 -> /usr/lib/aarch64-linux-gnu/libc.so.6 │   ├── e20258860000-e20258862000 -> /usr/lib/aarch64-linux-gnu/libc.so.6 │   ├── e20258890000-e20258891000 -> /usr/lib/locale/C.utf8/LC_NUMERIC │   ├── e20258891000-e20258892000 -> /usr/lib/locale/C.utf8/LC_TIME │   ├── e20258892000-e20258893000 -> /usr/lib/locale/C.utf8/LC_COLLATE │   ├── e20258893000-e202588ba000 -> /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 │   ├── e202588ba000-e202588bb000 -> /usr/lib/locale/C.utf8/LC_MONETARY │   ├── e202588bb000-e202588bc000 -> /usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES │   ├── e202588bc000-e202588bd000 -> /usr/lib/locale/C.utf8/LC_PAPER │   ├── e202588bd000-e202588be000 -> /usr/lib/locale/C.utf8/LC_NAME │   ├── e202588be000-e202588bf000 -> /usr/lib/locale/C.utf8/LC_ADDRESS │   ├── e202588bf000-e202588c0000 -> /usr/lib/locale/C.utf8/LC_TELEPHONE │   ├── e202588c0000-e202588c1000 -> /usr/lib/locale/C.utf8/LC_MEASUREMENT │   ├── e202588c1000-e202588c8000 -> /usr/lib/aarch64-linux-gnu/gconv/gconv-modules.cache │   ├── e202588c8000-e202588c9000 -> /usr/lib/locale/C.utf8/LC_IDENTIFICATION │   ├── e202588d1000-e202588d3000 -> /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 │   └── e202588d3000-e202588d5000 -> /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 ├── maps ├── mem ├── mountinfo ├── mounts ├── mountstats ├── net │   ├── anycast6 │   ├── arp │   ├── connector │   ├── dev │   ├── dev_mcast │   ├── dev_snmp6 │   │   ├── br-26c8c9b8fdee │   │   ├── br-342afae0def9 │   │   ├── docker0 │   │   ├── enp0s6 │   │   ├── lo │   │   ├── lxcbr0 │   │   ├── veth22744fa │   │   └── virbr0 │   ├── fib_trie │   ├── fib_triestat │   ├── icmp │   ├── icmp6 │   ├── if_inet6 │   ├── igmp │   ├── igmp6 │   ├── ip6_flowlabel │   ├── ip6_mr_cache │   ├── ip6_mr_vif │   ├── ip_mr_cache │   ├── ip_mr_vif │   ├── ip_tables_matches │   ├── ip_tables_names │   ├── ip_tables_targets │   ├── ipv6_route │   ├── mcfilter │   ├── mcfilter6 │   ├── netfilter │   │   └── nf_log │   ├── netlink │   ├── netstat │   ├── packet │   ├── protocols │   ├── psched │   ├── ptype │   ├── raw │   ├── raw6 │   ├── route │   ├── rpc │   │   ├── auth.unix.gid │   │   │   ├── channel │   │   │   ├── content │   │   │   └── flush │   │   └── auth.unix.ip │   │   ├── channel │   │   ├── content │   │   └── flush │   ├── rt6_stats │   ├── rt_acct │   ├── rt_cache │   ├── snmp │   ├── snmp6 │   ├── sockstat │   ├── sockstat6 │   ├── softnet_stat │   ├── stat │   │   ├── arp_cache │   │   ├── ndisc_cache │   │   └── rt_cache │   ├── tcp │   ├── tcp6 │   ├── tls_stat │   ├── udp │   ├── udp6 │   ├── udplite │   ├── udplite6 │   ├── unix │   ├── vlan │   │   └── config │   ├── wireless │   └── xfrm_stat ├── ns │   ├── cgroup -> cgroup:[4026531835] │   ├── ipc -> ipc:[4026531839] │   ├── mnt -> mnt:[4026531832] │   ├── net -> net:[4026531833] │   ├── pid -> pid:[4026531836] │   ├── pid_for_children -> pid:[4026531836] │   ├── time -> time:[4026531834] │   ├── time_for_children -> time:[4026531834] │   ├── user -> user:[4026531837] │   └── uts -> uts:[4026531838] ├── numa_maps ├── oom_adj ├── oom_score ├── oom_score_adj ├── pagemap ├── patch_state ├── personality ├── projid_map ├── root -> / ├── sched ├── schedstat ├── sessionid ├── setgroups ├── smaps ├── smaps_rollup ├── stack ├── stat ├── statm ├── status ├── syscall ├── task │   └── 8075 │   ├── attr │   │   ├── apparmor │   │   │   ├── current │   │   │   ├── exec │   │   │   └── prev │   │   ├── current │   │   ├── exec │   │   ├── fscreate │   │   ├── keycreate │   │   ├── prev │   │   ├── smack │   │   │   └── current │   │   └── sockcreate │   ├── auxv │   ├── cgroup │   ├── children │   ├── clear_refs │   ├── cmdline │   ├── comm │   ├── cwd -> /home/ubuntu │   ├── environ │   ├── exe -> /usr/bin/sleep │   ├── fd │   │   ├── 0 -> /dev/pts/3 │   │   ├── 1 -> /dev/pts/3 │   │   └── 2 -> /dev/pts/3 │   ├── fdinfo │   │   ├── 0 │   │   ├── 1 │   │   └── 2 │   ├── gid_map │   ├── io │   ├── ksm_merging_pages │   ├── ksm_stat │   ├── latency │   ├── limits │   ├── loginuid │   ├── maps │   ├── mem │   ├── mountinfo │   ├── mounts │   ├── net │   │   ├── anycast6 │   │   ├── arp │   │   ├── connector │   │   ├── dev │   │   ├── dev_mcast │   │   ├── dev_snmp6 │   │   │   ├── br-26c8c9b8fdee │   │   │   ├── br-342afae0def9 │   │   │   ├── docker0 │   │   │   ├── enp0s6 │   │   │   ├── lo │   │   │   ├── lxcbr0 │   │   │   ├── veth22744fa │   │   │   └── virbr0 │   │   ├── fib_trie │   │   ├── fib_triestat │   │   ├── icmp │   │   ├── icmp6 │   │   ├── if_inet6 │   │   ├── igmp │   │   ├── igmp6 │   │   ├── ip6_flowlabel │   │   ├── ip6_mr_cache │   │   ├── ip6_mr_vif │   │   ├── ip_mr_cache │   │   ├── ip_mr_vif │   │   ├── ip_tables_matches │   │   ├── ip_tables_names │   │   ├── ip_tables_targets │   │   ├── ipv6_route │   │   ├── mcfilter │   │   ├── mcfilter6 │   │   ├── netfilter │   │   │   └── nf_log │   │   ├── netlink │   │   ├── netstat │   │   ├── packet │   │   ├── protocols │   │   ├── psched │   │   ├── ptype │   │   ├── raw │   │   ├── raw6 │   │   ├── route │   │   ├── rpc │   │   │   ├── auth.unix.gid │   │   │   │   ├── channel │   │   │   │   ├── content │   │   │   │   └── flush │   │   │   └── auth.unix.ip │   │   │   ├── channel │   │   │   ├── content │   │   │   └── flush │   │   ├── rt6_stats │   │   ├── rt_acct │   │   ├── rt_cache │   │   ├── snmp │   │   ├── snmp6 │   │   ├── sockstat │   │   ├── sockstat6 │   │   ├── softnet_stat │   │   ├── stat │   │   │   ├── arp_cache │   │   │   ├── ndisc_cache │   │   │   └── rt_cache │   │   ├── tcp │   │   ├── tcp6 │   │   ├── tls_stat │   │   ├── udp │   │   ├── udp6 │   │   ├── udplite │   │   ├── udplite6 │   │   ├── unix │   │   ├── vlan │   │   │   └── config │   │   ├── wireless │   │   └── xfrm_stat │   ├── ns │   │   ├── cgroup -> cgroup:[4026531835] │   │   ├── ipc -> ipc:[4026531839] │   │   ├── mnt -> mnt:[4026531832] │   │   ├── net -> net:[4026531833] │   │   ├── pid -> pid:[4026531836] │   │   ├── pid_for_children -> pid:[4026531836] │   │   ├── time -> time:[4026531834] │   │   ├── time_for_children -> time:[4026531834] │   │   ├── user -> user:[4026531837] │   │   └── uts -> uts:[4026531838] │   ├── numa_maps │   ├── oom_adj │   ├── oom_score │   ├── oom_score_adj │   ├── pagemap │   ├── patch_state │   ├── personality │   ├── projid_map │   ├── root -> / │   ├── sched │   ├── schedstat │   ├── sessionid │   ├── setgroups │   ├── smaps │   ├── smaps_rollup │   ├── stack │   ├── stat │   ├── statm │   ├── status │   ├── syscall │   ├── uid_map │   └── wchan ├── timens_offsets ├── timers ├── timerslack_ns ├── uid_map └── wchan 36 directories, 298 files ``` </details>
Author
Owner
ls -l /proc/$(pidof sleep)/cmdline
-r--r--r-- 1 ubuntu ubuntu 0 Sep 13 22:30 /proc/8089/cmdline
```bash ls -l /proc/$(pidof sleep)/cmdline ``` ``` -r--r--r-- 1 ubuntu ubuntu 0 Sep 13 22:30 /proc/8089/cmdline ```
Author
Owner
grep -rw 7297 /proc/$(pidof sleep)/
Output:
grep: /proc/8111/task/8111/net/rpc/auth.unix.ip/flush: Permission denied
grep: /proc/8111/task/8111/net/rpc/auth.unix.ip/channel: Permission denied
grep: /proc/8111/task/8111/net/rpc/auth.unix.ip/content: Permission denied
grep: /proc/8111/task/8111/net/rpc/auth.unix.gid/flush: Permission denied
grep: /proc/8111/task/8111/net/rpc/auth.unix.gid/channel: Permission denied
grep: /proc/8111/task/8111/net/rpc/auth.unix.gid/content: Permission denied
grep: /proc/8111/task/8111/net/vlan/config: Permission denied
grep: /proc/8111/task/8111/net/ip_tables_names: Permission denied
grep: /proc/8111/task/8111/net/ip_tables_matches: Permission denied
grep: /proc/8111/task/8111/net/ip_tables_targets: Permission denied
grep: /proc/8111/task/8111/personality: Operation not permitted
grep: /proc/8111/task/8111/syscall: Operation not permitted
grep: /proc/8111/task/8111/cmdline: binary file matches
grep: /proc/8111/task/8111/mem: Permission denied
grep: /proc/8111/task/8111/clear_refs: Permission denied

I interrupted it.

sudo grep -rw 7297 /proc/$(pidof sleep)/
Output:
grep: /proc/8111/task/8111/cmdline: binary file matches
grep: /proc/8111/task/8111/mem: Input/output error
grep: /proc/8111/task/8111/clear_refs: Invalid argument

hangs.

```bash grep -rw 7297 /proc/$(pidof sleep)/ ``` <details> <summary>Output:</summary> ``` grep: /proc/8111/task/8111/net/rpc/auth.unix.ip/flush: Permission denied grep: /proc/8111/task/8111/net/rpc/auth.unix.ip/channel: Permission denied grep: /proc/8111/task/8111/net/rpc/auth.unix.ip/content: Permission denied grep: /proc/8111/task/8111/net/rpc/auth.unix.gid/flush: Permission denied grep: /proc/8111/task/8111/net/rpc/auth.unix.gid/channel: Permission denied grep: /proc/8111/task/8111/net/rpc/auth.unix.gid/content: Permission denied grep: /proc/8111/task/8111/net/vlan/config: Permission denied grep: /proc/8111/task/8111/net/ip_tables_names: Permission denied grep: /proc/8111/task/8111/net/ip_tables_matches: Permission denied grep: /proc/8111/task/8111/net/ip_tables_targets: Permission denied grep: /proc/8111/task/8111/personality: Operation not permitted grep: /proc/8111/task/8111/syscall: Operation not permitted grep: /proc/8111/task/8111/cmdline: binary file matches grep: /proc/8111/task/8111/mem: Permission denied grep: /proc/8111/task/8111/clear_refs: Permission denied ``` </details> I interrupted it. ```bash sudo grep -rw 7297 /proc/$(pidof sleep)/ ``` <details> <summary>Output:</summary> ``` grep: /proc/8111/task/8111/cmdline: binary file matches grep: /proc/8111/task/8111/mem: Input/output error grep: /proc/8111/task/8111/clear_refs: Invalid argument ``` </details> hangs.
Author
Owner
ls -l /proc/$(pidof sleep)/task/$(pidof sleep)/cmdline
-r--r--r-- 1 ubuntu ubuntu 0 Sep 13 22:31 /proc/8111/task/8111/cmdline
```bash ls -l /proc/$(pidof sleep)/task/$(pidof sleep)/cmdline ``` ``` -r--r--r-- 1 ubuntu ubuntu 0 Sep 13 22:31 /proc/8111/task/8111/cmdline ```
Author
Owner
cat -A /proc/$(pidof sleep)/cmdline
sleep␀7297␀
```bash cat -A /proc/$(pidof sleep)/cmdline ``` ``` sleep␀7297␀ ```
Author
Owner

Could inotifywait the created file or print as Mistral propose and grep -m 1 on it maybe.

Could `inotifywait` the created file or print as Mistral propose and `grep -m 1` on it maybe.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/linux#106