Re: [PATCH] slub: print just the function name in /sys/kernel/slab/*/ctor

Alexey Dobriyan <[email protected]>
Newsgroups org.kvack.linux-mm
Message-ID <0a88d330-54fe-4e71-bb92-f8c705c17881@p183>
On Thu, Jul 30, 2026 at 04:15:26PM +0200, Vlastimil Babka (SUSE) wrote:
> On 7/27/26 07:27, Harry Yoo wrote:
> > 
> > 
> > On 7/25/26 10:28 PM, Alexey Dobriyan wrote:
> >> Sysfs "ctor" file prints offset/length of the cache's ctor function
> >> 
> >> 	$ sudo cat /sys/kernel/slab/bdev_cache/ctor
> >> 	init_once+0x0/0x10
> >> 
> >> This is not useful:
> >> 
> >> Offset will always be 0 because ctor is a function.
> >> 
> >> I'm not sure what ctor function size is doing here, it should be in
> >> /proc/kallsyms
> >> 
> >> Signed-off-by: Alexey Dobriyan <[email protected]>
> >> ---
> > 
> > I'm not convinced that changing this (without strong justification)
> > after exposing it to sysfs for 10+ years is worth the trouble.
> 
> Agreed. It's a pity this was exported in the first place. I can't see a
> benefit for anyone knowing what the function is called. Should have been at
> most a flag whether there's ctor or not.
> But possibly a justification is not to leak the function size, which might
> be theoretically (although unlikely) a hint to some attack.

Leaking size is a problem for custom kernels but not a problem
for distro kernels. Original format can be put under CAP_SYS_ADMIN.

> Well at least if somebody complains about getting broken, it's trivial to
> revert and we can hear about their usecase.
> In-tree tools (slabinfo etc) were checked to work properly?

I tried to google and grep my local git collection and found nothing.

> >> -	return sysfs_emit(buf, "%pS\n", s->ctor);
> >> +	return sysfs_emit(buf, "%ps\n", s->ctor);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.