From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SUBJ_OBFU_PUNCT_FEW autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27532 invoked from network); 4 Jun 2020 19:53:07 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 4 Jun 2020 19:53:07 -0000 Received: (qmail 20363 invoked by uid 550); 4 Jun 2020 19:53:04 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 20345 invoked from network); 4 Jun 2020 19:53:03 -0000 Date: Thu, 4 Jun 2020 15:52:51 -0400 From: Rich Felker To: erny hombre Cc: musl@lists.openwall.com Message-ID: <20200604195251.GS1079@brightrain.aerifal.cx> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Data abort in __set_thread_area On Thu, Jun 04, 2020 at 09:36:37PM +0200, erny hombre wrote: > Hello, > > I am writing an operating system for an ARM processor (Cortex-A9). > For the user programs I want to use musl libc. I have built a > toolchain with musl-cross-make (musl 1.2.0). I can link a user > program with libc.a. After loading the program, I call _start. Then > I run into a data abort in function __set_thread_area > (/musl-1.2.0/src/env/__libc_start_main.c) at this statement: > > int ver = *(int *)0xffff0ffc; > > The data abort is reasonable, because no memory is mapped at this > virtual address. I don't know what's the purpose of this code. Can > anybody explain me what this function does and which environment is > needed to make it work ? You need to either provide compatible kuser_helper functions mapped at 0xffff0000, or ensure HWCAP_TLS is set in the aux vector's AT_HWCAP to indicate that the hardware thread pointer and atomics are available on the particular cpu model. Alternatively you can just ensure you build targeting armv7-a (to make this the toolchain default configure it --with-arch=armv7-a) so that this all gets hard-coded at compile time and there is no runtime selection of atomics/tls access method. Rich