lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 3 Mar 2022 11:14:03 -0800
From:   Yang Shi <shy828301@...il.com>
To:     Miaohe Lin <linmiaohe@...wei.com>
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        kernel test robot <lkp@...el.com>, kbuild-all@...ts.01.org,
        Linux MM <linux-mm@...ck.org>,
        Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>,
        linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        kbuild@...ts.01.org, Vlastimil Babka <vbabka@...e.cz>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Song Liu <songliubraving@...com>,
        Rik van Riel <riel@...riel.com>,
        Matthew Wilcox <willy@...radead.org>, Zi Yan <ziy@...dia.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Theodore Ts'o" <tytso@....edu>,
        Andreas Dilger <adilger.kernel@...ger.ca>,
        darrick.wong@...cle.com
Subject: Re: [PATCH 4/8] mm: thp: only regular file could be THP eligible

On Thu, Mar 3, 2022 at 3:48 AM Miaohe Lin <linmiaohe@...wei.com> wrote:
>
> On 2022/3/3 19:43, Dan Carpenter wrote:
> > Hi Yang,
> >
> > url:    https://github.com/0day-ci/linux/commits/Yang-Shi/Make-khugepaged-collapse-readonly-FS-THP-more-consistent/20220301-075903
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
> > config: arm64-randconfig-m031-20220227 (https://download.01.org/0day-ci/archive/20220302/202203020034.2Ii9kTrs-lkp@intel.com/config)
> > compiler: aarch64-linux-gcc (GCC) 11.2.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@...el.com>
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> >
> > smatch warnings:
> > include/linux/huge_mm.h:179 file_thp_enabled() warn: variable dereferenced before check 'vma->vm_file' (see line 177)
> > mm/khugepaged.c:468 hugepage_vma_check() error: we previously assumed 'vma->vm_file' could be null (see line 455)
> > include/linux/huge_mm.h:179 file_thp_enabled() warn: variable dereferenced before check 'vma->vm_file' (see line 177)
> >
> > vim +179 include/linux/huge_mm.h
> >
> > 2224ed1155c07b Yang Shi     2022-02-28  175  static inline bool file_thp_enabled(struct vm_area_struct *vma)
> > 2224ed1155c07b Yang Shi     2022-02-28  176  {
> > 2224ed1155c07b Yang Shi     2022-02-28 @177   struct inode *inode = vma->vm_file->f_inode;
> >                                                                       ^^^^^^^^^^^^^^
> > Dereference.
> >
> > 2224ed1155c07b Yang Shi     2022-02-28  178
> > 2224ed1155c07b Yang Shi     2022-02-28 @179   return (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS)) && vma->vm_file &&
> >                                                                                                     ^^^^^^^^^^^^
> > Checked too late.
>
> Yep. We should check vma->vm_file first before we access vma->vm_file->f_inode.

Ah, yes, thanks for the report and the suggestion.

>
> Thanks.
>
> >
> > 2224ed1155c07b Yang Shi     2022-02-28  180          (vma->vm_flags & VM_EXEC) &&
> > 2224ed1155c07b Yang Shi     2022-02-28  181          !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode);
> > 2224ed1155c07b Yang Shi     2022-02-28  182  }
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> >
> > .
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ