[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220207092619.08754453@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 7 Feb 2022 09:26:19 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: davem@...emloft.net, netdev@...r.kernel.org, borisp@...dia.com,
john.fastabend@...il.com, daniel@...earbox.net,
vfedorenko@...ek.ru, kernel-team@...com, axboe@...nel.dk
Subject: Re: [PATCH net-next] tls: cap the output scatter list to something
reasonable
On Mon, 7 Feb 2022 17:15:30 +0000 Al Viro wrote:
> On Wed, Feb 02, 2022 at 02:20:31PM -0800, Jakub Kicinski wrote:
> > TLS recvmsg() passes user pages as destination for decrypt.
> > The decrypt operation is repeated record by record, each
> > record being 16kB, max. TLS allocates an sg_table and uses
> > iov_iter_get_pages() to populate it with enough pages to
> > fit the decrypted record.
> >
> > Even though we decrypt a single message at a time we size
> > the sg_table based on the entire length of the iovec.
> > This leads to unnecessarily large allocations, risking
> > triggering OOM conditions.
> >
> > Use iov_iter_truncate() / iov_iter_reexpand() to construct
> > a "capped" version of iov_iter_npages(). Alternatively we
> > could parametrize iov_iter_npages() to take the size as
> > arg instead of using i->count, or do something else..
>
> Er... Would simply passing 16384/PAGE_SIZE instead of MAX_INT work
> for your purposes?
The last arg is maxpages, I want maxbytes, no?
Powered by blists - more mailing lists