From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 23C4E3858C5F; Thu, 9 Feb 2023 14:16:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23C4E3858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675952217; bh=bO/VyssQ+rRsWVRX/1sFRvEgnlMBzt0y3lV4v7RGPsI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iF/N9tse9mIW8ufV+fmi8uW18NihC3X4Z3N5um/GIGmqSnGd/kIWohETOG2Uy87Y/ IdnfZmxC/UumtIM/4VkqNRF57QoCvN+OtTwyEwInN4SXH3pTMeOxlBb9iHGUq2VG+a L2Dvf/mGMuPxwjicxTTgpNKESrVmP7SNFaSsXqoc= From: "adhemerval.zanella at linaro dot org" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/30100] [patch] add dlmem() Date: Thu, 09 Feb 2023 14:16:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.38 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: adhemerval.zanella at linaro dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30100 --- Comment #6 from Adhemerval Zanella --- (In reply to Stas Sergeev from comment #5) > Thanks, getting closer! > Now under "make check" I have this crash: >=20 > 112 assert (ptr =3D=3D alloc_last_block); > (gdb) bt > #0 __minimal_realloc (ptr=3D0x7ffff7fc2000, n=3D1680) at dl-minimal-mall= oc.c:112 > #1 0x00007ffff7fcf3b1 in realloc (size=3D1680, ptr=3D) > at ../include/rtld-malloc.h:62 > #2 filebuf_ensure (size=3D848, fb=3D0x7fffffffd4e0) at dl-load.c:149 >=20 >=20 > My code calls realloc(), but for some reason it ends up in > __minimal_realloc(). Which is so minimal that it only supports > the realloc of a last-allocated pointer. If some other allocation > was in between, __minimal_realloc() asserts. > How can I use the maximum realloc instead? The minimal malloc should be only used by the loader on very specific cases= , it is a simple bump allocator without support advance features that generic ma= lloc provides (such as thread, fragmentation, etc). If you need a more generic memory allocator, it would be better to either restructure the patch to pre-allocate the required memory or work with the bump allocator by trying = to use different algorithms that avoid fragmentation (I have not look into the patch to comment what it would require). You might try to extend the minimal malloc, but I am not sure if the comple= xity would be worth. --=20 You are receiving this mail because: You are on the CC list for the bug.=