Skip to contentSkip to conversation

alloc_tag: Tighten file permissions on /proc/allocinfo

PATCH Applied Kees Cook 6 participants 21 messages Apr 25, 2024 – Apr 26, 2024

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 alloc_tag: Tighten file permissions on /proc/allocinfo

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

---
Cc: Suren Baghdasaryan <[email protected]>
Cc: Kent Overstreet <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]

---
 lib/alloc_tag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/alloc_tag.c +1 -1
index 26af9982ddc4..531dbe2f5456 100644
@@ -129,7 +129,7 @@ size_t alloc_tag_top_users(struct codetag_bytes *tags, size_t count, bool can_sl
 
 static void __init procfs_init(void)
 {
-	proc_create_seq("allocinfo", 0444, NULL, &allocinfo_seq_op);
+	proc_create_seq("allocinfo", 0400, NULL, &allocinfo_seq_op);
 }
 
 static bool alloc_tag_module_unload(struct codetag_type *cttype,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Err...

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

That's not what we want.

#2 lore raw
Quoted 11 lines · Kent Overstreet
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Err...

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

author
#20 lore raw
In reply to Kent Overstreet
Quoted 9 lines · Kent Overstreet
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

I'm fine if you want to tie it to some existing capability, but it shouldn't be world-readable. Also, plenty of diagnostic tools already either run as root or open whatever files they need to before dropping privs.

Signature · 1 line
Kees Cook
#3 lore raw
In reply to Matthew Wilcox
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Kent Overstreet
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Quoted 6 lines
Quoted 4 lines

Err...

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

And the "lock everything down" approach really feels like paranoia gone too far - what's next, /proc/cpuinfo? Do we really want to go the Windows approach of UAC pop ups for everything? I'd rather be going the opposite direction, of making it as easy as possible for users to see what's going on with their machine.

Instead, why not a sysctl, like we already have for perf?

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

#4 lore raw
Quoted 12 lines · Kent Overstreet
Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Kent Overstreet
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Err...

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Yeah, that would preclude some nice usecases. Could we maybe use CAP_SYS_ADMIN checks instead? That way we can still use it from a non-root process?

Quoted 11 lines

And the "lock everything down" approach really feels like paranoia gone too far - what's next, /proc/cpuinfo? Do we really want to go the Windows approach of UAC pop ups for everything? I'd rather be going the opposite direction, of making it as easy as possible for users to see what's going on with their machine.

Instead, why not a sysctl, like we already have for perf?

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

#5 lore raw
Quoted 19 lines · Suren Baghdasaryan
Quoted 17 lines · Kent Overstreet
Quoted 14 lines · Matthew Wilcox
Quoted 11 lines · Kent Overstreet
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Err...

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Quoted 7 lines
Quoted 3 lines

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Yeah, that would preclude some nice usecases. Could we maybe use CAP_SYS_ADMIN checks instead? That way we can still use it from a non-root process?

A sysctl would be more in line with what we do for perf. Capabilities aren't very usable, and CAP_SYS_ADMIN is already way too much of an everything bucket.

maintainer
#6 lore raw
In reply to Suren Baghdasaryan
Quoted 5 lines · On Thu, 25 Apr 2024 14:21:39 -0700 Suren Baghdasaryan <[email protected]> wrote:
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Quoted 7 lines
Quoted 3 lines

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Yeah, that would preclude some nice usecases. Could we maybe use CAP_SYS_ADMIN checks instead? That way we can still use it from a non-root process?

I'm inclined to keep Kees's 0400. Yes it's a hassle but security is always a hassle. Let's not make Linux less secure, especially for people who aren't even using /proc/allocinfo.

If someone really wants 0666 then they can chmod the thing from initscripts, can't they?

#7 lore raw
Quoted 11 lines · Andrew Morton
Quoted 9 lines · On Thu, 25 Apr 2024 14:21:39 -0700 Suren Baghdasaryan <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Quoted 7 lines
Quoted 3 lines

Yeah, that would preclude some nice usecases. Could we maybe use CAP_SYS_ADMIN checks instead? That way we can still use it from a non-root process?

I'm inclined to keep Kees's 0400. Yes it's a hassle but security is always a hassle. Let's not make Linux less secure, especially for people who aren't even using /proc/allocinfo.

That's a bit too trite; we've seen often enough that putting security above all other concerns leads to worse outcomes in the long run; impair usability too much and you're just causing more problems than you solve.

We need to take a balanced approach, like with everything else we do.

I'd really like to hear from Kees why pre-sorting the output so we aren't leaking kernel image details wouldn't be sufficient.

author
#10 lore raw
In reply to Kent Overstreet
Quoted 11 lines · Kent Overstreet
Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Kent Overstreet
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Err...

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Open it once and rewind? But regardless, see the end about changing ownership/perms/etc.

Quoted 5 lines

And the "lock everything down" approach really feels like paranoia gone too far - what's next, /proc/cpuinfo? Do we really want to go the Windows approach of UAC pop ups for everything? I'd rather be going the opposite direction, of making it as easy as possible for users to see what's going on with their machine.

Not unless there's something in /proc/cpuinfo that can't be extracted in other methods. :) Anyway, you're offering a slippery-slope argument, I just want to avoid new interfaces from having needlessly permissive default access permissions.

I expect this to be enabled by default in distros, etc, so I'd like to make sure it's not giving attackers more information than they had before. Even reporting how much has been allocated at a specific location means an attacker ends up with extremely accurate information when attempting heap grooming, etc. Even the low granularity of slabinfo is sufficient to improve attacks. (Which is why it's 0400 by default too.)

Quoted 1 line

Instead, why not a sysctl, like we already have for perf?

perf is a whole other beast, including syscalls, etc.

Quoted 2 lines

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

It's trivial to change permissions from the default 0400 at boot time. It can even have groups and ownership changed, etc. This is why we have per-mount-namespace /proc instances:

# chgrp sysmonitor /proc/allocinfo
# chmod 0440 /proc/allocinfo

Poof, instant role-based access control. :)

I'm just trying to make the _default_ safe.

Signature · 1 line
Kees Cook
#11 lore raw
Quoted 30 lines · Kees Cook
Quoted 11 lines · Kent Overstreet
Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Kent Overstreet
Quoted 5 lines · Kees Cook

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Err...

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Open it once and rewind? But regardless, see the end about changing ownership/perms/etc.

Quoted 5 lines

And the "lock everything down" approach really feels like paranoia gone too far - what's next, /proc/cpuinfo? Do we really want to go the Windows approach of UAC pop ups for everything? I'd rather be going the opposite direction, of making it as easy as possible for users to see what's going on with their machine.

Quoted 4 lines

Not unless there's something in /proc/cpuinfo that can't be extracted in other methods. :) Anyway, you're offering a slippery-slope argument, I just want to avoid new interfaces from having needlessly permissive default access permissions.

No, I'm asking where the line is and how we decide what we want to restrict. I hope you agree that it shouldn't be everything?

I'm pushing hard for making things easier to debug, and making it easier for normal users to poke around and see what their system is doing. Simpler, easier to understand tools, tools that teach users how the system works. In my book, anything that lowers that barrier to entry is a good thing.

I've had a lot of positive, useful interactions from this, and by talking with users about what they see (I'm _always_ on IRC, and my channel is pretty active). I can't overstate how useful this sort of thing is, because there's only so many of us developers and users will notice things that we don't - sometimes quite significant things! and if we focus on making the system easy to debug, often times they'll do a lot of that debugging for us.

Feeding user's curiosity pays great dividends in the long run.

And on the usability side, we've done a lot over the years to nudge people away from running as root; if we set things up so that prefixing every command with 'sudo' becomes the default, then we really lose out on much of the benefit of that.

Quoted 6 lines

I expect this to be enabled by default in distros, etc, so I'd like to make sure it's not giving attackers more information than they had before. Even reporting how much has been allocated at a specific location means an attacker ends up with extremely accurate information when attempting heap grooming, etc. Even the low granularity of slabinfo is sufficient to improve attacks. (Which is why it's 0400 by default too.)

This is pretty esoteric stuff to me; what users should be remotely concerned about heap grooming attacks on their personal machines?

When we let the memory-unsafety of C (as well as spectre/meltdown) dominate system design, the result is... not good. Those are things that need to be fixed at the root (and, thank Rust, _are_), so let's maybe not go _too_ overboard otherwise it's going to take another couple decades to unwind all the resulting stockholm syndrome.

Quoted 3 lines
Quoted 1 line

Instead, why not a sysctl, like we already have for perf?

perf is a whole other beast, including syscalls, etc.

But semantically it's the exact same thing. With perf we've got a knob to say "I'm not paranoid on this machine, I don't want users to have to be able to root to do basic debugging" - why not lean into that?

Have a global knob that's more than just for perf, so single user and desktop machines can probably leave it loose (or even expose it in the distro installer) and servers can have it on.

Give users a way to say what they want.

Quoted 11 lines
Quoted 2 lines

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

It's trivial to change permissions from the default 0400 at boot time. It can even have groups and ownership changed, etc. This is why we have per-mount-namespace /proc instances:

# chgrp sysmonitor /proc/allocinfo
# chmod 0440 /proc/allocinfo

Poof, instant role-based access control. :)

The trouble is that the average user isn't going to know what reporting interfaces it's safe to do that with; we don't want to encourage that kind of mucking around by the unsuspecting. We really should have a knob.

maintainer
#12 lore raw
In reply to Kees Cook
Quoted 11 lines · On Thu, 25 Apr 2024 15:42:30 -0700 Kees Cook <[email protected]> wrote:
Quoted 2 lines

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

It's trivial to change permissions from the default 0400 at boot time. It can even have groups and ownership changed, etc. This is why we have per-mount-namespace /proc instances:

# chgrp sysmonitor /proc/allocinfo
# chmod 0440 /proc/allocinfo

Poof, instant role-based access control. :)

Conversely, the paranoid could set it to 0400 at boot also.

Quoted 1 line

I'm just trying to make the _default_ safe.

Agree with this.

Semi-seriously, how about we set the permissions to 0000 and force distributors/users to make a decision.

#13 lore raw
Quoted 14 lines · Andrew Morton
Quoted 11 lines · On Thu, 25 Apr 2024 15:42:30 -0700 Kees Cook <[email protected]> wrote:
Quoted 2 lines

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

It's trivial to change permissions from the default 0400 at boot time. It can even have groups and ownership changed, etc. This is why we have per-mount-namespace /proc instances:

# chgrp sysmonitor /proc/allocinfo
# chmod 0440 /proc/allocinfo

Poof, instant role-based access control. :)

Quoted 8 lines

Conversely, the paranoid could set it to 0400 at boot also.

Quoted 1 line

I'm just trying to make the _default_ safe.

Agree with this.

Semi-seriously, how about we set the permissions to 0000 and force distributors/users to make a decision.

I'm ok with 0400 for now since it's consistent with slabinfo, but I'd really like to see a sysctl for debug info paranoia. We shouldn't be leaving this to the distros; we're the ones with the expertise to say what would be covered by that sysctl.

author
#19 lore raw
In reply to Andrew Morton
Quoted 14 lines · Andrew Morton
Quoted 11 lines · On Thu, 25 Apr 2024 15:42:30 -0700 Kees Cook <[email protected]> wrote:
Quoted 2 lines

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

It's trivial to change permissions from the default 0400 at boot time. It can even have groups and ownership changed, etc. This is why we have per-mount-namespace /proc instances:

# chgrp sysmonitor /proc/allocinfo
# chmod 0440 /proc/allocinfo

Poof, instant role-based access control. :)

Quoted 8 lines

Conversely, the paranoid could set it to 0400 at boot also.

Quoted 1 line

I'm just trying to make the _default_ safe.

Agree with this.

Semi-seriously, how about we set the permissions to 0000 and force distributors/users to make a decision.

That seems an overly unfriendly default, but I guess if you wanted it as a Kconfig setting? Just seems easiest to make distros that enable alloc profiling safe by default but trivially available to root, and specialized monitoring systems can do whatever they want with their /proc file ACLs.

This is kind of how all of this stuff works. There's nothing unique to /proc/allocinfo. We do the same for slabinfo, vmallocinfo, timer_list, etc. And I think it's totally reasonable to have paranoid defaults, give the kind of outrageous stuff attackers have figured out how to reverse engineer. Take for example "we can bypass SLUB randomization for the slab from which struct file is allocated [by examining the /proc/$pid/fdinfo/ file contents]" Jann Horn demonstrated[1].

-Kees

[1] https://googleprojectzero.blogspot.com/2021/10/how-simple-linux-kernel-memory.html

Signature · 1 line
Kees Cook
author
#14 lore raw
In reply to Kent Overstreet
Quoted 21 lines · Kent Overstreet
Quoted 20 lines · Andrew Morton
Quoted 11 lines · On Thu, 25 Apr 2024 15:42:30 -0700 Kees Cook <[email protected]> wrote:
Quoted 2 lines

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

It's trivial to change permissions from the default 0400 at boot time. It can even have groups and ownership changed, etc. This is why we have per-mount-namespace /proc instances:

# chgrp sysmonitor /proc/allocinfo
# chmod 0440 /proc/allocinfo

Poof, instant role-based access control. :)

Conversely, the paranoid could set it to 0400 at boot also.

Quoted 1 line

I'm just trying to make the _default_ safe.

Agree with this.

Quoted 7 lines
Quoted 2 lines

Semi-seriously, how about we set the permissions to 0000 and force distributors/users to make a decision.

I'm ok with 0400 for now since it's consistent with slabinfo, but I'd really like to see a sysctl for debug info paranoia. We shouldn't be leaving this to the distros; we're the ones with the expertise to say what would be covered by that sysctl.

We've not had great luck with sysctls (see userns sysctl discussions) since they don't provide sufficient granularity.

All this said, I'm still not excited about any of these files living in /proc at all -- we were supposed to use /sys for this kind of thing, but its interface wasn't great for this kind of more "free-form" data, and debugfs isn't good for production interfaces. /proc really should only have pid information -- we end up exposing these top-level files to every mount namespace with a /proc mount. :( But that's a yet-to-be-solved problem...

-Kees

Signature · 1 line
Kees Cook
#15 lore raw
Quoted 33 lines · Kees Cook
Quoted 21 lines · Kent Overstreet
Quoted 20 lines · Andrew Morton
Quoted 11 lines · On Thu, 25 Apr 2024 15:42:30 -0700 Kees Cook <[email protected]> wrote:
Quoted 2 lines

The concern about leaking image layout could be addressed by sorting the output before returning to userspace.

It's trivial to change permissions from the default 0400 at boot time. It can even have groups and ownership changed, etc. This is why we have per-mount-namespace /proc instances:

# chgrp sysmonitor /proc/allocinfo
# chmod 0440 /proc/allocinfo

Poof, instant role-based access control. :)

Conversely, the paranoid could set it to 0400 at boot also.

Quoted 1 line

I'm just trying to make the _default_ safe.

Agree with this.

Quoted 7 lines
Quoted 2 lines

Semi-seriously, how about we set the permissions to 0000 and force distributors/users to make a decision.

I'm ok with 0400 for now since it's consistent with slabinfo, but I'd really like to see a sysctl for debug info paranoia. We shouldn't be leaving this to the distros; we're the ones with the expertise to say what would be covered by that sysctl.

We've not had great luck with sysctls (see userns sysctl discussions) since they don't provide sufficient granularity.

Quoted 7 lines

All this said, I'm still not excited about any of these files living in /proc at all -- we were supposed to use /sys for this kind of thing, but its interface wasn't great for this kind of more "free-form" data, and debugfs isn't good for production interfaces. /proc really should only have pid information -- we end up exposing these top-level files to every mount namespace with a /proc mount. :( But that's a yet-to-be-solved problem...

It really wouldn't be that hard to relax the 4k file limit in sysfs.

#16 lore raw
Quoted 10 lines · Kent Overstreet
Quoted 7 lines · Kees Cook

All this said, I'm still not excited about any of these files living in /proc at all -- we were supposed to use /sys for this kind of thing, but its interface wasn't great for this kind of more "free-form" data, and debugfs isn't good for production interfaces. /proc really should only have pid information -- we end up exposing these top-level files to every mount namespace with a /proc mount. :( But that's a yet-to-be-solved problem...

It really wouldn't be that hard to relax the 4k file limit in sysfs.

It's a lot harder to relax the GregKH opposition to multiple values per file in sysfs.

#17 lore raw
Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Kent Overstreet
Quoted 7 lines · Kees Cook

All this said, I'm still not excited about any of these files living in /proc at all -- we were supposed to use /sys for this kind of thing, but its interface wasn't great for this kind of more "free-form" data, and debugfs isn't good for production interfaces. /proc really should only have pid information -- we end up exposing these top-level files to every mount namespace with a /proc mount. :( But that's a yet-to-be-solved problem...

Quoted 4 lines
Quoted 1 line

It really wouldn't be that hard to relax the 4k file limit in sysfs.

It's a lot harder to relax the GregKH opposition to multiple values per file in sysfs.

Which makes no sense for columnar data.

#8 lore raw
In reply to Suren Baghdasaryan

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Err...

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Quoted 7 lines
Quoted 3 lines

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Yeah, that would preclude some nice usecases. Could we maybe use CAP_SYS_ADMIN checks instead? That way we can still use it from a non-root process?

CAP_SYS_ADMIN is really not suitable, as it can do changes to the system. On working system, allocinfo is really not dangerous, it just may make exploits harder. CAP_KERNEL_OBSERVER or something...

Pavel

Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
#18 lore raw
In reply to Matthew Wilcox
Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Kent Overstreet
Quoted 7 lines · Kees Cook

All this said, I'm still not excited about any of these files living in /proc at all -- we were supposed to use /sys for this kind of thing, but its interface wasn't great for this kind of more "free-form" data, and debugfs isn't good for production interfaces. /proc really should only have pid information -- we end up exposing these top-level files to every mount namespace with a /proc mount. :( But that's a yet-to-be-solved problem...

Quoted 4 lines
Quoted 1 line

It really wouldn't be that hard to relax the 4k file limit in sysfs.

It's a lot harder to relax the GregKH opposition to multiple values per file in sysfs.

With all the "vulnerability" files including multiple-files with english text, you may be able to renegotiate that :-).

Joking, really the vulnerability files should be fixed.

Pavel

Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
#9 lore raw
In reply to Pavel Machek
Quoted 19 lines · Pavel Machek

Hi!

Quoted 17 lines
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

The /proc/allocinfo file exposes a tremendous about of information about kernel build details, memory allocations (obviously), and potentially even image layout (due to ordering). As this is intended to be consumed by system owners (like /proc/slabinfo), use the same file permissions as
there: 0400.

Quoted 6 lines
Quoted 4 lines

Err...

The side effect of locking down more and more reporting interfaces is that programs that consume those interfaces now have to run as root.

sudo cat /proc/allocinfo | analyse-that-fie

Even that is still an annoyance, but I'm thinking more about a future daemon to collect this every n seconds - that really shouldn't need to be root.

Quoted 7 lines
Quoted 3 lines

Yeah, that would preclude some nice usecases. Could we maybe use CAP_SYS_ADMIN checks instead? That way we can still use it from a non-root process?

CAP_SYS_ADMIN is really not suitable, as it can do changes to the system. On working system, allocinfo is really not dangerous, it just may make exploits harder. CAP_KERNEL_OBSERVER or something...

There's _really_ no reason to use capabilities at all for something that has file ownership - just use a group.