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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 29 Apr 2022 13:33:45 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Mina Almasry <almasrymina@...gle.com>
Cc:     Mike Kravetz <mike.kravetz@...cle.com>,
        Oscar Salvador <osalvador@...e.de>,
        Muchun Song <songmuchun@...edance.com>,
        Michal Hocko <mhocko@...e.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] hugetlbfs: fix hugetlbfs_statfs() locking

On Fri, 29 Apr 2022 13:22:06 -0700 Mina Almasry <almasrymina@...gle.com> wrote:

> After commit db71ef79b59b ("hugetlb: make free_huge_page irq safe"),
> the subpool lock should be locked with spin_lock_irq() and all call
> sites was modified as such, except for the ones in hugetlbfs_statfs().
> 
> ...
>
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -1048,12 +1048,12 @@ static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf)
>  		if (sbinfo->spool) {
>  			long free_pages;
> 
> -			spin_lock(&sbinfo->spool->lock);
> +			spin_lock_irq(&sbinfo->spool->lock);
>  			buf->f_blocks = sbinfo->spool->max_hpages;
>  			free_pages = sbinfo->spool->max_hpages
>  				- sbinfo->spool->used_hpages;
>  			buf->f_bavail = buf->f_bfree = free_pages;
> -			spin_unlock(&sbinfo->spool->lock);
> +			spin_unlock_irq(&sbinfo->spool->lock);
>  			buf->f_files = sbinfo->max_inodes;
>  			buf->f_ffree = sbinfo->free_inodes;
>  		}

Looks good.

This seems to be theoretically deadlockable and less theoretically
lockdep splattable, so I'm inclined to cc:stable on this.

I wonder why we didn't do that with db71ef79b59bb2e78dc4.

Powered by blists - more mailing lists