Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200604195251.GS1079@brightrain.aerifal.cx>
Date: Thu, 4 Jun 2020 15:52:51 -0400
From: Rich Felker <dalias@...c.org>
To: erny hombre <hombre67@....at>
Cc: musl@...ts.openwall.com
Subject: Re: 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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.