tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
pending-5.10
head: 28d8a1bafb1d3ba5b9e84a0ef9f7505340737187
commit: 4709f4c79c5d802c30a92b70a4646e72752f02b6 [327/511] s390/mm: validate VMA in PGSTE
manipulation functions
config: s390-buildonly-randconfig-r002-20211114 (attached as .config)
compiler: s390-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/c...
git remote add sashal-stable
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
git fetch --no-tags sashal-stable pending-5.10
git checkout 4709f4c79c5d802c30a92b70a4646e72752f02b6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
arch/s390/mm/pgtable.c: In function 'pgste_perform_essa':
> arch/s390/mm/pgtable.c:1002:15: error: implicit declaration of
function 'vma_lookup'; did you mean 'key_lookup'?
[-Werror=implicit-function-declaration]
1002 | vma = vma_lookup(mm,
hva);
| ^~~~~~~~~~
| key_lookup
> arch/s390/mm/pgtable.c:1002:13: warning: assignment to
'struct vm_area_struct *' from 'int' makes pointer from integer without a
cast [-Wint-conversion]
1002 | vma = vma_lookup(mm, hva);
| ^
arch/s390/mm/pgtable.c: In function 'set_pgste_bits':
arch/s390/mm/pgtable.c:1102:13: warning: assignment to 'struct vm_area_struct
*' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1102 | vma = vma_lookup(mm, hva);
| ^
arch/s390/mm/pgtable.c: In function 'get_pgste':
arch/s390/mm/pgtable.c:1133:13: warning: assignment to 'struct vm_area_struct
*' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1133 | vma = vma_lookup(mm, hva);
| ^
cc1: some warnings being treated as errors
vim +1002 arch/s390/mm/pgtable.c
975
976 /**
977 * pgste_perform_essa - perform ESSA actions on the PGSTE.
978 * @mm: the memory context. It must have PGSTEs, no check is performed here!
979 * @hva: the host virtual address of the page whose PGSTE is to be processed
980 * @orc: the specific action to perform, see the ESSA_SET_* macros.
981 * @oldpte: the PTE will be saved there if the pointer is not NULL.
982 * @oldpgste: the old PGSTE will be saved there if the pointer is not NULL.
983 *
984 * Return: 1 if the page is to be added to the CBRL, otherwise 0,
985 * or < 0 in case of error. -EINVAL is returned for invalid values
986 * of orc, -EFAULT for invalid addresses.
987 */
988 int pgste_perform_essa(struct mm_struct *mm, unsigned long hva, int orc,
989 unsigned long *oldpte, unsigned long *oldpgste)
990 {
991 struct vm_area_struct *vma;
992 unsigned long pgstev;
993 spinlock_t *ptl;
994 pgste_t pgste;
995 pte_t *ptep;
996 int res = 0;
997
998 WARN_ON_ONCE(orc > ESSA_MAX);
999 if (unlikely(orc > ESSA_MAX))
1000 return -EINVAL;
1001
1002 vma = vma_lookup(mm, hva);
1003 if (!vma ||
is_vm_hugetlb_page(vma))
1004 return -EFAULT;
1005 ptep = get_locked_pte(mm, hva, &ptl);
1006 if (unlikely(!ptep))
1007 return -EFAULT;
1008 pgste = pgste_get_lock(ptep);
1009 pgstev = pgste_val(pgste);
1010 if (oldpte)
1011 *oldpte = pte_val(*ptep);
1012 if (oldpgste)
1013 *oldpgste = pgstev;
1014
1015 switch (orc) {
1016 case ESSA_GET_STATE:
1017 break;
1018 case ESSA_SET_STABLE:
1019 pgstev &= ~(_PGSTE_GPS_USAGE_MASK | _PGSTE_GPS_NODAT);
1020 pgstev |= _PGSTE_GPS_USAGE_STABLE;
1021 break;
1022 case ESSA_SET_UNUSED:
1023 pgstev &= ~_PGSTE_GPS_USAGE_MASK;
1024 pgstev |= _PGSTE_GPS_USAGE_UNUSED;
1025 if (pte_val(*ptep) & _PAGE_INVALID)
1026 res = 1;
1027 break;
1028 case ESSA_SET_VOLATILE:
1029 pgstev &= ~_PGSTE_GPS_USAGE_MASK;
1030 pgstev |= _PGSTE_GPS_USAGE_VOLATILE;
1031 if (pte_val(*ptep) & _PAGE_INVALID)
1032 res = 1;
1033 break;
1034 case ESSA_SET_POT_VOLATILE:
1035 pgstev &= ~_PGSTE_GPS_USAGE_MASK;
1036 if (!(pte_val(*ptep) & _PAGE_INVALID)) {
1037 pgstev |= _PGSTE_GPS_USAGE_POT_VOLATILE;
1038 break;
1039 }
1040 if (pgstev & _PGSTE_GPS_ZERO) {
1041 pgstev |= _PGSTE_GPS_USAGE_VOLATILE;
1042 break;
1043 }
1044 if (!(pgstev & PGSTE_GC_BIT)) {
1045 pgstev |= _PGSTE_GPS_USAGE_VOLATILE;
1046 res = 1;
1047 break;
1048 }
1049 break;
1050 case ESSA_SET_STABLE_RESIDENT:
1051 pgstev &= ~_PGSTE_GPS_USAGE_MASK;
1052 pgstev |= _PGSTE_GPS_USAGE_STABLE;
1053 /*
1054 * Since the resident state can go away any time after this
1055 * call, we will not make this page resident. We can revisit
1056 * this decision if a guest will ever start using this.
1057 */
1058 break;
1059 case ESSA_SET_STABLE_IF_RESIDENT:
1060 if (!(pte_val(*ptep) & _PAGE_INVALID)) {
1061 pgstev &= ~_PGSTE_GPS_USAGE_MASK;
1062 pgstev |= _PGSTE_GPS_USAGE_STABLE;
1063 }
1064 break;
1065 case ESSA_SET_STABLE_NODAT:
1066 pgstev &= ~_PGSTE_GPS_USAGE_MASK;
1067 pgstev |= _PGSTE_GPS_USAGE_STABLE | _PGSTE_GPS_NODAT;
1068 break;
1069 default:
1070 /* we should never get here! */
1071 break;
1072 }
1073 /* If we are discarding a page, set it to logical zero */
1074 if (res)
1075 pgstev |= _PGSTE_GPS_ZERO;
1076
1077 pgste_val(pgste) = pgstev;
1078 pgste_set_unlock(ptep, pgste);
1079 pte_unmap_unlock(ptep, ptl);
1080 return res;
1081 }
1082 EXPORT_SYMBOL(pgste_perform_essa);
1083
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org