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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b2b52cfc-20f2-3f7e-8fc0-ae9b54f34e93@google.com>
Date:   Sun, 26 Sep 2021 13:01:21 -0700 (PDT)
From:   Hugh Dickins <hughd@...gle.com>
To:     liuyuntao <liuyuntao10@...wei.com>
cc:     hughd@...gle.com, akpm@...ux-foundation.org,
        kirill.shutemov@...ux.intel.com, kirill@...temov.name,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        liusirui@...wei.com, windspectator@...il.com, wuxu.wu@...wei.com
Subject: Re: [PATCH v2] fix judgment error in shmem_is_huge()

On Sun, 26 Sep 2021, liuyuntao wrote:
> On Sat, 25 Sep 2021, Hugh Dickins wrote:
> > On Fri, 24 Sep 2021, Hugh Dickins wrote:
> > > On Thu, 9 Sep 2021, Liu Yuntao wrote:
> > > 
> > > > In the case of SHMEM_HUGE_WITHIN_SIZE, the page index is not rounded
> > > > up correctly. When the page index points to the first page in a huge
> > > > page, round_up() cannot bring it to the end of the huge page, but
> > > > to the end of the previous one.
> > > > 
> > > > an example:
> > > > HPAGE_PMD_NR on my machine is 512(2 MB huge page size).
> > > > After allcoating a 3000 KB buffer, I access it at location 2050 KB.
> > > 
> > > Your example is certainly helpful, but weird!  It's not impossible,
> > > but wouldn't it be easier to understand if you said "2048 KB" there?
> 
> I wanted to emphasize that access to any bit in the first page will
> trigger this problem, so I didn't use "2048 KB".

Okay, thanks, I see your point now.  (And I have to admit that, in my
confusion, I had thought 2050 KB would be index 514 - of course not!)

> > > > In shmem_is_huge(), the corresponding index happens to be 512.

...

> > Your patch makes within_size more sensible than it was for pre-sized
> > files (and I think it's fair to say that the majority of files in
> > shmem's internal mount, subject to thp/shmem_enabled, are likely to
> > be fixed-size files); and better-defined than it used to be on
> > growing files, but they won't get the huge pages they used to.
> 
> Although my patch changes shmem's behaviour, it makes shmem consistent
> with the documentation. I think with the new code, it will be easier
> for our users to understand.

Yes, I do agree with you.  But the change in behaviour when appending at
EOF is significant, and needed to be called out - I think none of quite
realized that effect at first.

Hugh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ