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-next>] [day] [month] [year] [list]
Date:	Mon, 18 Jan 2016 11:09:00 +0100
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Hugh Dickins <hughd@...gle.com>,
	Dave Hansen <dave.hansen@...el.com>,
	Mel Gorman <mgorman@...e.de>, Rik van Riel <riel@...hat.com>,
	Vlastimil Babka <vbabka@...e.cz>,
	Christoph Lameter <cl@...two.org>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Steve Capper <steve.capper@...aro.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Michal Hocko <mhocko@...e.cz>,
	Jerome Marchand <jmarchan@...hat.com>,
	Sasha Levin <sasha.levin@...cle.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Linux MM <linux-mm@...ck.org>
Subject: BUILD_BUG() in smaps_account() (was: Re: [PATCHv12 01/37] mm, proc:
 adjust PSS calculation)

Hi Kirill,

On Tue, Oct 6, 2015 at 5:23 PM, Kirill A. Shutemov
<kirill.shutemov@...ux.intel.com> wrote:
> With new refcounting all subpages of the compound page are not necessary
> have the same mapcount. We need to take into account mapcount of every
> sub-page.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Tested-by: Sasha Levin <sasha.levin@...cle.com>
> Tested-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
> Acked-by: Jerome Marchand <jmarchan@...hat.com>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>
> ---
>  fs/proc/task_mmu.c | 47 +++++++++++++++++++++++++++++++----------------
>  1 file changed, 31 insertions(+), 16 deletions(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index bd167675a06f..ace02a4a07db 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -454,9 +454,10 @@ struct mem_size_stats {
>  };
>
>  static void smaps_account(struct mem_size_stats *mss, struct page *page,
> -               unsigned long size, bool young, bool dirty)
> +               bool compound, bool young, bool dirty)
>  {
> -       int mapcount;
> +       int i, nr = compound ? HPAGE_PMD_NR : 1;

If CONFIG_TRANSPARENT_HUGEPAGE is not set, we have:

    #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
    #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
    #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })

Depending on compiler version and optimization level, the BUILD_BUG() may be
optimized away (smaps_account() is always called with compound = false if
CONFIG_TRANSPARENT_HUGEPAGE=n), or lead to a build failure:

    fs/built-in.o: In function `smaps_account':
    task_mmu.c:(.text+0x4f8fa): undefined reference to
`__compiletime_assert_471'

Seen with m68k/allmodconfig or allyesconfig and gcc version 4.1.2 20061115
(prerelease) (Ubuntu 4.1.1-21).
Not seen when compiling the affected file with gcc 4.6.3 or 4.9.0, or with the
m68k defconfigs.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ