Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AD9DC04A95 for ; Sat, 22 Oct 2022 12:20:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AC4684F3B; Sat, 22 Oct 2022 14:19:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=xs4all.nl header.i=@xs4all.nl header.b="eTpqSAw0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EFFB584F5E; Sat, 22 Oct 2022 14:19:52 +0200 (CEST) Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B679E84F39 for ; Sat, 22 Oct 2022 14:19:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mark.kettenis@xs4all.nl X-KPN-MessageId: d11bd77f-5203-11ed-8a67-005056ab378f Received: from smtp.kpnmail.nl (unknown [10.31.155.37]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id d11bd77f-5203-11ed-8a67-005056ab378f; Sat, 22 Oct 2022 14:19:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=xs4all01; h=subject:to:from:message-id:date; bh=LQUeDCmP5ozISuMlkCYUUim8T20SABFWGUXQ5vzGkWQ=; b=eTpqSAw0j3nL5esXh5HLWzxkhFGAJAP3oWEWS5W5x48ieZolX5uY17wkhJRmOlRqLPKGhReR3N4vz vieOHnwUKjehV/LevEJG6OGpB4LpCM3LEmE+ipTHQXwj95UQ0m0dY6MslKnh6G8zcfWIg1MhvO87kx +gRsx4H/6maPN9n7r9/mVz2yh/0edIqI1pjAVezOy3WTl+ju7acSAxEiEliFiUm6xSLbBx/3Z0ARE7 fRzcVUcumi/uB2OWak4cb+7EHO+UGsRyosWBVpvPGqbg8Ekug00gq4/viHlRPZtTR9xH4nRjXnuctI QN3+FFXGSL/NHRVnm4ooVrt8X8GisiQ== X-KPN-MID: 33|Q/odz3HNGAuL9tDAH/3bBAqWDmFzgUv/Gr4jUy2ZrtrzsB+8Dq4dAkvbHyYnRKk eRjBxCKOyIk3ZcSRFa9md6D0kw5/F5JN1anVShvmz3Cg= X-KPN-VerifiedSender: Yes X-CMASSUN: 33|CKbGpV8mVNwoYKU2zFTyutf3Mmhwc88rYJzYDk85cz3rS+OnR6KAGYdvvceimAw T7zVKeTSdSabl9LdCkprRng== X-Originating-IP: 80.61.163.207 Received: from bloch.sibelius.xs4all.nl (80-61-163-207.fixed.kpn.net [80.61.163.207]) by smtp.xs4all.nl (Halon) with ESMTPSA id d13be236-5203-11ed-929c-005056ab1411; Sat, 22 Oct 2022 14:19:47 +0200 (CEST) Date: Sat, 22 Oct 2022 14:19:46 +0200 Message-Id: <878rl8rqxp.fsf@bloch.sibelius.xs4all.nl> From: Mark Kettenis To: Heinrich Schuchardt Cc: sjg@chromium.org, u-boot@lists.denx.de In-Reply-To: <2aa6bf64-48f4-cc48-ef7f-c8369b86fc79@gmx.de> (message from Heinrich Schuchardt on Sat, 22 Oct 2022 11:14:34 +0200) Subject: Re: [BUG] poweroff command in ./u-boot -T -l causes SIG_SEGV References: <2aa6bf64-48f4-cc48-ef7f-c8369b86fc79@gmx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean > Date: Sat, 22 Oct 2022 11:14:34 +0200 > From: Heinrich Schuchardt > > Hello Simon, > > when running ./u-boot -T -l and issuing the poweroff command a crash occurs: > > os_exit() results in std::ostream::flush() calling U-Boot's fflush with > file = -138447008 (or any other negative number) > > Man fflush shows the following definition: > > int fflush(FILE *stream); > > U-Boot's fflush() is defined as > > void fflush(int file); > > The pointer FILE *stream is truncated to int which may result in a > negative number when invoking U-Boot's fflush() but anyway we want > std::ostream::flush() to invoke glibc's fflush(). > > Can we ensure correct linking or do we have to rename fflush()? Probably have to rename it. The name is reserved by the ISO C standard, at least when building in a non-freestanding environment. And the sandbox stuff means that U-Boot isn't always compiled in a free-standing environment. I do wonder though how you end up building the sandbox with a C++ compiler. There is some logic in the build system (inherited from the Linux kernel?) to build host tools with C++. But I'd hope the sandbox doesn't use that.