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: <20150902165922.GA5959@gmail.com>
Date:	Wed, 2 Sep 2015 18:59:22 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Jan Beulich <JBeulich@...e.com>
Cc:	Andy Lutomirski <luto@...capital.net>,
	David Vrabel <david.vrabel@...rix.com>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Boris Ostrovsky <boris.ostrovsky@...cle.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v2] x86: fix small LDT allocation for Xen


* Jan Beulich <JBeulich@...e.com> wrote:

> >> @@ -95,7 +95,7 @@ static void free_ldt_struct(struct ldt_s
> >>         if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE)
> >>                 vfree(ldt->entries);
> >>         else
> >> -               kfree(ldt->entries);
> >> +               put_page(virt_to_page(ldt->entries));
> > 
> > FWIW, I'm not convinced this is or was correct.  Using free_page looks
> > a bit safer, and free_page does more than just put_page.
> 
> Actually I agree. put_page() is meant to be paired with get_page();
> __get_free_pages() is just misleading (i.e. doesn't imply a get_page())
> and instead is to be paired with free_pages(). Will do a v3 then.

So put_page() is a page cache primitive and should not be used outside of it.

As it happens, it is safe to put_page() a regularly allocated page as well, but 
it's a little bit slower than doing a free_page().

Thanks,

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