tree: git://git.samba.org/sfrench/cifs-2.6.git for-next
head: 8f79025175de6bc8cac5c7aa4ea3763e92270058
commit: 253374f7557e41729abf380c127f57627e0d4f9c [4/15] cifs: Fix unix perm bits to cifsacl conversion for "other" bits.
config: x86_64-randconfig-r032-20201209 (attached as .config)
compiler: clang version 12.0.0 (
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project&data=04%7C01%7CSteven.French%40microsoft.com%7C6c0a045183264f54babc08d89ce166e5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637431841742581679%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=OBzz%2FjZDEWhIdejd757CErZKTwbG5stWxGyBrDQlVXI%3D&reserved=0
1968804ac726e7674d5de22bc2204b45857da344)
reproduce (this is a W=1 build):
wget
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7CSteven.French%40microsoft.com%7C6c0a045183264f54babc08d89ce166e5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637431841742581679%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yOzFZ91LyS%2FIuUKtPjq7jcpVJXqqw0JCjEn2XgL2AKA%3D&reserved=0
-O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add cifs git://git.samba.org/sfrench/cifs-2.6.git
git fetch --no-tags cifs for-next
git checkout 253374f7557e41729abf380c127f57627e0d4f9c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/cifs/cifsacl.c:914:42: warning: variable 'nmode' is uninitialized when used here [-Wuninitialized]
size += setup_special_mode_ACE(pntace, nmode);
^~~~~
fs/cifs/cifsacl.c:901:13: note: initialize the variable 'nmode' to silence this warning
__u64 nmode;
^
= 0
1 warning generated.
vim +/nmode +914 fs/cifs/cifsacl.c
975221eca5fbfd Steve French 2020-06-12 894
97837582bc1e19 Steve French 2007-12-31 895 static int set_chmod_dacl(struct cifs_acl *pndacl, struct cifs_sid *pownersid,
253374f7557e41 Shyam Prasad N 2020-08-17 896 struct cifs_sid *pgrpsid, __u64 *pnmode, bool modefromsid)
97837582bc1e19 Steve French 2007-12-31 897 {
2b210adcb08c79 Al Viro 2008-03-29 898 u16 size = 0;
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 899 u32 num_aces = 0;
97837582bc1e19 Steve French 2007-12-31 900 struct cifs_acl *pnndacl;
253374f7557e41 Shyam Prasad N 2020-08-17 901 __u64 nmode;
253374f7557e41 Shyam Prasad N 2020-08-17 902 __u64 user_mode;
253374f7557e41 Shyam Prasad N 2020-08-17 903 __u64 group_mode;
253374f7557e41 Shyam Prasad N 2020-08-17 904 __u64 other_mode;
253374f7557e41 Shyam Prasad N 2020-08-17 905 __u64 deny_user_mode = 0;
253374f7557e41 Shyam Prasad N 2020-08-17 906 __u64 deny_group_mode = 0;
97837582bc1e19 Steve French 2007-12-31 907
97837582bc1e19 Steve French 2007-12-31 908 pnndacl = (struct cifs_acl *)((char *)pndacl + sizeof(struct cifs_acl));
97837582bc1e19 Steve French 2007-12-31 909
22442179a5bb8c Steve French 2019-07-19 910 if (modefromsid) {
22442179a5bb8c Steve French 2019-07-19 911 struct cifs_ace *pntace =
22442179a5bb8c Steve French 2019-07-19 912 (struct cifs_ace *)((char *)pnndacl + size);
22442179a5bb8c Steve French 2019-07-19 913
fdef665ba44ad5 Steve French 2019-12-06 @914 size += setup_special_mode_ACE(pntace, nmode);
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 915 num_aces++;
253374f7557e41 Shyam Prasad N 2020-08-17 916 goto set_size;
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 917 }
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 918
253374f7557e41 Shyam Prasad N 2020-08-17 919 /*
253374f7557e41 Shyam Prasad N 2020-08-17 920 * We'll try to keep the mode as requested by the user.
253374f7557e41 Shyam Prasad N 2020-08-17 921 * But in cases where we cannot meaningfully convert that
253374f7557e41 Shyam Prasad N 2020-08-17 922 * into ACL, return back the updated mode, so that it is
253374f7557e41 Shyam Prasad N 2020-08-17 923 * updated in the inode.
253374f7557e41 Shyam Prasad N 2020-08-17 924 */
253374f7557e41 Shyam Prasad N 2020-08-17 925 nmode = *pnmode;
253374f7557e41 Shyam Prasad N 2020-08-17 926
253374f7557e41 Shyam Prasad N 2020-08-17 927 if (!memcmp(pownersid, pgrpsid, sizeof(struct cifs_sid))) {
253374f7557e41 Shyam Prasad N 2020-08-17 928 /*
253374f7557e41 Shyam Prasad N 2020-08-17 929 * Case when owner and group SIDs are the same.
253374f7557e41 Shyam Prasad N 2020-08-17 930 * Set the more restrictive of the two modes.
253374f7557e41 Shyam Prasad N 2020-08-17 931 */
253374f7557e41 Shyam Prasad N 2020-08-17 932 user_mode = nmode & (nmode << 3) & 0700;
253374f7557e41 Shyam Prasad N 2020-08-17 933 group_mode = nmode & (nmode >> 3) & 0070;
253374f7557e41 Shyam Prasad N 2020-08-17 934 } else {
253374f7557e41 Shyam Prasad N 2020-08-17 935 user_mode = nmode & 0700;
253374f7557e41 Shyam Prasad N 2020-08-17 936 group_mode = nmode & 0070;
253374f7557e41 Shyam Prasad N 2020-08-17 937 }
253374f7557e41 Shyam Prasad N 2020-08-17 938
253374f7557e41 Shyam Prasad N 2020-08-17 939 other_mode = nmode & 0007;
253374f7557e41 Shyam Prasad N 2020-08-17 940
253374f7557e41 Shyam Prasad N 2020-08-17 941 /* We need DENY ACE when the perm is more restrictive than the next sets. */
253374f7557e41 Shyam Prasad N 2020-08-17 942 deny_user_mode = ~(user_mode) & ((group_mode << 3) | (other_mode << 6)) & 0700;
253374f7557e41 Shyam Prasad N 2020-08-17 943 deny_group_mode = ~(group_mode) & (other_mode << 3) & 0070;
253374f7557e41 Shyam Prasad N 2020-08-17 944
253374f7557e41 Shyam Prasad N 2020-08-17 945 *pnmode = user_mode | group_mode | other_mode | (nmode & ~0777);
253374f7557e41 Shyam Prasad N 2020-08-17 946
253374f7557e41 Shyam Prasad N 2020-08-17 947 if (deny_user_mode) {
22442179a5bb8c Steve French 2019-07-19 948 size += fill_ace_for_sid((struct cifs_ace *)((char *)pnndacl + size),
253374f7557e41 Shyam Prasad N 2020-08-17 949 pownersid, deny_user_mode, 0700, ACCESS_DENIED);
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 950 num_aces++;
253374f7557e41 Shyam Prasad N 2020-08-17 951 }
253374f7557e41 Shyam Prasad N 2020-08-17 952 /* Group DENY ACE does not conflict with owner ALLOW ACE. Keep in preferred order*/
253374f7557e41 Shyam Prasad N 2020-08-17 953 if (deny_group_mode && !(deny_group_mode & (user_mode >> 3))) {
253374f7557e41 Shyam Prasad N 2020-08-17 954 size += fill_ace_for_sid((struct cifs_ace *)((char *)pnndacl + size),
253374f7557e41 Shyam Prasad N 2020-08-17 955 pgrpsid, deny_group_mode, 0070, ACCESS_DENIED);
253374f7557e41 Shyam Prasad N 2020-08-17 956 num_aces++;
253374f7557e41 Shyam Prasad N 2020-08-17 957 }
253374f7557e41 Shyam Prasad N 2020-08-17 958 size += fill_ace_for_sid((struct cifs_ace *) ((char *)pnndacl + size),
253374f7557e41 Shyam Prasad N 2020-08-17 959 pownersid, user_mode, 0700, ACCESS_ALLOWED);
253374f7557e41 Shyam Prasad N 2020-08-17 960 num_aces++;
253374f7557e41 Shyam Prasad N 2020-08-17 961 /* Group DENY ACE conflicts with owner ALLOW ACE. So keep it after. */
253374f7557e41 Shyam Prasad N 2020-08-17 962 if (deny_group_mode && (deny_group_mode & (user_mode >> 3))) {
253374f7557e41 Shyam Prasad N 2020-08-17 963 size += fill_ace_for_sid((struct cifs_ace *)((char *)pnndacl + size),
253374f7557e41 Shyam Prasad N 2020-08-17 964 pgrpsid, deny_group_mode, 0070, ACCESS_DENIED);
253374f7557e41 Shyam Prasad N 2020-08-17 965 num_aces++;
253374f7557e41 Shyam Prasad N 2020-08-17 966 }
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 967 size += fill_ace_for_sid((struct cifs_ace *)((char *)pnndacl + size),
253374f7557e41 Shyam Prasad N 2020-08-17 968 pgrpsid, group_mode, 0070, ACCESS_ALLOWED);
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 969 num_aces++;
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 970 size += fill_ace_for_sid((struct cifs_ace *)((char *)pnndacl + size),
253374f7557e41 Shyam Prasad N 2020-08-17 971 &sid_everyone, other_mode, 0007, ACCESS_ALLOWED);
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 972 num_aces++;
97837582bc1e19 Steve French 2007-12-31 973
253374f7557e41 Shyam Prasad N 2020-08-17 974 set_size:
e37a02c7ebb9fa Aurelien Aptel 2019-09-17 975 pndacl->num_aces = cpu_to_le32(num_aces);
22442179a5bb8c Steve French 2019-07-19 976 pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl));
22442179a5bb8c Steve French 2019-07-19 977
ef571cadd516e7 Shirish Pargaonkar 2008-07-24 978 return 0;
97837582bc1e19 Steve French 2007-12-31 979 }
97837582bc1e19 Steve French 2007-12-31 980
:::::: The code at line 914 was first introduced by commit
:::::: fdef665ba44ad5ed154af2acfb19ae2ee3bf5dcc smb3: fix mode passed in on create for modetosid mount option
:::::: TO: Steve French <stfrench@microsoft.com>
:::::: CC: Steve French <stfrench@microsoft.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7CSteven.French%40microsoft.com%7C6c0a045183264f54babc08d89ce166e5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637431841742581679%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=q710sHM5tnPpoI2WLKJfJns9zE1VzGQ5%2FX4G2bwJnW0%3D&reserved=0