2

I have several questions regarding the handling of procfs or sysctl values.

Can a feature be enabled with a missing /proc file?

Does a missing /proc or sysctl entry always mean that the option is not enabled on that particular kernel? In other words: Can a feature be enabled or supported by a kernel without a corresponding /proc entry being available? I assume nobody changed the kernel source in a way to remove the code part that populates /proc.

If it can - does it default to a specific value?

I'd like to know if /proc values default to a value if the corresponding proc-File doesn't exist. If for some reason my kernel supports aslr, but /sys/kernel/randomize_va_space doesn't exist, does that result in aslr being active or not?

Is the behaviour the same for all settings?

Is the behaviour the same for all kernels, versions and features? Or do I have to get this information for each setting individually?

For example:

If /proc/sys/kernel/sysrq doesn't exist on my machine, does that mean

  1. that the Magic SysRQ feature is not available on my kernel?

  2. that it is available?

  3. that it could be available or not depending on some other option that is unknown to me?

  4. that the specific code for this feature contains a hard-coded default and this setting is different for each feature on the kernel? So if I want to know what value it defaults to, I have to take a look at to code for each feature.

There is good documentation available where I can read about the meaning of the kernel settings. Is there a document that explains the default behavior?

Jeter-work
  • 825
  • 4
  • 15
user5626466
  • 123
  • 6

1 Answers1

1

/proc and /sys directories are for exposing the "tuning knobs" of the Liunx kernel. It is entirely possible, albeit quite rare, to have some working kernel features without any entries in /proc or /sys - for example, if that kernel feature does not have any parameters, nor has anything to publish to the user, no entries are required.

However if the kernel documentation has some entries documented/referenced but you can not find them, two possibilities arise:

  • you are using an old kernel, without these knobs;
  • you are not using a vanilla kernel - ie your kernel is more or less heavily customized by someone (yours distro maintainer, probably).

If you think some features are enabled on your kernel but you can not find any entries in /proc and /sys, give a look at your kernel config file (often available via a file in /boot or in /proc/config.gz)

shodanshok
  • 44,038
  • 6
  • 98
  • 162