From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11054 Path: news.gmane.org!.POSTED!not-for-mail From: Tobias Koch Newsgroups: gmane.linux.lib.musl.general Subject: Memory management problem? Date: Fri, 17 Feb 2017 17:48:08 +0000 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1487353715 1611 195.159.176.226 (17 Feb 2017 17:48:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Feb 2017 17:48:35 +0000 (UTC) To: musl Original-X-From: musl-return-11069-gllmg-musl=m.gmane.org@lists.openwall.com Fri Feb 17 18:48:31 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cemdw-0008GF-CU for gllmg-musl@m.gmane.org; Fri, 17 Feb 2017 18:48:28 +0100 Original-Received: (qmail 19747 invoked by uid 550); 17 Feb 2017 17:48:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 19650 invoked from network); 17 Feb 2017 17:48:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nonterra.onmicrosoft.com; s=selector1-nonterra-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4lGl3lkD3N+QsC40jmLmKn1P+AZTUiN12mV7pqXuA5o=; b=jkhMSvuyaUj3iPCIuJ03Jn/o2Jw7ZWA1i/gIijpsaWIz7vvoVuuif6pOEzHZIZ1CcXKKSa8kr+V/IV12cYtyAJmJ6OVR7eYh3gudJtMwmmyFRuoMhyJMDGT3pV8+6FWa+Rdw7iP1XJ7+Effc0NSI/RBEy3goEiQmSlCW4MjmniU= Thread-Topic: Memory management problem? Thread-Index: AQHSiUXPLIVliPArl0SioP8MelkSIg== Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tobias.koch@nonterra.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [10.141.191.132] x-ms-office365-filtering-correlation-id: 1ecbd143-1e42-46f5-2e3d-08d4575d2295 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:AM3PR01MB0631; x-microsoft-exchange-diagnostics: 1;AM3PR01MB0631;7:iiFZT+BuxySyO+Qtd4YBbbma540VwuHoXXWFOTsiC9phZ/GE3gKUtITO/jhzIMaGq1B0D3hwzP+aaYVG5OtH7TZIogvZ3qIIEQbaodqxRLJwAC5idWz1uoJYKaPvcKhf3QG6BSQcBMrmMj0XTKIinqmVcweUY90nq8HyynPkJYvPR0yA+j8mKBgmr6Y/d+V4zfuUxxvwP+EJ0FO7NYbBhhtaLdwP2brB4kEbpsjkPTie/ZgSZ6PoVFrKQBc3Sy1MWgW4yniTFiuLYffhtYlk2fMw+Zzi72OhP+xD2A+rn99O8weUoF/65Pr66CFgQawD6Nrjyj0arTrFqX1OUm3I8g== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(17755550239193); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123560025)(20161123558025)(2016111802025)(20161123555025)(20161123564025)(20161123562025)(6072148)(6043046);SRVR:AM3PR01MB0631;BCL:0;PCL:0;RULEID:;SRVR:AM3PR01MB0631; x-forefront-prvs: 02213C82F8 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(39450400003)(199003)(189002)(92566002)(38730400002)(110136004)(5250100002)(7696004)(97736004)(2900100001)(7116003)(189998001)(81156014)(99286003)(3660700001)(5660300001)(7736002)(9686003)(81166006)(68736007)(55016002)(8676002)(102836003)(3846002)(6436002)(6116002)(305945005)(50986999)(2906002)(54356999)(6506006)(74316002)(3280700002)(101416001)(3480700004)(8936002)(106356001)(450100001)(53936002)(6916009)(33656002)(86362001)(105586002)(106116001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM3PR01MB0631;H:AM3PR01MB0632.eurprd01.prod.exchangelabs.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: nonterra.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-OriginatorOrg: nonterra.com X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Feb 2017 17:48:08.5616 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a4ced734-fec2-4648-b484-958492239aa0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR01MB0631 Xref: news.gmane.org gmane.linux.lib.musl.general:11054 Archived-At: Hi, I have (cross) compiled a chroot out of Debian testing sources but with mus= l and busybox at the core. The target is x86_64-cross-linux-musl. Now that = I got to the point where I can actually run some builds inside the chroot i= tself, I noticed that flex segfaults on startup. In the flex sources this s= nippet is executed: num_to_alloc =3D 1; /* After all that talk, this was set to 1 anyways..= . */ (yy_buffer_stack) =3D (struct yy_buffer_state**) yyalloc(num_to_alloc *= sizeof(struct yy_buffer_state*)); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" = ); memset((*yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_st= ate*)); The memset is optimized away, because GCC understands that the pointer targ= et is just one native word and does a =3D> 0x0000000000401c7e <+64>:64movq $0x0,(%rax) instead. Strace shows the following output: execve("/tools/bin/flex", ["flex"], [/* 18 vars */]) =3D 0 arch_prctl(ARCH_SET_FS, 0x7f87ee4d5b28) =3D 0 set_tid_address(0x7f87ee4d5b60) =3D 18855 mprotect(0x7f87ee4d2000, 4096, PROT_READ) =3D 0 mprotect(0x63f000, 4096, PROT_READ) =3D 0 brk(NULL) =3D 0x1cd4000 brk(0x1cd6000) =3D 0x1cd6000 brk(0x1cd7000) =3D 0x1cd7000 brk(0x1cd8000) =3D 0x1cd8000 brk(0x1cda000) =3D 0x1cda000 brk(0x1cdc000) =3D 0x1cdc000 brk(0x1cde000) =3D 0x1cde000 brk(0x1ce0000) =3D 0x1ce0000 brk(0x1ce2000) =3D 0x1ce2000 brk(0x1ce4000) =3D 0x1ce4000 brk(0x1ce6000) =3D 0x1ce6000 brk(0x1ce8000) =3D 0x1ce8000 brk(0x1cea000) =3D 0x1cea000 brk(0x1cec000) =3D 0x1cec000 brk(0x1cef000) =3D 0x1cef000 brk(0x1cf0000) =3D 0x1cf0000 brk(0x1cf1000) =3D 0x1cf1000 brk(0x1cf2000) =3D 0x1cf2000 brk(0x1cf3000) =3D 0x1cf3000 brk(0x1cf4000) =3D 0x1cf4000 brk(0x1cf6000) =3D 0x1cf6000 brk(0x1cf8000) =3D 0x1cf8000 --- SIGSEGV {si_signo=3DSIGSEGV, si_code=3DSEGV_MAPERR, si_addr=3D0xfff= fffffee4d6d60} --- +++ killed by SIGSEGV +++ Segmentation fault I'm not sure, if there is a problem with musl or some sort of optimization = problem with GCC. If I compile either musl or flex without optimizations, t= he problem goes away. I have tried version 1.1.16 and git master. Any hints on how I could get to the bottom of this, would be greatly apprec= iated. Tobias