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: <SJ0PR11MB5678990C825FE48D67D9B0C4C9512@SJ0PR11MB5678.namprd11.prod.outlook.com>
Date: Mon, 4 Nov 2024 18:29:06 +0000
From: "Sridhar, Kanchana P" <kanchana.p.sridhar@...el.com>
To: Dan Carpenter <dan.carpenter@...aro.org>, "oe-kbuild@...ts.linux.dev"
	<oe-kbuild@...ts.linux.dev>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-mm@...ck.org" <linux-mm@...ck.org>,
	"hannes@...xchg.org" <hannes@...xchg.org>, "yosryahmed@...gle.com"
	<yosryahmed@...gle.com>, "nphamcs@...il.com" <nphamcs@...il.com>,
	"chengming.zhou@...ux.dev" <chengming.zhou@...ux.dev>,
	"usamaarif642@...il.com" <usamaarif642@...il.com>, "ryan.roberts@....com"
	<ryan.roberts@....com>, "Huang, Ying" <ying.huang@...el.com>,
	"21cnbao@...il.com" <21cnbao@...il.com>, "akpm@...ux-foundation.org"
	<akpm@...ux-foundation.org>, "linux-crypto@...r.kernel.org"
	<linux-crypto@...r.kernel.org>, "herbert@...dor.apana.org.au"
	<herbert@...dor.apana.org.au>, "davem@...emloft.net" <davem@...emloft.net>,
	"clabbe@...libre.com" <clabbe@...libre.com>, "ardb@...nel.org"
	<ardb@...nel.org>, "ebiggers@...gle.com" <ebiggers@...gle.com>,
	"surenb@...gle.com" <surenb@...gle.com>, "Accardi, Kristen C"
	<kristen.c.accardi@...el.com>, "zanussi@...nel.org" <zanussi@...nel.org>,
	"Sridhar, Kanchana P" <kanchana.p.sridhar@...el.com>
CC: lkp <lkp@...el.com>, "oe-kbuild-all@...ts.linux.dev"
	<oe-kbuild-all@...ts.linux.dev>, "Feghali, Wajdi K"
	<wajdi.k.feghali@...el.com>, "Gopal, Vinodh" <vinodh.gopal@...el.com>
Subject: RE: [PATCH v2 13/13] mm: zswap: Compress batching with Intel IAA in
 zswap_store() of large folios.

Hi Dan,

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@...aro.org>
> Sent: Monday, November 4, 2024 12:31 AM
> To: oe-kbuild@...ts.linux.dev; Sridhar, Kanchana P
> <kanchana.p.sridhar@...el.com>; linux-kernel@...r.kernel.org; linux-
> mm@...ck.org; hannes@...xchg.org; yosryahmed@...gle.com;
> nphamcs@...il.com; chengming.zhou@...ux.dev;
> usamaarif642@...il.com; ryan.roberts@....com; Huang, Ying
> <ying.huang@...el.com>; 21cnbao@...il.com; akpm@...ux-foundation.org;
> linux-crypto@...r.kernel.org; herbert@...dor.apana.org.au;
> davem@...emloft.net; clabbe@...libre.com; ardb@...nel.org;
> ebiggers@...gle.com; surenb@...gle.com; Accardi, Kristen C
> <kristen.c.accardi@...el.com>; zanussi@...nel.org
> Cc: lkp <lkp@...el.com>; oe-kbuild-all@...ts.linux.dev; Feghali, Wajdi K
> <wajdi.k.feghali@...el.com>; Gopal, Vinodh <vinodh.gopal@...el.com>;
> Sridhar, Kanchana P <kanchana.p.sridhar@...el.com>
> Subject: Re: [PATCH v2 13/13] mm: zswap: Compress batching with Intel IAA
> in zswap_store() of large folios.
> 
> Hi Kanchana,
> 
> kernel test robot noticed the following build warnings:
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Kanchana-P-
> Sridhar/crypto-acomp-Define-two-new-interfaces-for-compress-decompress-
> batching/20241103-112337
> base:   5c4cf96cd70230100b5d396d45a5c9a332539d19
> patch link:    https://lore.kernel.org/r/20241103032111.333282-14-
> kanchana.p.sridhar%40intel.com
> patch subject: [PATCH v2 13/13] mm: zswap: Compress batching with Intel
> IAA in zswap_store() of large folios.
> config: x86_64-randconfig-161-20241104 (https://download.01.org/0day-
> ci/archive/20241104/202411040859.2z0MfFkR-lkp@...el.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@...el.com>
> | Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> | Closes: https://lore.kernel.org/r/202411040859.2z0MfFkR-lkp@intel.com/
> 
> smatch warnings:
> mm/zswap.c:1788 zswap_store_propagate_errors() warn: variable
> dereferenced before check 'sbp->entry' (see line 1785)
> 
> vim +1788 mm/zswap.c
> 
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1771  static
> __always_inline void zswap_store_propagate_errors(
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1772  	struct
> zswap_store_pipeline_state *zst,
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1773  	u8
> error_batch_idx)
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1774  {
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1775  	u8 i;
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1776
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1777  	if (zst-
> >errors[error_batch_idx])
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1778
> 	return;
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1779
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1780  	for (i = 0; i <
> zst->nr_comp_pages; ++i) {
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1781
> 	struct zswap_store_sub_batch_page *sbp = &zst->sub_batch[i];
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1782
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1783  		if
> (sbp->batch_idx == error_batch_idx) {
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1784
> 	if (!sbp->error) {
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02 @1785
> 		if (!IS_ERR_VALUE(sbp->entry->handle))
>                                                                                                   ^^^^^^^^^^^^^^^^^^
> Dereferenced
> 
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1786
> 			zpool_free(zst->pool->zpool, sbp->entry->handle);
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1787
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02 @1788
> 		if (sbp->entry) {
>                                                                                     ^^^^^^^^^^
> Checked too late

Thanks for pointing this out.  The implementation makes sure that all
sbp->entry values are valid before it gets to zswap_store_propagate_errors().
That said, I agree, the sbp->entry check can be done earlier to make the
code more correct/readable. I will fix this in v3.

Thanks,
Kanchana

> 
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1789
> 			zswap_entry_cache_free(sbp->entry);
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1790
> 			sbp->entry = NULL;
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1791
> 		}
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1792
> 		sbp->error = -EINVAL;
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1793
> 	}
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1794  		}
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1795  	}
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1796
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1797  	/*
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1798  	 * Set zswap
> status for the folio to "error"
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1799  	 * for use in
> swap_writepage.
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1800  	 */
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1801  	zst-
> >errors[error_batch_idx] = -EINVAL;
> c1252ac91d6a6a Kanchana P Sridhar 2024-11-02  1802  }
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ