lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 27 Jun 2007 03:02:51 +0530
From:	"Satyam Sharma" <satyam.sharma@...il.com>
To:	"Randy Dunlap" <randy.dunlap@...cle.com>
Cc:	bugme-daemon@...zilla.kernel.org,
	lkml <linux-kernel@...r.kernel.org>, wbrana@...il.com,
	"Sam Ravnborg" <sam@...nborg.org>
Subject: Re: [Bug 8679] New: Section mismatch: reference to .init.text

On 6/27/07, Randy Dunlap <randy.dunlap@...cle.com> wrote:
> > [...]
> > Software Environment:
> > gcc 3.4.6, binutils 2.17
> >
> > Problem Description:
> > Warnings appeared while building kernel:
> >
> > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > .init.text: (between 'kthreadd' and 'init_waitqueue_head')
> [...]
> From: Randy Dunlap <randy.dunlap@...cle.com>
>
> kthreadd_setup() is in an __init section, but we know that it's
> safe to be called from kthreadd() since the latter is only called
> at kernel init time, so mark kthreadd_setup() __init_refok so
> that modpost won't complain about what text section it is in.

Hi Randy,

__init_refok is for callers, so we should actually be marking kthreadd()
as __init_refok. But I feel kthreadd_setup() doesn't want to be a separate
function at all. This is for 2.6.22-rc6, so kindly apply.

---

From: Satyam Sharma <satyam.sharma@...il.com>

> > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > .init.text: (between 'kthreadd' and 'init_waitqueue_head')

is because kernel/kthread.c:kthreadd() is not __init but calls kthreadd_setup()
which is __init. But this is ok, because kthreadd_setup() is only ever called at
init time, and then kthreadd() proceeds into its "for (;;)" loop.

We could mark kthreadd() __init_refok, but I feel kthreadd_setup() with just one
call site and 4 lines in it shouldn't be a separate function at all.
So let's lose it
and code it explicitly in kthreadd() itself.

Signed-off-by: Satyam Sharma <satyam.sharma@...il.com>

---

 kernel/kthread.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

---

diff -ruNp a/kernel/kthread.c b/kernel/kthread.c
--- a/kernel/kthread.c	2007-06-26 06:33:08.000000000 +0530
+++ b/kernel/kthread.c	2007-06-27 02:57:46.000000000 +0530
@@ -214,23 +214,15 @@ int kthread_stop(struct task_struct *k)
 }
 EXPORT_SYMBOL(kthread_stop);

-
-static __init void kthreadd_setup(void)
+int kthreadd(void *unused)
 {
 	struct task_struct *tsk = current;

+	/* Setup a clean context for our children to inherit. */
 	set_task_comm(tsk, "kthreadd");
-
 	ignore_signals(tsk);
-
 	set_user_nice(tsk, -5);
 	set_cpus_allowed(tsk, CPU_MASK_ALL);
-}
-
-int kthreadd(void *unused)
-{
-	/* Setup a clean context for our children to inherit. */
-	kthreadd_setup();

 	current->flags |= PF_NOFREEZE;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists