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>] [day] [month] [year] [list]
Message-ID: <202203291451.bKVdLfSv-lkp@intel.com>
Date:   Tue, 29 Mar 2022 12:28:08 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: [gustavoars:testing/kspp-stringop-overflow 5/5]
 arch/x86/mm/pgtable.c:442 pgd_alloc() error: uninitialized symbol 'pmds'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/kspp-stringop-overflow
head:   d3becb16bbfe48ca524e4489b6c6c4fb1ccafa1a
commit: d3becb16bbfe48ca524e4489b6c6c4fb1ccafa1a [5/5] mm/pgtable: Fix Wstringop-overflow warnings in pgd_alloc()
config: i386-randconfig-m021-20220328 (https://download.01.org/0day-ci/archive/20220329/202203291451.bKVdLfSv-lkp@intel.com/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

New smatch warnings:
arch/x86/mm/pgtable.c:442 pgd_alloc() error: uninitialized symbol 'pmds'.
arch/x86/mm/pgtable.c:445 pgd_alloc() error: uninitialized symbol 'u_pmds'.

Old smatch warnings:
arch/x86/mm/pgtable.c:281 pgd_mop_up_pmds() warn: we never enter this loop

vim +/pmds +442 arch/x86/mm/pgtable.c

1ec1fe73dfb711 Ingo Molnar         2008-03-19  434  
1db491f77b6ed0 Fenghua Yu          2015-01-15  435  	pgd = _pgd_alloc();
1ec1fe73dfb711 Ingo Molnar         2008-03-19  436  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  437  	if (pgd == NULL)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  438  		goto out;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  439  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  440  	mm->pgd = pgd;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  441  
f59dbe9ca6707e Joerg Roedel        2018-07-18 @442  	if (preallocate_pmds(mm, pmds, PREALLOCATED_PMDS) != 0)

This can be either an array or a pointer depending on the .config

d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  443  		goto out_free_pgd;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  444  
f59dbe9ca6707e Joerg Roedel        2018-07-18 @445  	if (preallocate_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS) != 0)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  446  		goto out_free_pmds;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  447  
f59dbe9ca6707e Joerg Roedel        2018-07-18  448  	if (paravirt_pgd_alloc(mm) != 0)
f59dbe9ca6707e Joerg Roedel        2018-07-18  449  		goto out_free_user_pmds;
f59dbe9ca6707e Joerg Roedel        2018-07-18  450  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  451  	/*
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  452  	 * Make sure that pre-populating the pmds is atomic with
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  453  	 * respect to anything walking the pgd_list, so that they
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  454  	 * never see a partially populated pgd.
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  455  	 */
a79e53d85683c6 Andrea Arcangeli    2011-02-16  456  	spin_lock(&pgd_lock);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  457  
617d34d9e5d832 Jeremy Fitzhardinge 2010-09-21  458  	pgd_ctor(mm, pgd);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  459  	pgd_prepopulate_pmd(mm, pgd, pmds);
f59dbe9ca6707e Joerg Roedel        2018-07-18  460  	pgd_prepopulate_user_pmd(mm, pgd, u_pmds);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  461  
a79e53d85683c6 Andrea Arcangeli    2011-02-16  462  	spin_unlock(&pgd_lock);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  463  
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  464  	return pgd;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  465  
f59dbe9ca6707e Joerg Roedel        2018-07-18  466  out_free_user_pmds:
f59dbe9ca6707e Joerg Roedel        2018-07-18  467  	free_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  468  out_free_pmds:
f59dbe9ca6707e Joerg Roedel        2018-07-18  469  	free_pmds(mm, pmds, PREALLOCATED_PMDS);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  470  out_free_pgd:
1db491f77b6ed0 Fenghua Yu          2015-01-15  471  	_pgd_free(pgd);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  472  out:
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  473  	return NULL;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  474  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ