tree:
https://github.com/changbae/Linux-kernel adl-po-presilicon
head: 6173b90dca1633db3ad2ddb01b0825969c0aa8e3
commit: ad6ee55fb46f489a6d97fa45dd92620b608d4dcf [9678/9999] x86/mm: Introduce _PAGE_COW
config: i386-randconfig-m021-20200621 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/mm.h:95,
from include/linux/kallsyms.h:12,
from include/linux/bpf.h:21,
from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/linux/memcontrol.h:13,
from include/linux/swap.h:9,
from include/linux/suspend.h:5,
from arch/x86/kernel/asm-offsets.c:13:
arch/x86/include/asm/pgtable.h: In function 'pte_wrprotect':
arch/x86/include/asm/pgtable.h:359:26: warning: left shift count >= width of type
[-Wshift-count-overflow]
359 | _PAGE_BIT_DIRTY_HW << _PAGE_BIT_COW;
| ^~
arch/x86/include/asm/pgtable.h: In function 'pmd_wrprotect':
> arch/x86/include/asm/pgtable.h:485:7: error: 'pmd_t' {aka
'struct <anonymous>'} has no member named 'pmd'; did you mean
'pud'?
485 | pmd.pmd |= (pmd.pmd & _PAGE_DIRTY_HW) >>
| ^~~
| pud
arch/x86/include/asm/pgtable.h:485:19: error: 'pmd_t' {aka 'struct
<anonymous>'} has no member named 'pmd'; did you mean 'pud'?
485 | pmd.pmd |= (pmd.pmd & _PAGE_DIRTY_HW) >>
| ^~~
| pud
arch/x86/include/asm/pgtable.h: In function 'pud_wrprotect':
> arch/x86/include/asm/pgtable.h:570:7: error: 'pud_t' {aka
'struct <anonymous>'} has no member named 'pud'; did you mean
'p4d'?
570 | pud.pud |= (pud.pud & _PAGE_DIRTY_HW) >>
| ^~~
| p4d
arch/x86/include/asm/pgtable.h:570:19: error: 'pud_t' {aka 'struct
<anonymous>'} has no member named 'pud'; did you mean 'p4d'?
570 | pud.pud |= (pud.pud & _PAGE_DIRTY_HW) >>
| ^~~
| p4d
make[2]: *** [scripts/Makefile.build:100: arch/x86/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1148: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:180: sub-make] Error 2
make: Target 'prepare' not remade because of errors.
vim +485 arch/x86/include/asm/pgtable.h
475
476 static inline pmd_t pmd_wrprotect(pmd_t pmd)
477 {
478 /*
479 * Blindly clearing _PAGE_RW might accidentally create
480 * a shadow stack PMD (RW=0,Dirty=1). Move the hardware
481 * dirty value to the software bit.
482 */
483 if (cpu_feature_enabled(X86_FEATURE_SHSTK) &&
484 (_PAGE_BIT_COW < sizeof(pmd) * BITS_PER_BYTE)) {
485 pmd.pmd |= (pmd.pmd & _PAGE_DIRTY_HW) >>
486 _PAGE_BIT_DIRTY_HW << _PAGE_BIT_COW;
487 pmd = pmd_clear_flags(pmd, _PAGE_DIRTY_HW);
488 }
489
490 return pmd_clear_flags(pmd, _PAGE_RW);
491 }
492
493 static inline pmd_t pmd_mkdirty(pmd_t pmd)
494 {
495 pmdval_t dirty = _PAGE_DIRTY_HW;
496
497 /* Avoid creating (HW)Dirty=1,Write=0 PMDs */
498 if (cpu_feature_enabled(X86_FEATURE_SHSTK) && !(pmd_flags(pmd) &
_PAGE_RW))
499 dirty = _PAGE_COW;
500
501 return pmd_set_flags(pmd, dirty | _PAGE_SOFT_DIRTY);
502 }
503
504 static inline pmd_t pmd_mkdirty_shstk(pmd_t pmd)
505 {
506 pmd = pmd_clear_flags(pmd, _PAGE_COW);
507 return pmd_set_flags(pmd, _PAGE_DIRTY_HW | _PAGE_SOFT_DIRTY);
508 }
509
510 static inline pmd_t pmd_mkdevmap(pmd_t pmd)
511 {
512 return pmd_set_flags(pmd, _PAGE_DEVMAP);
513 }
514
515 static inline pmd_t pmd_mkhuge(pmd_t pmd)
516 {
517 return pmd_set_flags(pmd, _PAGE_PSE);
518 }
519
520 static inline pmd_t pmd_mkyoung(pmd_t pmd)
521 {
522 return pmd_set_flags(pmd, _PAGE_ACCESSED);
523 }
524
525 static inline pmd_t pmd_mkwrite(pmd_t pmd)
526 {
527 if (cpu_feature_enabled(X86_FEATURE_SHSTK)) {
528 if (pmd_flags(pmd) & _PAGE_COW) {
529 pmd = pmd_clear_flags(pmd, _PAGE_COW);
530 pmd = pmd_set_flags(pmd, _PAGE_DIRTY_HW);
531 }
532 }
533
534 return pmd_set_flags(pmd, _PAGE_RW);
535 }
536
537 static inline pud_t pud_set_flags(pud_t pud, pudval_t set)
538 {
539 pudval_t v = native_pud_val(pud);
540
541 return native_make_pud(v | set);
542 }
543
544 static inline pud_t pud_clear_flags(pud_t pud, pudval_t clear)
545 {
546 pudval_t v = native_pud_val(pud);
547
548 return native_make_pud(v & ~clear);
549 }
550
551 static inline pud_t pud_mkold(pud_t pud)
552 {
553 return pud_clear_flags(pud, _PAGE_ACCESSED);
554 }
555
556 static inline pud_t pud_mkclean(pud_t pud)
557 {
558 return pud_clear_flags(pud, _PAGE_DIRTY_BITS);
559 }
560
561 static inline pud_t pud_wrprotect(pud_t pud)
562 {
563 /*
564 * Blindly clearing _PAGE_RW might accidentally create
565 * a shadow stack PUD (RW=0,Dirty=1). Move the hardware
566 * dirty value to the software bit.
567 */
568 if (cpu_feature_enabled(X86_FEATURE_SHSTK) &&
569 (_PAGE_BIT_COW < sizeof(pud) * BITS_PER_BYTE)) {
570 pud.pud |= (pud.pud & _PAGE_DIRTY_HW) >>
571 _PAGE_BIT_DIRTY_HW << _PAGE_BIT_COW;
572 pud = pud_clear_flags(pud, _PAGE_DIRTY_HW);
573 }
574
575 return pud_clear_flags(pud, _PAGE_RW);
576 }
577
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org