bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1


From: Chet Ramey
Subject: Re: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1's malloc.c
Date: Mon, 4 Oct 2021 10:15:11 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 10/4/21 4:34 AM, Andreas Schwab wrote:
> On Okt 04 2021, Julien Moutinho wrote:
> 
>> - bash crashes inside valgrind too,
>>   but apparently something different is happening
>>   because it crashes even without systemd being involved:
>>
>> $ nix build .#bash5-with-bash-malloc
>> $ valgrind result/bin/bash --norc -c true
>>> ==307088== Memcheck, a memory error detector
>>> ==307088== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
>>> ==307088== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright 
>>> info
>>> ==307088== Command: result/bin/bash --norc -c true
>>> ==307088== 
>>> ==307088== Invalid free() / delete / delete[] / realloc()
>>> ==307088==    at 0x483F8E9: free (in 
>>> /nix/store/7s7hzqaf5imxmpjlxh2n6fs7ixml98ya-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>>> ==307088==    by 0x47330F: xfree (xmalloc.c:150)
>>> ==307088==    by 0x4644FA: unwind_frame_run_internal (unwind_prot.c:325)
>>> ==307088==    by 0x4640B6: without_interrupts (unwind_prot.c:117)
>>> ==307088==    by 0x464656: run_unwind_frame (unwind_prot.c:143)
>>> ==307088==    by 0x479ACA: parse_and_execute (evalstring.c:523)
>>> ==307088==    by 0x41C0A5: run_one_command (shell.c:1440)
>>> ==307088==    by 0x41D6A1: main (shell.c:741)
>>> ==307088==  Address 0x404be10 is in the brk data segment 0x4033000-0x4054fff
> 
> Here is a patch:

How does this fix the problem with valgrind? How does wrapping xfree in a
local function help?

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]