All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: ChenXiaoSong <chenxiaosong2@huawei.com>,
	trond.myklebust@hammerspace.com, anna@kernel.org
Cc: kbuild-all@lists.01.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, chenxiaosong2@huawei.com,
	yi.zhang@huawei.com, zhangxiaoxu5@huawei.com
Subject: Re: [PATCH 2/2] NFSv4: check FMODE_EXEC from open context mode in nfs4_opendata_access()
Date: Fri, 23 Sep 2022 11:19:42 +0800	[thread overview]
Message-ID: <202209231127.Fb4Qkx0m-lkp@intel.com> (raw)
In-Reply-To: <20220922034905.1442056-3-chenxiaosong2@huawei.com>

Hi ChenXiaoSong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on linus/master v6.0-rc6 next-20220921]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/ChenXiaoSong/NFS-check-FMODE_EXEC-from-open-context-mode/20220922-105006
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: arm64-randconfig-s041-20220921 (https://download.01.org/0day-ci/archive/20220923/202209231127.Fb4Qkx0m-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/74ed5473611c0257ea5fe8bb5e77f19d94d02596
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review ChenXiaoSong/NFS-check-FMODE_EXEC-from-open-context-mode/20220922-105006
        git checkout 74ed5473611c0257ea5fe8bb5e77f19d94d02596
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
>> fs/nfs/nfs4proc.c:2638:13: sparse: sparse: restricted fmode_t degrades to integer

vim +2638 fs/nfs/nfs4proc.c

  2616	
  2617	/*
  2618	 * Additional permission checks in order to distinguish between an
  2619	 * open for read, and an open for execute. This works around the
  2620	 * fact that NFSv4 OPEN treats read and execute permissions as being
  2621	 * the same.
  2622	 * Note that in the non-execute case, we want to turn off permission
  2623	 * checking if we just created a new file (POSIX open() semantics).
  2624	 */
  2625	static int nfs4_opendata_access(const struct cred *cred,
  2626					struct nfs4_opendata *opendata,
  2627					struct nfs4_state *state, fmode_t fmode)
  2628	{
  2629		struct nfs_access_entry cache;
  2630		u32 mask, flags;
  2631	
  2632		/* access call failed or for some reason the server doesn't
  2633		 * support any access modes -- defer access call until later */
  2634		if (opendata->o_res.access_supported == 0)
  2635			return 0;
  2636	
  2637		mask = 0;
> 2638		if (fmode & __FMODE_EXEC) {
  2639			/* ONLY check for exec rights */
  2640			if (S_ISDIR(state->inode->i_mode))
  2641				mask = NFS4_ACCESS_LOOKUP;
  2642			else
  2643				mask = NFS4_ACCESS_EXECUTE;
  2644		} else if ((fmode & FMODE_READ) && !opendata->file_created)
  2645			mask = NFS4_ACCESS_READ;
  2646	
  2647		nfs_access_set_mask(&cache, opendata->o_res.access_result);
  2648		nfs_access_add_cache(state->inode, &cache, cred);
  2649	
  2650		flags = NFS4_ACCESS_READ | NFS4_ACCESS_EXECUTE | NFS4_ACCESS_LOOKUP;
  2651		if ((mask & ~cache.mask & flags) == 0)
  2652			return 0;
  2653	
  2654		return -EACCES;
  2655	}
  2656	

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

      reply	other threads:[~2022-09-23  3:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  3:49 [PATCH 0/2] NFS: check FMODE_EXEC from open context mode ChenXiaoSong
2022-09-22  3:49 ` [PATCH 1/2] NFS: make sure open context mode have FMODE_EXEC when file open for exec ChenXiaoSong
2022-09-22  3:49 ` [PATCH 2/2] NFSv4: check FMODE_EXEC from open context mode in nfs4_opendata_access() ChenXiaoSong
2022-09-23  3:19   ` kernel test robot [this message]

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=202209231127.Fb4Qkx0m-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=anna@kernel.org \
    --cc=chenxiaosong2@huawei.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=yi.zhang@huawei.com \
    --cc=zhangxiaoxu5@huawei.com \
    /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.