All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH 1/2] alloc_tag: avoid current->alloc_tag manipulations when profiling is disabled
Date: Fri, 27 Dec 2024 19:47:04 +0800	[thread overview]
Message-ID: <202412271903.leG6fSFl-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20241226211639.1357704-1-surenb@google.com>
References: <20241226211639.1357704-1-surenb@google.com>
TO: Suren Baghdasaryan <surenb@google.com>

Hi Suren,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 431614f1580a03c1a653340c55ea76bd12a9403f]

url:    https://github.com/intel-lab-lkp/linux/commits/Suren-Baghdasaryan/alloc_tag-skip-pgalloc_tag_swap-if-profiling-is-disabled/20241227-051744
base:   431614f1580a03c1a653340c55ea76bd12a9403f
patch link:    https://lore.kernel.org/r/20241226211639.1357704-1-surenb%40google.com
patch subject: [PATCH 1/2] alloc_tag: avoid current->alloc_tag manipulations when profiling is disabled
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: arc-randconfig-r073-20241227 (https://download.01.org/0day-ci/archive/20241227/202412271903.leG6fSFl-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202412271903.leG6fSFl-lkp@intel.com/

New smatch warnings:
fs/overlayfs/namei.c:658 ovl_verify_index() warn: passing zero to 'PTR_ERR'

Old smatch warnings:
fs/overlayfs/namei.c:44 ovl_check_redirect() warn: passing zero to 'PTR_ERR'
fs/overlayfs/namei.c:479 ovl_check_origin() warn: passing zero to 'PTR_ERR'
fs/overlayfs/namei.c:581 ovl_index_upper() warn: passing zero to 'ERR_CAST'

vim +/PTR_ERR +658 fs/overlayfs/namei.c

e8f9e5b780b040 Amir Goldstein   2018-01-11  598  
415543d5c64fe4 Amir Goldstein   2017-06-21  599  /*
415543d5c64fe4 Amir Goldstein   2017-06-21  600   * Verify that an index entry name matches the origin file handle stored in
415543d5c64fe4 Amir Goldstein   2017-06-21  601   * OVL_XATTR_ORIGIN and that origin file handle can be decoded to lower path.
415543d5c64fe4 Amir Goldstein   2017-06-21  602   * Return 0 on match, -ESTALE on mismatch or stale origin, < 0 on error.
415543d5c64fe4 Amir Goldstein   2017-06-21  603   */
1eff1a1deec727 Amir Goldstein   2017-12-12  604  int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index)
415543d5c64fe4 Amir Goldstein   2017-06-21  605  {
415543d5c64fe4 Amir Goldstein   2017-06-21  606  	struct ovl_fh *fh = NULL;
415543d5c64fe4 Amir Goldstein   2017-06-21  607  	size_t len;
b93436320c1e90 Chandan Rajendra 2017-07-24  608  	struct ovl_path origin = { };
b93436320c1e90 Chandan Rajendra 2017-07-24  609  	struct ovl_path *stack = &origin;
e8f9e5b780b040 Amir Goldstein   2018-01-11  610  	struct dentry *upper = NULL;
415543d5c64fe4 Amir Goldstein   2017-06-21  611  	int err;
415543d5c64fe4 Amir Goldstein   2017-06-21  612  
415543d5c64fe4 Amir Goldstein   2017-06-21  613  	if (!d_inode(index))
415543d5c64fe4 Amir Goldstein   2017-06-21  614  		return 0;
415543d5c64fe4 Amir Goldstein   2017-06-21  615  
fa0096e3bad69e Amir Goldstein   2017-10-24  616  	err = -EINVAL;
cbe7fba8edfc8c Amir Goldstein   2019-11-15  617  	if (index->d_name.len < sizeof(struct ovl_fb)*2)
415543d5c64fe4 Amir Goldstein   2017-06-21  618  		goto fail;
415543d5c64fe4 Amir Goldstein   2017-06-21  619  
415543d5c64fe4 Amir Goldstein   2017-06-21  620  	err = -ENOMEM;
415543d5c64fe4 Amir Goldstein   2017-06-21  621  	len = index->d_name.len / 2;
cbe7fba8edfc8c Amir Goldstein   2019-11-15  622  	fh = kzalloc(len + OVL_FH_WIRE_OFFSET, GFP_KERNEL);
415543d5c64fe4 Amir Goldstein   2017-06-21  623  	if (!fh)
415543d5c64fe4 Amir Goldstein   2017-06-21  624  		goto fail;
415543d5c64fe4 Amir Goldstein   2017-06-21  625  
415543d5c64fe4 Amir Goldstein   2017-06-21  626  	err = -EINVAL;
cbe7fba8edfc8c Amir Goldstein   2019-11-15  627  	if (hex2bin(fh->buf, index->d_name.name, len))
2e1a532883cf77 Amir Goldstein   2017-10-24  628  		goto fail;
2e1a532883cf77 Amir Goldstein   2017-10-24  629  
cbe7fba8edfc8c Amir Goldstein   2019-11-15  630  	err = ovl_check_fb_len(&fh->fb, len);
2e1a532883cf77 Amir Goldstein   2017-10-24  631  	if (err)
415543d5c64fe4 Amir Goldstein   2017-06-21  632  		goto fail;
415543d5c64fe4 Amir Goldstein   2017-06-21  633  
7db25d36d9253c Amir Goldstein   2018-01-11  634  	/*
7db25d36d9253c Amir Goldstein   2018-01-11  635  	 * Whiteout index entries are used as an indication that an exported
7db25d36d9253c Amir Goldstein   2018-01-11  636  	 * overlay file handle should be treated as stale (i.e. after unlink
7db25d36d9253c Amir Goldstein   2018-01-11  637  	 * of the overlay inode). These entries contain no origin xattr.
7db25d36d9253c Amir Goldstein   2018-01-11  638  	 */
7db25d36d9253c Amir Goldstein   2018-01-11  639  	if (ovl_is_whiteout(index))
7db25d36d9253c Amir Goldstein   2018-01-11  640  		goto out;
7db25d36d9253c Amir Goldstein   2018-01-11  641  
e8f9e5b780b040 Amir Goldstein   2018-01-11  642  	/*
e8f9e5b780b040 Amir Goldstein   2018-01-11  643  	 * Verifying directory index entries are not stale is expensive, so
e8f9e5b780b040 Amir Goldstein   2018-01-11  644  	 * only verify stale dir index if NFS export is enabled.
e8f9e5b780b040 Amir Goldstein   2018-01-11  645  	 */
e8f9e5b780b040 Amir Goldstein   2018-01-11  646  	if (d_is_dir(index) && !ofs->config.nfs_export)
e8f9e5b780b040 Amir Goldstein   2018-01-11  647  		goto out;
e8f9e5b780b040 Amir Goldstein   2018-01-11  648  
e8f9e5b780b040 Amir Goldstein   2018-01-11  649  	/*
e8f9e5b780b040 Amir Goldstein   2018-01-11  650  	 * Directory index entries should have 'upper' xattr pointing to the
e8f9e5b780b040 Amir Goldstein   2018-01-11  651  	 * real upper dir. Non-dir index entries are hardlinks to the upper
e8f9e5b780b040 Amir Goldstein   2018-01-11  652  	 * real inode. For non-dir index, we can read the copy up origin xattr
e8f9e5b780b040 Amir Goldstein   2018-01-11  653  	 * directly from the index dentry, but for dir index we first need to
e8f9e5b780b040 Amir Goldstein   2018-01-11  654  	 * decode the upper directory.
e8f9e5b780b040 Amir Goldstein   2018-01-11  655  	 */
8ea2876577b578 Amir Goldstein   2022-10-04  656  	upper = ovl_index_upper(ofs, index, false);
e8f9e5b780b040 Amir Goldstein   2018-01-11  657  	if (IS_ERR_OR_NULL(upper)) {
e8f9e5b780b040 Amir Goldstein   2018-01-11 @658  		err = PTR_ERR(upper);
24f0b17203691d Amir Goldstein   2018-01-11  659  		/*
24f0b17203691d Amir Goldstein   2018-01-11  660  		 * Directory index entries with no 'upper' xattr need to be
24f0b17203691d Amir Goldstein   2018-01-11  661  		 * removed. When dir index entry has a stale 'upper' xattr,
24f0b17203691d Amir Goldstein   2018-01-11  662  		 * we assume that upper dir was removed and we treat the dir
24f0b17203691d Amir Goldstein   2018-01-11  663  		 * index as orphan entry that needs to be whited out.
24f0b17203691d Amir Goldstein   2018-01-11  664  		 */
24f0b17203691d Amir Goldstein   2018-01-11  665  		if (err == -ESTALE)
24f0b17203691d Amir Goldstein   2018-01-11  666  			goto orphan;
24f0b17203691d Amir Goldstein   2018-01-11  667  		else if (!err)
e8f9e5b780b040 Amir Goldstein   2018-01-11  668  			err = -ESTALE;
e8f9e5b780b040 Amir Goldstein   2018-01-11  669  		goto fail;
e8f9e5b780b040 Amir Goldstein   2018-01-11  670  	}
e8f9e5b780b040 Amir Goldstein   2018-01-11  671  
610afc0bd40882 Miklos Szeredi   2020-09-02  672  	err = ovl_verify_fh(ofs, upper, OVL_XATTR_ORIGIN, fh);
e8f9e5b780b040 Amir Goldstein   2018-01-11  673  	dput(upper);
415543d5c64fe4 Amir Goldstein   2017-06-21  674  	if (err)
415543d5c64fe4 Amir Goldstein   2017-06-21  675  		goto fail;
415543d5c64fe4 Amir Goldstein   2017-06-21  676  
e8f9e5b780b040 Amir Goldstein   2018-01-11  677  	/* Check if non-dir index is orphan and don't warn before cleaning it */
e8f9e5b780b040 Amir Goldstein   2018-01-11  678  	if (!d_is_dir(index) && d_inode(index)->i_nlink == 1) {
8a22efa15b46d5 Amir Goldstein   2018-03-09  679  		err = ovl_check_origin_fh(ofs, fh, false, index, &stack);
415543d5c64fe4 Amir Goldstein   2017-06-21  680  		if (err)
415543d5c64fe4 Amir Goldstein   2017-06-21  681  			goto fail;
415543d5c64fe4 Amir Goldstein   2017-06-21  682  
610afc0bd40882 Miklos Szeredi   2020-09-02  683  		if (ovl_get_nlink(ofs, origin.dentry, index, 0) == 0)
24f0b17203691d Amir Goldstein   2018-01-11  684  			goto orphan;
e8f9e5b780b040 Amir Goldstein   2018-01-11  685  	}
caf70cb2ba5dff Amir Goldstein   2017-06-21  686  
415543d5c64fe4 Amir Goldstein   2017-06-21  687  out:
e8f9e5b780b040 Amir Goldstein   2018-01-11  688  	dput(origin.dentry);
415543d5c64fe4 Amir Goldstein   2017-06-21  689  	kfree(fh);
415543d5c64fe4 Amir Goldstein   2017-06-21  690  	return err;
415543d5c64fe4 Amir Goldstein   2017-06-21  691  
415543d5c64fe4 Amir Goldstein   2017-06-21  692  fail:
1bd0a3aea4357e lijiazi          2019-12-16  693  	pr_warn_ratelimited("failed to verify index (%pd2, ftype=%x, err=%i)\n",
61b674710cd9af Amir Goldstein   2017-07-18  694  			    index, d_inode(index)->i_mode & S_IFMT, err);
415543d5c64fe4 Amir Goldstein   2017-06-21  695  	goto out;
24f0b17203691d Amir Goldstein   2018-01-11  696  
24f0b17203691d Amir Goldstein   2018-01-11  697  orphan:
1bd0a3aea4357e lijiazi          2019-12-16  698  	pr_warn_ratelimited("orphan index entry (%pd2, ftype=%x, nlink=%u)\n",
24f0b17203691d Amir Goldstein   2018-01-11  699  			    index, d_inode(index)->i_mode & S_IFMT,
24f0b17203691d Amir Goldstein   2018-01-11  700  			    d_inode(index)->i_nlink);
24f0b17203691d Amir Goldstein   2018-01-11  701  	err = -ENOENT;
24f0b17203691d Amir Goldstein   2018-01-11  702  	goto out;
415543d5c64fe4 Amir Goldstein   2017-06-21  703  }
415543d5c64fe4 Amir Goldstein   2017-06-21  704  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2024-12-27 11:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-27 11:47 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-26 21:16 [PATCH 1/2] alloc_tag: avoid current->alloc_tag manipulations when profiling is disabled Suren Baghdasaryan
2024-12-27  0:43 ` Kent Overstreet
2024-12-27  1:07   ` Suren Baghdasaryan
2024-12-27  1:09     ` Suren Baghdasaryan
2024-12-27  1:46       ` Suren Baghdasaryan
2024-12-27 14:17 ` kernel test robot
2024-12-27 14:39 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202412271903.leG6fSFl-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.