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=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9197 invoked from network); 20 Jun 2020 00:15:49 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 20 Jun 2020 00:15:49 -0000 Received: (qmail 17484 invoked by uid 550); 20 Jun 2020 00:15:47 -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 17462 invoked from network); 20 Jun 2020 00:15:46 -0000 Date: Fri, 19 Jun 2020 20:15:34 -0400 From: Rich Felker To: Robert =?utf-8?B?U2tvcGFsw61r?= Cc: "musl@lists.openwall.com" , Miroslav =?utf-8?B?TsSbbWXEjWVr?= Message-ID: <20200620001530.GP6430@brightrain.aerifal.cx> References: <20200415192940.GJ11469@brightrain.aerifal.cx> <005a01d61f40$dc8cc7b0$95a65710$@codeaurora.org> <20200430235109.GJ21576@brightrain.aerifal.cx> <8c3611dcf8e2c59885fecd9ebdc70d79@codeaurora.org> <20200506005929.GG21576@brightrain.aerifal.cx> <1a0301d6458e$b4264d90$1c72e8b0$@codeaurora.org> <20200618214247.GD2048759@port70.net> <096001d64684$d322d0f0$796872d0$@codeaurora.org> <20200619224624.GO6430@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] strtok On Sat, Jun 20, 2020 at 12:03:12AM +0000, Robert SkopalĂ­k wrote: > Hello, > > we are working on an OS for a STM32 MCU. We like how the reentrancy > is solved in musl, but ... when two (or more) userspace programs > using a strtok function are run, there might be a collision (because > strtok uses a static var to save the pointer). We did not find any > redirection mechanism from strtok to strtok_r. How is it meant pls? > We do not want to force the users to write strtok_r into a > non-threaded user program. > > Is there some solution to make it work right? > > Thank you If multiple programs are running, each needs its own execution context including its own versions of all libc (and any other) global data. Probably you should look into the ARM FDPIC ABI, which is the right way to do this while still sharing program text for MMU-less microcontrollers like the one you're working with. The tooling should be mature now so that support could be added to musl, but making it happen needs people who are interested in providing feedback and testing. Rich