All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Konstantin Khorenko <khorenko@virtuozzo.com>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v2 2/2] binfmt_elf: return the real error when program headers cannot be loaded
Date: Wed, 4 Nov 2026 18:08:51 +0000	[thread overview]
Message-ID: <010701a1a7bfde9b-26b95ef6-a7d4-4227-b11e-915b7328855a-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261104-b4-prep-khorenko-vstor-149847-1-upstream-fixes-v2-2-2974ec52f0fe@virtuozzo.com>

> load_elf_phdrs() returns NULL on any failure, and load_elf_binary()
> turns that into -ENOEXEC for the executable and -ELIBBAD for its
> interpreter. So a failed allocation or read of the program headers
> makes glibc's execvp() run the ELF file with /bin/sh, and reports a
> healthy ld.so as a corrupted shared library.
> 
> Return an ERR_PTR instead, as binfmt_elf_fdpic does:
> 
>   -ENOEXEC     bad e_phentsize, e_phnum or e_phoff, or a short read
>   -ENOMEM      the allocation fails
>   read error   kernel_read() fails
> 
> Malformed files and short reads keep getting -ENOEXEC and -ELIBBAD.
> The table is read with kernel_read() directly, as elf_read() turns a
> short read into -EIO. An e_phoff past LLONG_MAX - size is rejected up
> front, so that rw_verify_area() does not turn it into -EINVAL.
> 
> Backport note: mainline review asked for a change of the errno only, and
> this version does just that; a mainline v2 will follow. The v6.17 change
> "binfmt_elf: remove the 4k limitation of program header size" is not in
> this tree, so the header table is still limited to ELF_MIN_ALIGN and the
> allocation in practice fails only under fault injection; the read errors
> and the e_phoff check apply as they are.
> 
> Fixes: 6a8d38945cf4 ("binfmt_elf: Hoist ELF program header loading to a function")
> Fixes: a9d9ef133f44 ("binfmt_elf: load interpreter program headers earlier")
> https://virtuozzo.atlassian.net/browse/VSTOR-150144
> 
> Feature: fix ms/exec
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261104-b4-prep-khorenko-vstor-149847-1-upstream-fixes-v2-0-2974ec52f0fe@virtuozzo.com?part=2


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

  reply	other threads:[~2026-11-04 18:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 18:05 [Devel] [PATCH hci-8.1 v2 0/2] mm, binfmt_elf: two fixes also posted to mainline Konstantin Khorenko
2026-11-04 18:05 ` [Devel] [PATCH hci-8.1 v2 1/2] mm/huge_memory: recheck a special PMD under the lock in copy_huge_pmd() Konstantin Khorenko
2026-11-04 18:08   ` no-reply
2026-11-04 18:05 ` [Devel] [PATCH hci-8.1 v2 2/2] binfmt_elf: return the real error when program headers cannot be loaded Konstantin Khorenko
2026-11-04 18:08   ` no-reply [this message]
2026-11-04 19:16 ` [Devel] [PATCH hci-8.1 v2 0/2] mm, binfmt_elf: two fixes also posted to mainline 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=010701a1a7bfde9b-26b95ef6-a7d4-4227-b11e-915b7328855a-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=ptikhomirov@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.