linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Jagdish Gediya' <jvgediya@linux.ibm.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"rafael@kernel.org" <rafael@kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"andriy.shevchenko@linux.intel.com"
	<andriy.shevchenko@linux.intel.com>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"adobriyan@gmail.com" <adobriyan@gmail.com>
Subject: RE: [PATCH] kobject: Refactor kobject_set_name_vargs()
Date: Sat, 7 May 2022 10:01:03 +0000	[thread overview]
Message-ID: <97b8979ff52c4404bf74eeda574d6b23@AcuMS.aculab.com> (raw)
In-Reply-To: <YnVZujpw0RZy3eVT@li-6e1fa1cc-351b-11b2-a85c-b897023bb5f3.ibm.com>

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)



  reply	other threads:[~2022-05-07 10:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 13:33 [PATCH] kobject: Refactor kobject_set_name_vargs() Jagdish Gediya
2022-05-06 14:02 ` Greg KH
2022-05-06 14:29   ` Jagdish Gediya
2022-05-06 14:45     ` Greg KH
2022-05-06 14:46 ` David Laight
2022-05-06 17:24   ` Jagdish Gediya
2022-05-07 10:01     ` David Laight [this message]
2022-05-06 19:56 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97b8979ff52c4404bf74eeda574d6b23@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jvgediya@linux.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@roeck-us.net \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).