From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 15E97384D147 for ; Thu, 27 Oct 2022 17:19:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15E97384D147 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 5A3D2340EDF; Thu, 27 Oct 2022 17:19:51 +0000 (UTC) Date: Thu, 27 Oct 2022 21:50:27 +0545 From: Mike Frysinger To: Tsukasa OI Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 22/40] sim/m32r: Fixes to Linux emulator Message-ID: Mail-Followup-To: Tsukasa OI , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7QZifdt0XL5oLKBU" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --7QZifdt0XL5oLKBU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 27 Oct 2022 11:40, Tsukasa OI wrote: > On 2022/10/23 23:56, Mike Frysinger wrote: > > On 20 Oct 2022 09:32, Tsukasa OI wrote: > >> 2. syslog function must be called as a syscall rather than POSIX sysl= og > >> because we are emulating Linux system calls on the Linux host. > >=20 > > i don't think that is accurate. if that were true, every other call in= here > > would be using syscall() instead of calling the C library functions. >=20 > Note that this part is a Linux to Linux syscall translator (though I > consider this whole idea unsafe). Yes, it uses many C library functions > but I consider this is because they are (almost/completely) compatible > with underlying syscalls. this is incorrect. let's take a step back. the point of the sim runtime environments is to emulate the specified userland regardless of the host OS. it is not a linux-to-linux translator. the runtime decodes syscalls, then attempts to emulate the requested behavior. ideally that would only ever involve going through the standard C library APIs. the m32r linux runtime environment layer has a bunch of linuxisms in there (because it can be hard to emulate linux behavior on non-linux systems). but that doesn't mean it's a linux-to-linux layer, and we shouldn't be making it worse. > However, this isn't the case for syslog. POSIX syslog (C library > function on ) and Linux syslog (syscall) have very different > semantics and Linux syslog should be used here. you are correct here. the arch backends for diff runtime environments are inconsistent whether they pass through to the real host env, or they provide stub/fake data so the program doesn't get real access to the host (basically constructing a sandbox). i see the value in both modes (especially since a sandbox is easier to run cross-OS), but haven't fleshed out how to support these. > Probably using glibc wrapper klogctl () might be a solution > (see man page syslog.2). I would like to hear your thoughts. klogctl would be OK -mike --7QZifdt0XL5oLKBU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNarEcACgkQQWM7n+g3 9YHqbA//QQB13/KcBPNBPTisjPUwO8QRKGvgYdj13AaEzLxKbbkpPt+jJPwIMTI7 7pXtmCM/EzFGDHySFd3oCbsXlwQWmaId5MK1GbOKaZpWHOsDlK0+xvRKnvLBfv/u 54QO/6fH2Lwm2cyvfUMQF4AnkVnw49oO2Qfc8iHgbLs3auZp1i7x9Lr9pGD2XiHe DrNcGUPn4LKPnwLbjJ/BKneXny4vnvTJ5jj8W65mdbCoiAaeXwUi4mGAfOIqmalJ dBf3l2yUnmVT4qdcQt3kkfM07Ju604cc6t/C51KX+QV00kpCBGfT2UpW5IFJSxsV p22LLxaDAHkP+8DHtRnEtgkYYzOQwBeZSJVmvJm7WzCyEAKUWRU/I52nGWcTfqke aeIawTsjaKTu4+xQWqCeeC2UyuNnP6MWuibY6EmaroEpQCXXj1J1RyvUBQIX+jbK kO4ezBZgiV5Ci1zmKX5Ba/8wbawkjR9G6jHj/omQwHe0kqpUm+oovs88LDzoPwuO Uj83KB/e5WKQbIZcIfOJTPvoNF9QcPkdJo52y/DBilqBfGRLACAbfjRbOiqCCZzi INx/Qerij/FCAM+l2RiwLwFNY+xTWrSRXyON5S29rGDzenKG8yiCZSDYubUXxrXo 5jZzFme++nl9Y6G874QGD3P6Ot3e8tvCJ/29jT9iFfsoLy+NAac= =y7x5 -----END PGP SIGNATURE----- --7QZifdt0XL5oLKBU--