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:	Fri, 06 Mar 2009 14:06:31 -0800
From:	Jeremy Fitzhardinge <jeremy@...p.org>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Andrew Morton <akpm@...ux-foundation.org>, yinghai@...nel.org,
	tglx@...utronix.de, hpa@...or.com, penberg@...helsinki.fi,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: introduce bootmem_state -v2

Ingo Molnar wrote:
> * Andrew Morton <akpm@...ux-foundation.org> wrote:
>
>   
>> On Fri, 6 Mar 2009 20:12:49 +0100
>> Ingo Molnar <mingo@...e.hu> wrote:
>>
>>     
>>> * Yinghai Lu <yinghai@...nel.org> wrote:
>>>
>>>       
>>>> Impact: cleanup
>>>>
>>>> extend after_bootmem and after_init_bootmem to bootmem_state
>>>> and will have BEFORE_BOOTMEM, DURING_BOOTMEM, AFTER_BOOTMEM
>>>>
>>>> v2: style changes according to ingo
>>>>
>>>> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
>>>>
>>>> ---
>>>>  arch/x86/kernel/setup.c |    1 +
>>>>  arch/x86/mm/init.c      |   13 +++++++------
>>>>  arch/x86/mm/init_32.c   |   28 ++++++++++++++++++++--------
>>>>  arch/x86/mm/init_64.c   |   33 +++++++++++++++++++--------------
>>>>  include/linux/mm.h      |    9 +++++++++
>>>>  5 files changed, 56 insertions(+), 28 deletions(-)
>>>>         
>>>> Index: linux-2.6/include/linux/mm.h
>>>> ===================================================================
>>>> --- linux-2.6.orig/include/linux/mm.h
>>>> +++ linux-2.6/include/linux/mm.h
>>>> @@ -1067,6 +1067,15 @@ extern void __init mmap_init(void);
>>>>  extern void show_mem(void);
>>>>  extern void si_meminfo(struct sysinfo * val);
>>>>  extern void si_meminfo_node(struct sysinfo *val, int nid);
>>>> +
>>>> +enum bootmem_state {
>>>> +	BEFORE_BOOTMEM,
>>>> +	DURING_BOOTMEM,
>>>> +	AFTER_BOOTMEM
>>>> +};
>>>> +
>>>> +extern enum bootmem_state bootmem_state;
>>>> +
>>>>  extern int after_bootmem;
>>>>         
>>> Btw., the after_bootmem variable itself should either move to 
>>> x86 (and arch/sh), or should be defined in mm/bootmem.c.
>>>
>>> Right now we have this weird mm.h construct that is not actually 
>>> useful to generic code.
>>>
>>> Andrew, what would be your preference?
>>>
>>>       
>> If two architectures are using it then it should be provided 
>> by core kernel?
>>
>> This is obvious if the state transitions are occurring in 
>> core-kernel code, but if the transitions are happening in arch 
>> code then making it a core concept assumes consistency between 
>> different architectures which might not exist.
>>
>> IOW: dunno.
>>     
>
> Core kernel could provide a wrapper allocator which calls the 
> right method depending on which state we are in. It will call 
> bootmem_alloc() if called early, and kmalloc() if called later. 
> Or something like that. Would there be any utility in that?
>   

Yes, so long as you're never intending to free the memory (since you 
won't know which free function to use for a given pointer - assuming one 
even exists).  And code which does:

    p = use_anytime_alloctor();

...
    kfree(p);        /* I know it was really allocated by kmalloc */


should be shot.

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