Skip to main content

Questions tagged [proc]

procfs (or the proc filesystem) is a special filesystem in UNIX-like operating systems that presents information about processes and other system information in a hierarchical file-like structure

Filter by
Sorted by
Tagged with
0 votes
2 answers
42 views

What other channels besides /proc are there to obtain process information?

We know that process information can be obtained from the /proc directory, such as being able to see the PID of all processes, etc. And many user commands, such as top, ps, and so on, essentially ...
w zc's user avatar
  • 1
0 votes
1 answer
46 views

Running command 'cat /proc/<pid>/stat | cut -d" " -f29' to get stack pointer , is always showing stack pointer as zero

Iam trying to get the stack pointer of some thread using the /proc//stat, whenever i run the command,cat /proc/<pid>/stat | cut -d" " -f29 i end up getting zero, but when i run sudo ...
Hodgson Tetteh's user avatar
0 votes
1 answer
56 views

Why the access to /proc/[pid]/ns needs to generate symlinks?

The directories of the form /proc/[pid]/ns get populated each time they are accessed. That is, each time they are accessed the kernel produces a symlink to somewhere in the namespace filesystem (not ...
caciquekampeon's user avatar
0 votes
0 answers
26 views

Grant one process access to proc of another process?

I'd like a monitoring daemon to be able to access /proc/<PID>/smaps_rollup of another process to be able to report swap usage of that process. I found information that access to that file is &...
AndreKR's user avatar
  • 1,110
0 votes
1 answer
33 views

Why that the process' comm value is from last 15 characters of process name but the thread's comm value is from top 15 characters?

I'm developing on Android 11 device. I am confused that the process' comm value is from last 15 characters of process name but the thread's comm value is from top 15 characters. Does any man page ...
czjabc's user avatar
  • 3
3 votes
1 answer
68 views

Thread Name: Is /proc/pid/comm always identical to the Name: line of /proc/pid/status and the second field of /proc/pid/stat?

A Linux thread or forked process may change its name and/or its commandline as visible by ps or in the /proc filesystem. When using the python-setproctitle package, the same change occurs on /proc/pid/...
Juergen's user avatar
  • 702
1 vote
1 answer
57 views

Count the total processes spawned using /proc/loadavg

In a Red Hat Linux 8 operating system, I examined the output of cat /proc/loadavg and obtained "5.20 5.78 8.04 16/1596 1954863". After 4 minutes, I rechecked the /proc/loadavg output and ...
GSK's user avatar
  • 11
0 votes
1 answer
59 views

Discrepancy between values in htop and /proc/meminfo

From the author of htops answer https://stackoverflow.com/questions/41224738/how-to-calculate-system-memory-usage-from-proc-meminfo-like-htop/41251290#41251290 I got to know that the total memory in ...
ArunJose's user avatar
  • 103
0 votes
0 answers
160 views

SElinux denies to access file in /proc

My audit plugin process needs to be able to iterate through /proc and read /proc/pid/stat files, but SElinux refuses this. Process context of my plugin: ps auxZ | grep -i myplugin system_u:system_r:...
ibse's user avatar
  • 341
9 votes
2 answers
531 views

ps -o pid,ppid,stat,exe -e | grep deleted has "(deleted)" appended to the executable path

ps -o pid,ppid,stat,exe -e | grep deleted generates output like this: 1777 1346 Sl /usr/bin/python3.10 (deleted) 1778 1346 Sl /usr/bin/python3.10 (deleted) 1825 1327 Ss /usr/...
Dave The Dane's user avatar
2 votes
1 answer
270 views

How can I locate the stacks of child tasks (threads) using /proc/<pid>/maps?

PURPOSE: I am theorising as to how one would go about creating a pointer scanner in a Linux environment. DISCLAIMER: My findings have been tested on Debian Bookworm (current stable) and a Gentoo ...
vykt's user avatar
  • 21
0 votes
0 answers
17 views

Disparity between file-nr and netstat

> netstat | grep :389 | grep ESTABLISHED | wc -l 2116 > cat /proc/sys/fs/file-nr 1920 0 3178047 how can a subset of the number of tcp connections be more than the total number of file ...
soupybionics's user avatar
1 vote
1 answer
368 views

How do I determine the PID of the shell running a given pts/tty?

There are many ways to obtain the PTS associated with a given process - such as using the tty command or resolving /proc/self/fd/0 (assuming it's open and not redirected) - but what about the inverse? ...
Tenders McChiken's user avatar
0 votes
0 answers
43 views

File descriptor counts differ

There is something fundamental that I miss here, I am sure. On a system I run: cat /proc/sys/fs/file-nr 2240 0 763924 On the same system, if I do : sum=0; for pid in /proc/[0-9]*; do fd=$(ls $...
Eugene's user avatar
  • 101
4 votes
1 answer
480 views

Why isn't access to /proc/pid/mem a security vulnerability?

I've played around a bit with /proc/pid/mem and /proc/pid/maps. I wrote a simple c program that just periodically reads from a variable (whose address is written to stdout), and I was able to change ...
gypaete02's user avatar
0 votes
1 answer
246 views

Who mounts /proc and /sys in GNU/Linux systems?

If you build a custom GNU/Linux system for an embedded device, do you need to execute mount -t proc proc /proc mount -t sysfs sysfs /sys somewhere in init process or is this done automatically by the ...
mrn's user avatar
  • 149
0 votes
1 answer
219 views

sudo cannot ls root owned files in /proc

I am on Debian 12 and I am trying to write a script to identify processes with certain inodes (from /proc/net/raw and /proc/net/packet). My original grep command is this (to get only the pid itself): ...
user avatar
0 votes
1 answer
65 views

Memory total shown on Linux on 8GB memory PC is only 7038920 kB

Why linux /proc/meminfo show:" 1 MemTotal: 7038920 kB " (proc most likely is to mean Kibibyte) in a PC of 8 GB memory RAM, although its Kibibyte is 7812500 ?
user avatar
0 votes
0 answers
123 views

Running an application that requires read access to /proc

I'm trying to run an application that requires access to /proc in order to find the gnome-shell process and its environment variables. My guess is that this application used to work but default ...
Olumide's user avatar
  • 177
8 votes
2 answers
1k views

Should the use of /etc/mtab now be considered deprecated?

I'm curious about the file or symlink /etc/mtab. I believe this is a legacy mechanism. On every modern linux I've used this is a symbolic link to /proc/mounts and if mtab were to be a regular file on ...
Philip Couling's user avatar
1 vote
0 answers
74 views

How would you assign read-only permissions to run ls -l /proc/{pid}/fd for processes you don't own using SELinux in Android

I am developing an application on Android as a non-root user.  However, I need read access to all the /proc/{pid}/fd files so as to check the inode numbers from the symlink under fd. How do I do that ...
Mahavir Surana's user avatar
6 votes
1 answer
516 views

"Others" cannot read 'smaps_rollup' file with -r--r--r-- permission under /proc/PID/. Why?

I'm trying to read two specific files, namely status and smaps_rollup for all the processes under /proc. All process directories have dr-xr-xr-x permission and I'm able to enter every one of these ...
Firelord's user avatar
  • 342
3 votes
1 answer
121 views

zathura and ownership of files in /proc/PID

Yesterday, while writing an answer to How to get full path names of all opened pdf files (in zathura) - like rofi does, I noticed something weird about the ownership of files the /proc/PID/ directory ...
cas's user avatar
  • 79.2k
1 vote
1 answer
274 views

Accessing /proc from foreign chroot

I am trying to set up a foreign chroot environment with QEMU, mostly as described at https://www.hellion.org.uk/blog/posts/foreign-chroots-with-schroot-and-qemu/. The host system is Ubuntu x86_64 (on ...
user149408's user avatar
  • 1,333
2 votes
0 answers
265 views

How can I find out what changes the value in /proc/sys/kernel/sysrq?

For some reason the value stored in the /proc/sys/kernel/sysrq file on my system changes to 16. It happens quite frequently, like once-twice an hour but in a random moment of time. As I understand, I ...
GRbit's user avatar
  • 21
1 vote
0 answers
148 views

Why is there more `time_wait` displayed in `sockstat` than it actually is?

Why is there more time_wait displayed in /proc/net/sockstat than it actually is? And how to fix it? [root@node09 ~]# netstat -ant | grep TIME_WAIT | wc -l 28 [root@node09 ~]# netstat -ant|awk '/^tcp/ ...
LiangZheng's user avatar
0 votes
1 answer
347 views

How Do Logs Get From "Kernel Ring Buffer" to "/proc/kmgs" and "/dev/kmsg"?

I can not get any reliable information about how do kernel logs get from Kernel Ring Buffer to /proc/kmgs and /dev/kmsg. Is there any source I could have possbily missed or does perhaps anyone know ...
GabrijelOkorn's user avatar
3 votes
2 answers
3k views

What does the SPID abbreviation stand for?

The ps command with the -T flag outputs the SPID column, which is also called TID(Thread ID). But what does SPID stand for? The ps source code doesn't seem to know why this name is either: trace("...
deevroman's user avatar
0 votes
1 answer
284 views

Output text file contents (/proc/interrupts) as they change [duplicate]

Is there some command I can use to monitor changes in /proc/interrupt? For example, using head -4 I can see that the file is changing, but only if I run head again and again: > head -4 /proc/...
emacs drives me nuts's user avatar
0 votes
1 answer
162 views

Setting file contexts on /proc files

I want to restrict access to files in /proc as much as possible using SELinux. When I try to chcon a directory in /proc, it fails: $ chcon -t staff_proc_t /proc/acpi chcon: failed to change context of ...
jiwopene's user avatar
  • 1,071
0 votes
0 answers
202 views

How do you map a pointer location to /proc/self/{map,mem}?

I am trying to write a light weight test to determine if sensitive parameters are getting zero'd in active memory after use. Here is what I thought would work: Get the pointer location of the ...
Liam Kelly's user avatar
0 votes
1 answer
844 views

How to dump the stack and heap of a running application to determine if zeroization is occuring?

I am trying to ensure that after the use of sensitive parameters, a program zero-es them from all active memory (stack and heap). The simple test I was hoping to perform was to dump the active memory ...
Liam Kelly's user avatar
4 votes
1 answer
1k views

What mechanism prevents me from reading /proc/<PID>/environ in containers with a PID namespace shared with the host?

While investigating sharing the PID namespace with containers, I noticed something interesting that I don't understand. When a container shares the PID namespace with the host, some processes have ...
Dejan Zelic's user avatar
2 votes
0 answers
227 views

Java threads and /proc/ directory on linux

I have a Java program that uses a pool of worker threads, that execute the work. These threads are dynamic, so the program creates and removes threads dynamically. The thread is running while a ...
Tom Eeraerts's user avatar
4 votes
3 answers
2k views

is it safe to do chmod 640 /etc/passwd /etc/group?

I want to prevent users being able to see other system users. I've prevented listing of processes with hidepid=2 mount option to /proc, prevented listing of other users' home directories, but they can ...
Tomasz's user avatar
  • 197
3 votes
1 answer
250 views

Binary format of IPv6 loopback address

In one terminal, I ran $ nc -l -6 ::1 5000 In another terminal, I ran $ cat /proc/net/tcp6 and saw this line: 0: 00000000000000000000000001000000:1388 00000000000000000000000000000000:0000 ... ...
Daniel Walker's user avatar
1 vote
0 answers
213 views

Safe to write to /proc/self/fd/N

Is it safe to write to /proc/self/fd/N where N is any file descriptor owned by the process. My use case is to ssh into a remote machine and cat many remote files to local files. The local files were ...
user138645's user avatar
1 vote
1 answer
429 views

Number of open sockets in /proc/pid/fd does not agree with netstat

I'm running into a weird socket issue when running my own crawler. It opens and cloees a lot of TCP sockets rapidly due to the protocol design. It's something I have to live with. I'm very sure in ...
Mary Chang's user avatar
8 votes
1 answer
1k views

How does /proc interact with PID namespaces?

I do not understand how namespaces interact with /proc. I assumed that /proc returns values based on the process that queries them. For example, let's determine the PID of the current process inside ...
Georg Schölly's user avatar
-1 votes
1 answer
2k views

file /proc/kcore took up all free space in the system and and it won't let you install programs

I have Kali linux OS. When I try install dkms I have got this: └─# sudo apt install dkms Reading package lists... Done Building dependency tree... Done Reading state information... Done The following ...
Dmitriy Ogureckiy's user avatar
2 votes
0 answers
53 views

Overlapping address ranges in /proc/.../maps

On some Android devices (possibly only on Android 10 and newer), looking at /proc/self/maps, I observed entries like the following two lines: 79cfd4d000-79cfff5000 --xp 0012e000 fd:00 286 /apex/com....
David Scherfgen's user avatar
23 votes
2 answers
9k views

kernel 5.10.119 caused the values of /proc/sys/kernel/random/entropy_avail and poolsize to be 256

After update to kernel 5.10.119, /proc/sys/kernel/random/entropy_avail became stuck to 256 and does not change when moving the mouse. It used to be greater than 3000. # cat /proc/sys/kernel/random/...
user528206's user avatar
1 vote
1 answer
4k views

Why is VmallocTotal 34359738367 kB?

/proc/meminfo has a memory statistic VmallocTotal. It is described as Total size of vmalloc memory area. in proc's man page and elsewhere as Total memory available in kernel for vmalloc allocations ...
Arthur Tarasov's user avatar
3 votes
2 answers
2k views

What do the permissions mean in /proc/<pid>/fd/?

I'm looking at the result of running ls -l on /proc/<pid>/fd/: lr-x------ 1 root root 64 Apr 22 23:13 0 -> /dev/null lrwx------ 1 root root 64 Apr 22 23:13 1 -> 'socket:[19700]' lrwx------ ...
Daniel Walker's user avatar
2 votes
1 answer
427 views

How to get NSPid on kernel 3.10

In kernel 4.1 and above, /proc/[pid]/status contains these 4 lines: NStgid: 1 NSpid: 1 NSpgid: 1 NSsid: 1 This allow a process in parent namespace to know about that process' PID in all namespaces. ...
yoru's user avatar
  • 23
0 votes
1 answer
67 views

Kernel option in /sys change

If /proc/sys and /sys are the same, can I change the kernel options in /sys not in /proc/sys? If not, why?
quber's user avatar
  • 65
1 vote
1 answer
1k views

Linux: difference between "/usr/bin/env" and "/usr/bin/strings /proc/$$/environ"

I am learning about linux and I have a question that I have encountered in one of the books I read: The following are two different ways to print out environment variables. Please describe their ...
linuxbeginner's user avatar
1 vote
3 answers
1k views

Given we have the API /proc/pid/status should/could /proc/pid/stat be deprecated?

I have a few questions about the process information avaiable in GNU/Linux via procfs. This was originally prompted by a desire to extract vmPeak, vmSize, vmRSS & vmHWM from within an application....
Bruce Adams's user avatar
0 votes
1 answer
5k views

/proc won't mount in kali linux running under Android

I'm now using kali Linux on termux. I had several problems like /proc is not mounted, /proc permission denied, etc. ps -auxtells this: > root@localhost:~# ps -aux > > Error: /proc must be ...
Mus_90YT's user avatar
0 votes
1 answer
810 views

How can `cat` read a file without a file descriptor?

I'm learning Linux procfs, which utilizes a virtual file system where operations like open, read, write, and release are processed by functions registered to it. I've left the open and release to null ...
victrid's user avatar
  • 183

1
2 3 4 5
11