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] [thread-next>] [day] [month] [year] [list]
Message-ID: <3407981.1724070305@warthog.procyon.org.uk>
Date: Mon, 19 Aug 2024 13:25:05 +0100
From: David Howells <dhowells@...hat.com>
To: Hannes Reinecke <hare@...e.de>
Cc: dhowells@...hat.com,
    "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>,
    brauner@...nel.org, akpm@...ux-foundation.org,
    chandan.babu@...cle.com, linux-fsdevel@...r.kernel.org,
    djwong@...nel.org, gost.dev@...sung.com, linux-xfs@...r.kernel.org,
    hch@....de, david@...morbit.com, Zi Yan <ziy@...dia.com>,
    yang@...amperecomputing.com, linux-kernel@...r.kernel.org,
    linux-mm@...ck.org, willy@...radead.org, john.g.garry@...cle.com,
    cl@...amperecomputing.com, p.raghav@...sung.com, mcgrof@...nel.org,
    ryan.roberts@....com
Subject: Re: [PATCH v12 00/10] enable bs > ps in XFS

Hannes Reinecke <hare@...e.de> wrote:

> IE you essentially nail AFS to use PAGE_SIZE.
> Not sure how you would tell AFS to use a different block size;
> maybe a mount option?

As far as I know:

        sb->s_blocksize         = PAGE_SIZE;
        sb->s_blocksize_bits    = PAGE_SHIFT;

isn't used by the VM.

> Hmm. I'd rather fix the obvious places in afs first; just do a quick
> grep for 'PAGE_', that'll give you a good impression of places to look at.

Sure:

   fs/afs/dir.c:   nr_pages = (i_size + PAGE_SIZE - 1) / PAGE_SIZE;
   fs/afs/dir.c:   req->len = nr_pages * PAGE_SIZE; /* We can ask for more than there is */
   fs/afs/dir.c:           task_io_account_read(PAGE_SIZE * req->nr_pages);
   fs/afs/dir.c:           folio = __filemap_get_folio(dir->i_mapping, ctx->pos / PAGE_SIZE,
   fs/afs/xdr_fs.h:#define AFS_DIR_BLOCKS_PER_PAGE (PAGE_SIZE / AFS_DIR_BLOCK_SIZE)

Those only affect directories.

   fs/afs/mntpt.c:         if (size < 2 || size > PAGE_SIZE - 1)

That only affects mountpoint symlinks.

   fs/afs/super.c: sb->s_blocksize         = PAGE_SIZE;

This is the only thing (and sb->s_blocksize_bits) that might affect files.  I
checked, and doubling this and adding 1 to bits does not alter the outcome.

Now, the VM wrangling is offloaded to netfslib, and most of that is to do with
converting between indices and file positions.  Going through the usages of
PAGE_SIZE there:

   fs/netfs/buffered_read.c:               size += PAGE_SIZE << order;

That was recording the size of a folio readahead allocated.

   fs/netfs/buffered_read.c:       size_t nr_bvec = flen / PAGE_SIZE + 2;
   fs/netfs/buffered_read.c:               part = min_t(size_t, to - off, PAGE_SIZE);

Those two are used to fill in the gaps around a partial page - but that didn't
appear in the logs.

   fs/netfs/buffered_write.c:      pgoff_t index = pos / PAGE_SIZE;
   fs/netfs/buffered_write.c:              fgp_flags |= fgf_set_order(pos % PAGE_SIZE + part);

Those two are used when asking __filemap_get_folio() to allocate a folio to
write into.  I got a folio of the right size and index, so that's not the
problem.

   fs/netfs/fscache_io.c:  pgoff_t first = start / PAGE_SIZE;
   fs/netfs/fscache_io.c:  pgoff_t last = (start + len - 1) / PAGE_SIZE;

Caching is not enabled at the moment, so these don't happen.

   fs/netfs/iterator.c:            cur_npages = DIV_ROUND_UP(ret, PAGE_SIZE);
   fs/netfs/iterator.c:                    len = ret > PAGE_SIZE ? PAGE_SIZE : ret;

I'm not doing DIO, so these aren't used.

   fs/netfs/iterator.c:    pgoff_t index = pos / PAGE_SIZE;

I'm not using an ITER_XARRAY iterator, so this doesn't happen.

   fs/netfs/misc.c:        rreq->io_iter.count += PAGE_SIZE << order;

This is just multiplying up the folio size to add to the byte count.

   fs/netfs/read_collect.c:        fsize = PAGE_SIZE << subreq->curr_folio_order;
   fs/netfs/read_collect.c:            WARN_ON_ONCE(folioq_folio(folioq, slot)->index != fpos / PAGE_SIZE)) {

These two are converting between a file pos and an index - but only during
read, and I can see from wireshark that we're writing the wrong data to the
server before we get this far.

And that's all the PAGE_SIZE usages in afs and netfslib.

David


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ