From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: linux-pwm@vger.kernel.org, "Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 1/2] pwm: lpss: Move namespace import into a header
Date: Wed, 4 Dec 2024 03:50:51 +0200 [thread overview]
Message-ID: <Z0-1e5Wr4q_Iuq6-@smile.fi.intel.com> (raw)
In-Reply-To: <6bjnfjell3jyr2f5v7wvvqg6lq2w2xuqhavdom4epjr6liluw5@p7cbkwwvpe43>
On Wed, Dec 04, 2024 at 12:38:49AM +0100, Uwe Kleine-König wrote:
> On Wed, Dec 04, 2024 at 12:28:23AM +0200, Andy Shevchenko wrote:
> > On Tue, Dec 03, 2024 at 10:32:17PM +0100, Uwe Kleine-König wrote:
> > > On Tue, Dec 03, 2024 at 09:12:36PM +0200, Andy Shevchenko wrote:
> > > > On Tue, Dec 03, 2024 at 06:16:14PM +0100, Uwe Kleine-König wrote:
...
> > > > The header must not provide any module importing features as it effectively
> > > > diminishes the point of namespace. Any (ab)user can include just a header and
> > > > be okay with that.
> > >
> > > Huh? Any abuser can also just do the IMPORT_NS statement? Module
> > > namespaces are not a safeguard against bad code? So I don't see why
> > > making it simple for the regular users should be the wrong choice.
> > >
> > > Actually I think this is very elegant because this way all needs to use
> > > these symbols (i.e. prototype and namespace) are in a single place and
> > > users just do the #include and get all the preconditions.
> >
> > Recent LWN https://lwn.net/Articles/998221/ article describes in more details
> > what I implied under abuser here.
>
> Ok. But I don't see how this supports your case. Independent of where
> the import for a given namespace happens, you can see the used
> namespaces in modinfo and that is the only place where suspicious
> imports can be noted reliably. And MODULE_foo isn't relevant here as the
> namespace of the pwm-lpss driver combo is used in several modules.
The initial point that the (ab)users will be visible at review stage.
Yes, runtime restrictions are more difficult to enforce.
> I thought the point of namespaces is grouping of symbols and reduction
> of the set of globally available symbols to speed up module loading.
> I didn't have "duplicate IMPORT_NS statements to make it harder for bad
> out-of-tree code" on my radar and that shouldn't be a motivation if the
> price is that in-tree code faces the same constraints IMHO.
>
> And I'm pretty sure, we won't prevent a bad actor from successfully
> using a symbol they should not, just because they need an include *and*
> an import.
>
> Am I missing something?
They may not need the include actually, as they can just tell the compiler with
extern keyword to look for a prototype somewhere else. In any case let's
return to the main topic here. My proposal is to add the respective module
namespace import into pin control driver.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-12-04 1:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 17:16 [PATCH 0/2] pwm: lpss: module namespace fixes Uwe Kleine-König
2024-12-03 17:16 ` [PATCH 1/2] pwm: lpss: Move namespace import into a header Uwe Kleine-König
2024-12-03 19:12 ` Andy Shevchenko
2024-12-03 21:32 ` Uwe Kleine-König
2024-12-03 22:28 ` Andy Shevchenko
2024-12-03 23:38 ` Uwe Kleine-König
2024-12-04 1:50 ` Andy Shevchenko [this message]
2024-12-16 8:46 ` Uwe Kleine-König
2025-01-21 22:46 ` Linus Walleij
2024-12-03 17:16 ` [PATCH 2/2] pwm: lpss: Define DEFAULT_SYMBOL_NAMESPACE earlier Uwe Kleine-König
2024-12-03 19:19 ` Andy Shevchenko
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=Z0-1e5Wr4q_Iuq6-@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-pwm@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@baylibre.com \
/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