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: <CAE9FiQUrFfUN4Zar6b3tbuhcWEdQfA1t5diozd_19tRJd7coGQ@mail.gmail.com>
Date:	Wed, 14 Mar 2012 15:58:55 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
	yinghai@...nel.org, xiyou.wangcong@...il.com,
	akpm@...ux-foundation.org, tj@...nel.org, tglx@...utronix.de,
	ianfang.cn@...il.com, mingo@...e.hu
Cc:	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/mm] x86/mm: Fix the size calculation of mapping tables

On Tue, Mar 6, 2012 at 8:16 AM, tip-bot for WANG Cong
<xiyou.wangcong@...il.com> wrote:
> Commit-ID:  722bc6b16771ed80871e1fd81c86d3627dda2ac8
> Gitweb:     http://git.kernel.org/tip/722bc6b16771ed80871e1fd81c86d3627dda2ac8
> Author:     WANG Cong <xiyou.wangcong@...il.com>
> AuthorDate: Mon, 5 Mar 2012 15:05:13 -0800
> Committer:  Ingo Molnar <mingo@...e.hu>
> CommitDate: Tue, 6 Mar 2012 09:38:26 +0100
>
> x86/mm: Fix the size calculation of mapping tables
>
> For machines that enable PSE, the first 2/4M memory region still uses
> 4K pages, so needs more PTEs in this case, but
> find_early_table_space() doesn't count this.
>
> This patch fixes it.
>
> The bug was found via code review, no misbehavior of the kernel
> was observed.
>
> Signed-off-by: WANG Cong <xiyou.wangcong@...il.com>
> Cc: Yinghai Lu <yinghai@...nel.org>
> Cc: Tejun Heo <tj@...nel.org>
> Cc: <ianfang.cn@...il.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> Link: http://lkml.kernel.org/n/tip-kq6a00qe33h7c7ais2xsywnh@git.kernel.org
> Signed-off-by: Ingo Molnar <mingo@...e.hu>
> ---
>  arch/x86/mm/init.c |   21 ++++++++++++---------
>  1 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index 6cabf65..2e92fdc 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -30,8 +30,14 @@ int direct_gbpages
>  #endif
>  ;
>
> -static void __init find_early_table_space(unsigned long end, int use_pse,
> -                                         int use_gbpages)
> +struct map_range {
> +       unsigned long start;
> +       unsigned long end;
> +       unsigned page_size_mask;
> +};
> +
> +static void __init find_early_table_space(struct map_range *mr, unsigned long end,
> +                                         int use_pse, int use_gbpages)
>  {
>        unsigned long puds, pmds, ptes, tables, start = 0, good_end = end;
>        phys_addr_t base;
> @@ -56,6 +62,9 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
>  #ifdef CONFIG_X86_32
>                extra += PMD_SIZE;
>  #endif
> +               /* The first 2/4M doesn't use large pages. */
> +               extra += mr->end - mr->start;
> +

Something wrong here, you need to check if this MR is really cover
first 2/4M ...
something like
Index: linux-2.6/arch/x86/mm/init.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init.c
+++ linux-2.6/arch/x86/mm/init.c
@@ -63,7 +63,8 @@ static void __init find_early_table_spac
 		extra += PMD_SIZE;
 #endif
 		/* The first 2/4M doesn't use large pages. */
-		extra += mr->end - mr->start;
+		if (mr->start < PMD_SIZE)
+			extra += mr->end - mr->start;

 		ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	} else

otherwise, for system with 512G or more. page table for [4G, 512g) may
have preallocate more
but only use little.

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