All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>,
	Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org, Artem Bulgakov <artem.bulgakov@virtuozzo.com>
Subject: Re: [Devel] [PATCH hci-8.2] fs/pipe: use kvfree() for the buffer arrays of a resized pipe
Date: Tue, 1 Dec 2026 12:44:42 +0000	[thread overview]
Message-ID: <010701a231a2cba6-1128bc9b-a31c-4f89-9ba7-51a12f7ba84d-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261201-pipe-resize-kvfree-v1-1-0a27f34709e0@virtuozzo.com>

> Since commit c14599b9e5f7 ("fs/pipe: Use kvcalloc for pipe buffers")
> the buffer array of a pipe comes from kvcalloc(), but
> pipe_resize_ring() still frees it in two wrong ways.
> 
> When the pipe holds more data than the new size, the EBUSY path frees
> the new array with kfree(). For a large pipe the array comes from
> vmalloc(), and kfree() of a vmalloc address crashes the node. Host root
> hits it with a filled 1 GiB pipe shrunk to 512 MiB:
> 
>   BUG: unable to handle page fault for address: ffffeb0200088008
>   RIP: 0010:kfree+0x83/0x460
>   pipe_resize_ring+0x546/0x5d0
>   pipe_fcntl+0x2da/0x500
>   do_fcntl+0x236/0x1560
> 
> On success the old array is freed with kvfree() under
> pipe->rd_wait.lock with interrupts off, and vfree() can sleep:
> 
>   BUG: sleeping function called from invalid context at mm/vmalloc.c
> 
> Use kvfree() on the EBUSY path, and free the old array after the
> unlock.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-158055
> 
> Feature: mm: avoid high order allocations in all subsystems
> Fixes: c14599b9e5f7 ("fs/pipe: Use kvcalloc for pipe buffers")
> Reported-by: Artem Bulgakov <artem.bulgakov@virtuozzo.com>
> Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261201-pipe-resize-kvfree-v1-1-0a27f34709e0@virtuozzo.com?part=1


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-12-01 12:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 12:41 Vasileios Almpanis
2026-12-01 12:44 ` no-reply [this message]
2026-12-01 13:08 ` Pavel Tikhomirov
2026-12-01 15:24 ` Konstantin Khorenko
2026-12-01 15:24 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=010701a231a2cba6-1128bc9b-a31c-4f89-9ba7-51a12f7ba84d-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=artem.bulgakov@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=vasileios.almpanis@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.