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: <20150731083749.GB13148@dhcp-128-28.nay.redhat.com>
Date:	Fri, 31 Jul 2015 16:37:49 +0800
From:	Baoquan He <bhe@...hat.com>
To:	Minfei Huang <mhuang@...hat.com>
Cc:	linux-kernel@...r.kernel.org, kexec@...ts.infradead.org,
	tatsu@...jp.nec.com, lisa.mitchell@...com,
	seiji.aguchi.tr@...achi.com, dyoung@...hat.com, vgoyal@...hat.com,
	ebiederm@...ssion.com
Subject: Re: [PATCH] align crash_notes allocation to make it be inside one
 physical page

On 07/30/15 at 01:15pm, Minfei Huang wrote:
> On 07/30/15 at 11:07am, Baoquan He wrote:
> > diff --git a/kernel/kexec.c b/kernel/kexec.c
> > index a785c10..1740c42 100644
> > --- a/kernel/kexec.c
> > +++ b/kernel/kexec.c
> > @@ -1620,7 +1620,16 @@ void crash_save_cpu(struct pt_regs *regs, int cpu)
> >  static int __init crash_notes_memory_init(void)
> >  {
> >  	/* Allocate memory for saving cpu registers. */
> > -	crash_notes = alloc_percpu(note_buf_t);
> > +	size_t size, align;
> > +	int order;
> > +
> > +	size = sizeof(note_buf_t);
> > +	order = get_count_order(size);
> > +	align = 1<< order;
> > +
> > +	WARN_ON(size > PAGE_SIZE);
> 
> It is fine without this warning, since percpu will fail to allocate the
> memory larger than PAGE_SIZE.

Thanks for your comment.

percpu will fail if align is larger than PAGE_SIZE. I will adjust it
as align = min(1<<order, PAGE_SIZE). But adding WARN_ON makes sense
in case sizeof(note_buf_t) is bigger than PAGE_SIZE in the future,
then we need consider changing  the design of storing crash_notes.

Thanks
Baoquan
--
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