mbox series

[net,v2,0/3] skb frag: kmap_atomic fixes

Message ID 20210109221834.3459768-1-willemdebruijn.kernel@gmail.com
Headers show
Series skb frag: kmap_atomic fixes | expand

Message

Willem de Bruijn Jan. 9, 2021, 10:18 p.m. UTC
From: Willem de Bruijn <willemb@google.com>

skb frags may be backed by highmem and/or compound pages. Various
code calls kmap_atomic to safely access highmem pages. But this
needs additional care for compound pages. Fix a few issues:

patch 1 expect kmap mappings with CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP
patch 2 fixes kmap_atomic + compound page support in skb_seq_read
patch 3 fixes kmap_atomic + compound page support in esp

changes
  v1->v2
   - in patch 2, increase frag_off size from u16 to u32

Willem de Bruijn (3):
  net: support kmap_local forced debugging in skb_frag_foreach
  net: compound page support in skb_seq_read
  esp: avoid unneeded kmap_atomic call

 include/linux/skbuff.h |  3 ++-
 net/core/skbuff.c      | 28 +++++++++++++++++++++++-----
 net/ipv4/esp4.c        |  7 +------
 net/ipv6/esp6.c        |  7 +------
 4 files changed, 27 insertions(+), 18 deletions(-)

Comments

Steffen Klassert Jan. 11, 2021, 8:23 a.m. UTC | #1
On Sat, Jan 09, 2021 at 05:18:34PM -0500, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>

> 

> esp(6)_output_head uses skb_page_frag_refill to allocate a buffer for

> the esp trailer.

> 

> It accesses the page with kmap_atomic to handle highmem. But

> skb_page_frag_refill can return compound pages, of which

> kmap_atomic only maps the first underlying page.

> 

> skb_page_frag_refill does not return highmem, because flag

> __GFP_HIGHMEM is not set. ESP uses it in the same manner as TCP.

> That also does not call kmap_atomic, but directly uses page_address,

> in skb_copy_to_page_nocache. Do the same for ESP.

> 

> This issue has become easier to trigger with recent kmap local

> debugging feature CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP.

> 

> Fixes: cac2661c53f3 ("esp4: Avoid skb_cow_data whenever possible")

> Fixes: 03e2a30f6a27 ("esp6: Avoid skb_cow_data whenever possible")

> Signed-off-by: Willem de Bruijn <willemb@google.com>

> Cc: Steffen Klassert <steffen.klassert@secunet.com>


As this patchset goes through the net tree:

Acked-by: Steffen Klassert <steffen.klassert@secunet.com>


Thanks!
patchwork-bot+netdevbpf@kernel.org Jan. 12, 2021, 2:30 a.m. UTC | #2
Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Sat,  9 Jan 2021 17:18:31 -0500 you wrote:
> From: Willem de Bruijn <willemb@google.com>

> 

> skb frags may be backed by highmem and/or compound pages. Various

> code calls kmap_atomic to safely access highmem pages. But this

> needs additional care for compound pages. Fix a few issues:

> 

> patch 1 expect kmap mappings with CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP

> patch 2 fixes kmap_atomic + compound page support in skb_seq_read

> patch 3 fixes kmap_atomic + compound page support in esp

> 

> [...]


Here is the summary with links:
  - [net,v2,1/3] net: support kmap_local forced debugging in skb_frag_foreach
    https://git.kernel.org/netdev/net/c/29766bcffad0
  - [net,v2,2/3] net: compound page support in skb_seq_read
    https://git.kernel.org/netdev/net/c/97550f6fa592
  - [net,v2,3/3] esp: avoid unneeded kmap_atomic call
    https://git.kernel.org/netdev/net/c/9bd6b629c39e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html