linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: remove __init from i2c_register_board_info()
@ 2016-06-07 23:52 Luis R. Rodriguez
  2016-06-14 22:18 ` Luis R. Rodriguez
  2016-06-19 12:15 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2016-06-07 23:52 UTC (permalink / raw)
  To: wsa; +Cc: linux-i2c, linux-kernel, feng.tang, linux-next, Luis R. Rodriguez

As of next-20160607 with allyesconfig we get this linker failure:

  MODPOST vmlinux.o
WARNING: vmlinux.o(.text+0x21bc0d): Section mismatch in reference from
the function intel_scu_devices_create() to the function
.init.text:i2c_register_board_info()

This is caused by the fact that intel_scu_devices_create() calls
i2c_register_board_info() and intel_scu_devices_create() is not
annotated with __init. This typically involves manual code
inspection and if one is certain this is correct we would
just peg intel_scu_devices_create() with a __ref annotation.

In this case this would be wrong though as the
intel_scu_devices_create() call is exported, and used in
the ipc_probe() on drivers/platform/x86/intel_scu_ipc.c.
The issue is that even though builtin_pci_driver(ipc_driver)
is used this just exposes the probe routine, which can occur
at any point in time if this bus supports hotplug. A race
can happen between kernel_init_freeable() that calls the init
calls (in this case registeres the intel_scu_ipc.c driver, and
later free_initmem(), which would free the i2c_register_board_info().
If a probe happens later in boot i2c_register_board_info() would
not be present and we should get a page fault.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 drivers/i2c/i2c-boardinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c
index e33022e..77b1589 100644
--- a/drivers/i2c/i2c-boardinfo.c
+++ b/drivers/i2c/i2c-boardinfo.c
@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bus_num);
  * The board info passed can safely be __initdata, but be careful of embedded
  * pointers (for platform_data, functions, etc) since that won't be copied.
  */
-int __init
+int
 i2c_register_board_info(int busnum,
 	struct i2c_board_info const *info, unsigned len)
 {
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: remove __init from i2c_register_board_info()
  2016-06-07 23:52 [PATCH] i2c: remove __init from i2c_register_board_info() Luis R. Rodriguez
@ 2016-06-14 22:18 ` Luis R. Rodriguez
  2016-06-19 12:15 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2016-06-14 22:18 UTC (permalink / raw)
  Cc: wsa, linux-i2c, linux-kernel, feng.tang, linux-next, mcgrof

On Tue, Jun 07, 2016 at 04:52:27PM -0700, Luis R. Rodriguez wrote:
> As of next-20160607 with allyesconfig we get this linker failure:
> 
>   MODPOST vmlinux.o
> WARNING: vmlinux.o(.text+0x21bc0d): Section mismatch in reference from
> the function intel_scu_devices_create() to the function
> .init.text:i2c_register_board_info()
> 
> This is caused by the fact that intel_scu_devices_create() calls
> i2c_register_board_info() and intel_scu_devices_create() is not
> annotated with __init. This typically involves manual code
> inspection and if one is certain this is correct we would
> just peg intel_scu_devices_create() with a __ref annotation.
> 
> In this case this would be wrong though as the
> intel_scu_devices_create() call is exported, and used in
> the ipc_probe() on drivers/platform/x86/intel_scu_ipc.c.
> The issue is that even though builtin_pci_driver(ipc_driver)
> is used this just exposes the probe routine, which can occur
> at any point in time if this bus supports hotplug. A race
> can happen between kernel_init_freeable() that calls the init
> calls (in this case registeres the intel_scu_ipc.c driver, and
> later free_initmem(), which would free the i2c_register_board_info().
> If a probe happens later in boot i2c_register_board_info() would
> not be present and we should get a page fault.
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>

I don't see this merged yet on linux-next and this is still an issue.

 *Poke*

  Luis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: remove __init from i2c_register_board_info()
  2016-06-07 23:52 [PATCH] i2c: remove __init from i2c_register_board_info() Luis R. Rodriguez
  2016-06-14 22:18 ` Luis R. Rodriguez
@ 2016-06-19 12:15 ` Wolfram Sang
  2016-06-20 15:12   ` Luis R. Rodriguez
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2016-06-19 12:15 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-i2c, linux-kernel, feng.tang, linux-next

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

On Tue, Jun 07, 2016 at 04:52:27PM -0700, Luis R. Rodriguez wrote:
> As of next-20160607 with allyesconfig we get this linker failure:
> 
>   MODPOST vmlinux.o
> WARNING: vmlinux.o(.text+0x21bc0d): Section mismatch in reference from
> the function intel_scu_devices_create() to the function
> .init.text:i2c_register_board_info()
> 
> This is caused by the fact that intel_scu_devices_create() calls
> i2c_register_board_info() and intel_scu_devices_create() is not
> annotated with __init. This typically involves manual code
> inspection and if one is certain this is correct we would
> just peg intel_scu_devices_create() with a __ref annotation.
> 
> In this case this would be wrong though as the
> intel_scu_devices_create() call is exported, and used in
> the ipc_probe() on drivers/platform/x86/intel_scu_ipc.c.
> The issue is that even though builtin_pci_driver(ipc_driver)
> is used this just exposes the probe routine, which can occur
> at any point in time if this bus supports hotplug. A race
> can happen between kernel_init_freeable() that calls the init
> calls (in this case registeres the intel_scu_ipc.c driver, and
> later free_initmem(), which would free the i2c_register_board_info().
> If a probe happens later in boot i2c_register_board_info() would
> not be present and we should get a page fault.
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>

Applied to for-current, thanks! Do you think this should go to stable?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: remove __init from i2c_register_board_info()
  2016-06-19 12:15 ` Wolfram Sang
@ 2016-06-20 15:12   ` Luis R. Rodriguez
  0 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2016-06-20 15:12 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Luis R. Rodriguez, linux-i2c, linux-kernel, feng.tang, linux-next

On Sun, Jun 19, 2016 at 02:15:38PM +0200, Wolfram Sang wrote:
> On Tue, Jun 07, 2016 at 04:52:27PM -0700, Luis R. Rodriguez wrote:
> > As of next-20160607 with allyesconfig we get this linker failure:
> > 
> >   MODPOST vmlinux.o
> > WARNING: vmlinux.o(.text+0x21bc0d): Section mismatch in reference from
> > the function intel_scu_devices_create() to the function
> > .init.text:i2c_register_board_info()
> > 
> > This is caused by the fact that intel_scu_devices_create() calls
> > i2c_register_board_info() and intel_scu_devices_create() is not
> > annotated with __init. This typically involves manual code
> > inspection and if one is certain this is correct we would
> > just peg intel_scu_devices_create() with a __ref annotation.
> > 
> > In this case this would be wrong though as the
> > intel_scu_devices_create() call is exported, and used in
> > the ipc_probe() on drivers/platform/x86/intel_scu_ipc.c.
> > The issue is that even though builtin_pci_driver(ipc_driver)
> > is used this just exposes the probe routine, which can occur
> > at any point in time if this bus supports hotplug. A race
> > can happen between kernel_init_freeable() that calls the init
> > calls (in this case registeres the intel_scu_ipc.c driver, and
> > later free_initmem(), which would free the i2c_register_board_info().
> > If a probe happens later in boot i2c_register_board_info() would
> > not be present and we should get a page fault.
> > 
> > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> 
> Applied to for-current, thanks! Do you think this should go to stable?

Its a theoretical race, but a real one, but does fix allyesconfig builds.
Up to you.

  Luis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-20 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-07 23:52 [PATCH] i2c: remove __init from i2c_register_board_info() Luis R. Rodriguez
2016-06-14 22:18 ` Luis R. Rodriguez
2016-06-19 12:15 ` Wolfram Sang
2016-06-20 15:12   ` Luis R. Rodriguez

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).