[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <97b8979ff52c4404bf74eeda574d6b23@AcuMS.aculab.com>
Date: Sat, 7 May 2022 10:01:03 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jagdish Gediya' <jvgediya@...ux.ibm.com>
CC: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"rafael@...nel.org" <rafael@...nel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"keescook@...omium.org" <keescook@...omium.org>,
"andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>,
"geert@...ux-m68k.org" <geert@...ux-m68k.org>,
"linux@...ck-us.net" <linux@...ck-us.net>,
"adobriyan@...il.com" <adobriyan@...il.com>
Subject: RE: [PATCH] kobject: Refactor kobject_set_name_vargs()
From: Jagdish Gediya
> Sent: 06 May 2022 18:24
...
> > Are you sure this can ever work from a module?
> > This all relies on:
> >
> > static inline bool is_kernel_rodata(unsigned long addr)
> > {
> > return addr >= (unsigned long)__start_rodata &&
> > addr < (unsigned long)__end_rodata;
> > }
> >
> > which isn't going to do anything sane given an "xxx" inside a module.
> >
> > Indeed can kobject_set_name_vargs() end up with a constant string
> > inside a module?
>
> No, kobject_set_name_vargs() is not exported. I exported
> set_name_vargs() because it can have a broader use, but you are right
> it shouldn't be exported.
I was thinking that some function that creates a 'kobject'
could easily be called from a module - so you end up calling
the set_name code from a module and then end up calling
kfree() on a literal from a module.
Now it might be that it is impossible to actually the quoted
literal from a module into somewhere that is_kernel_rodata()
is applied to.
But, as i said, it is fragile.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists