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] [day] [month] [year] [list]
Message-ID: <20070723164331.GA7825@uranus.ravnborg.org>
Date:	Mon, 23 Jul 2007 18:43:31 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	"Luck, Tony" <tony.luck@...el.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Section mismatch warnings for early memory allocations

On Mon, Jul 23, 2007 at 09:22:14AM -0700, Luck, Tony wrote:
> Checking for section mismatches across all of vmlinux is kicking
> out a bunch of new warnings.  Many of them real, but I have a
> few from routines like this:
> 
> foo(...)
> {
> 	static int first_time = 1;
> 
> 	if (first_time) {
> 		all_i_need = alloc_bootmem(NR_CPUS * xxx);
> 		first_time = 0;
> 	}
> 	... use smp_processor_id() to use pre-allocated memory ...
> }
> 
> 
> Now this is safe, since the first call to foo is made when alloc_bootmem
> is still available.  But it kicks out a "Section mismatch" warning since
> a non __init routine (foo) is calling an __init one.
> 
> Any suggestions on how to tell modpost that this is safe?
Best way is to use __init_refok like this:

/*
 * Call an __init function only first time as guarded by first_time.
 * Teach modpost that this is OK.
 */
void __init_refok foo()
{
	if (first_time) {
		all_i_need = alloc_bootmem(NR_CPUS * xxx);
		first_time = 0;
	}
}

	Sam
-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ