Article View: linux.debian.bugs.dist
Article #5737Bug#1154725: sudo segfault
From: Marc Haber
Date: Mon, 23 Nov 2026 12:40
Date: Mon, 23 Nov 2026 12:40
43 lines
4633 bytes
4633 bytes
This is totally unreadable, please reformat for a human.
On Mon, Nov 23, 2026 at 01:33:22PM +0100, Michael Kriese wrote:
>Control: tags -1 - unreproducible Hi, this is reproducible in a stock
>container, no custom sudoers needed: docker run --rm -it debian:trixie
>bash apt-get update && apt-get install -y sudo # 1.9.16p2-3+deb13u5
>env -i /usr/bin/sudo true # Segmentation fault, exit 139 - Crashes as
>root and as an unprivileged user with an empty environment. - Works
>with at least one variable set (e.g. env -i PATH=/usr/bin sudo true).
>- Works with 1.9.16p2-3+deb13u2. Cause:
>0013-Copy-envp-submit_envp-instead-of-replacing-the-envir.patch only
>assigns submit_envp inside `if (envc != 0)`. With an empty environment
>it stays NULL (static initializer) instead of pointing to an empty
>array as before (submit_envp = envp), and the NULL envp is passed to
>sudoers.so, which matches the "segfault at 0 ... in sudoers.so" in the
>original report. Upstream main (src/sudo.c, os_init_common) has the
>same code, so this is not specific to the backport. Fix proposed
>upstream: https://github.com/sudo-project/sudo/pull/604 Verified:
>rebuilt 1.9.16p2-3+deb13u5 with it in debian:trixie, env -i sudo
>true then exits 0 as root and as an unprivileged user. The same change
>applies to the Debian patch: --- a/src/sudo.c +++ b/src/sudo.c @@
>os_init_common for (envc = 0; envp[envc] != NULL; envc++) continue; -
>if (envc != 0) { - submit_envp = reallocarray(NULL, sizeof(char *),
>envc + 1); - if (submit_envp == NULL || !gc_add(GC_PTR, submit_envp))
>{ - sudo_fatalx_nodebug(U_("%s: %s"), __func__, - U_("unable to
>allocate memory")); - } - for (envc = 0; envp[envc] != NULL; envc++) -
>submit_envp[envc] = envp[envc]; - submit_envp[envc] = NULL; - } +
>submit_envp = reallocarray(NULL, sizeof(char *), envc + 1); + if
>(submit_envp == NULL || !gc_add(GC_PTR, submit_envp)) { +
>sudo_fatalx_nodebug(U_("%s: %s"), __func__, + U_("unable to allocate
>memory")); + } + for (envc = 0; envp[envc] != NULL; envc++) +
>submit_envp[envc] = envp[envc]; + submit_envp[envc] = NULL; Impact:
>anything calling sudo with an empty environment breaks, e.g. the
>Forgejo runner's LXC backend (CI of forgejo/end-to-end) and Allsky
>(https://github.com/AllskyTeam/allsky/issues/5668). Regards, Michael
>-- Drafted by Claude Code (Claude Opus 5.5, low effort) on behalf of
>Michael Kriese.
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
Technical Details
Message-ID:
<O2BuV-dFuB-1@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodReferences:
<O1ZSF-dkMS-1@gated-at.bofh.it> <O2BuV-dFuB-3@gated-at.bofh.it> <O1ZSF-dkMS-1@gated-at.bofh.it> <O2BuV-dFuB-3@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: Marc Haber <mh+debian-packages@zugschlus.de> Newsgroups: linux.debian.bugs.dist Subject: Bug#1154725: sudo segfault Date: Mon, 23 Nov 2026 13:40:01 +0100 Message-ID: <O2BuV-dFuB-1@gated-at.bofh.it> References: <O1ZSF-dkMS-1@gated-at.bofh.it> <O2BuV-dFuB-3@gated-at.bofh.it> <O1ZSF-dkMS-1@gated-at.bofh.it> <O2BuV-dFuB-3@gated-at.bofh.it> X-Original-To: Michael Kriese <michael.kriese@gmx.de>, 1154725@bugs.debian.org X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Mon Nov 23 12:39:09 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -1.651 Reply-To: Marc Haber <mh+debian-packages@zugschlus.de>, 1154725@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: sudo@packages.debian.org X-Debian-Pr-Message: followup 1154725 X-Debian-Pr-Package: sudo X-Debian-Pr-Source: sudo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline User-Agent: Mutt/2.2.13 (2024-03-09) X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2004419 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 43 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: 1154725-submitter@bugs.debian.org X-Original-Date: Mon, 23 Nov 2026 13:37:08 +0100 X-Original-Message-ID: <awQzdNE6v-HTbgcu@torres.zugschlus.de> X-Original-References: <E1xUrgW-000000004v4-02oq@mx2.net9.pw> <579e9542-8c20-4280-9d39-0e49c8eb22b8@gmx.de> <E1xUrgW-000000004v4-02oq@mx2.net9.pw> <579e9542-8c20-4280-9d39-0e49c8eb22b8@gmx.de>