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=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16433 invoked from network); 4 May 2023 16:33:43 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 4 May 2023 16:33:43 -0000 Received: (qmail 26023 invoked by uid 550); 4 May 2023 16:33:39 -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 25987 invoked from network); 4 May 2023 16:33:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1683218007; i=nullplan@gmx.net; bh=cD3mW+6H/mNdTqaVJ6P3ICMgG7Gf//OTuY0viquIg04=; h=X-UI-Sender-Class:Date:From:To:Subject; b=dH189+/KCj8uqEHW50R+G6bAkqiorSPDLtmCQ4Gc3UQOafFJ2MInB1YzKaE5vbszj KLxUEwiWhMDTb+ePJeu766RVjmirmh64VEzhMbpIYmzynEL75rnBRQUKNmXrpapWFV cS0WOm86JEw4YsrBiKj4HERqYGso8BrpOiSIMYkCy8MbTc9lI6DJggE0jCOSjNKYiO tyqz0eKB+2qBqwjJtFQpqnVx6b3Bu80rmCGqHR597btBejnqneS2q7+U41WvfdrOKM LXGT/Afhb6V9Gogq3gWE9nAunh+MZJAw4AkAWAQ6n2deQnbdy8T/dCZXsw5pdfdOhR L3/S6oMUYHarw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Date: Thu, 4 May 2023 18:33:27 +0200 From: Markus Wichmann To: musl@lists.openwall.com Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Provags-ID: V03:K1:BZNSFdnnP84gwZ1VjCs7Uffc/RLkhK3erVco/OVu+0iIxW0UbKv H+Fl21M09u5mmMdv2d7+ZpDtow0IAuvkJMPy0MDtv0uBBq1cz4CVYx4Z3ttoz4t54vkyBS2 0BsLqqGctM7SHi3i95OqqYfsC1g7yw8DuKB3YFVhcODpCNIH45dIrt3YklK1CF2ZQR5W4Go E9wW/RNUuvnnF/75hBJgQ== UI-OutboundReport: notjunk:1;M01:P0:snRoCE5l2o0=;3ljtib6CedyT12kms9+rpbxj6iF hnZZJJuiLVraILk7CCoa2DQkfNDl1ZRWi61qewNIfkPGucMEq3oLurUj1yKWBFMDaaDHadhHv atb1O5U/Z67whcggCd0oykLqU6ozqdvD9JAkMs7y+7lS4Wt11fEkpmZm/FNGZX83aI5prY1JL 0l3EuJ72/M6hujSp9JBn53otnneTW27se7OAJda+evhbYVDt9MJ7OfgP2OMN2spZLDacjjZzF Jw9Ht+mK9phl4yhT5gybJU1pNYtWbYnMP/KpHit3YuKlHaN/p7nVrwjeCegJRRYuBPJcKBWXO /NPgoRi0jG3JdLpgpt43IUWsqTcbDhVbVDhbzsMnxJzRHfUtKFygSh+gh0tjRuFxDrPcKVpfa gli00o16L6mpbHs3bmygyCpYRcPqWd6cOkH7t/b0DQGrQLz5kSMDiQbKgXDTYsm4+jsepokoV HBQ3Gnu5f4v8GbTPortzNe5WD9EWItpvighF19+iI8k/9RgX6gpFbNBzVezwlRmCb2Oet8Wk9 iV7ZJ7JoJ6pVdH0xNRQUmBb51El2DMyRJ8igICVC9T2od0Pd0tbRIn+gojRYIqPyh5jLxJ/zY X6p+euRu/Mg7Iajo5tRuJeM50M/5EMN5cNT5pbfaENqAwX1U2VLg25+w3G75LuG/jfFVuMgCk auNuf4G1kLuKu4jePgkH2g1dPwVLAo+hBJh70RWXs69rahGXByK39NUy7gQ3le/nsu3PpqR5f z9IUAdzREptopJmJY081Mk2RWnqEpbI/xRfDSySRQ3zEEQPo0JA5kgq6WAmYp/2k4U3EAeCdA FcOtD29QCZbMybcLUvuCuomejD4uLfi2mbN1sjECbtADMtQqrQNm6nIwyLQPRS02CszWeORwb hk8Lpq/mFliF795m3iWZ55fMBiecnp0d2cmZJbZJsnm9tl3eqPGrgPc7sW08fomDMIIcJOaYR 7mGzP5Z93jWhD3mWX2AorOCo/hI= Subject: [musl] Namespace violation in system()? Hi all, I stumbled upon the source code of system() today. It is this at the moment: |int system(const char *cmd) |{ | pid_t pid; | sigset_t old, reset; | struct sigaction sa = { .sa_handler = SIG_IGN }, oldint, oldquit; | int status = -1, ret; | posix_spawnattr_t attr; | | pthread_testcancel(); | | if (!cmd) return 1; | | sigaction(SIGINT, &sa, &oldint); | sigaction(SIGQUIT, &sa, &oldquit); | sigaddset(&sa.sa_mask, SIGCHLD); | sigprocmask(SIG_BLOCK, &sa.sa_mask, &old); | | sigemptyset(&reset); | if (oldint.sa_handler != SIG_IGN) sigaddset(&reset, SIGINT); | if (oldquit.sa_handler != SIG_IGN) sigaddset(&reset, SIGQUIT); | posix_spawnattr_init(&attr); | posix_spawnattr_setsigmask(&attr, &old); | posix_spawnattr_setsigdefault(&attr, &reset); | posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGDEF|POSIX_SPAWN_SETSIGMASK); | ret = posix_spawn(&pid, "/bin/sh", 0, &attr, | (char *[]){"sh", "-c", (char *)cmd, 0}, __environ); | posix_spawnattr_destroy(&attr); | | if (!ret) while (waitpid(pid, &status, 0)<0 && errno == EINTR); | sigaction(SIGINT, &oldint, NULL); | sigaction(SIGQUIT, &oldquit, NULL); | sigprocmask(SIG_SETMASK, &old, NULL); | | if (ret) errno = ret; | return status; |} Aren't all of those calls namespace violations? system() is an ISO-C function, so the only symbols it is allowed to pull into the link are other ISO-C functions or hidden double-underscore symbols, right? But all the functions called here POSIX functions. And while POSIX contains the rule that posix_* functions are reserved, that is in POSIX, not ISO-C. And even with that rule, there are all the other calls. Does someone need to pour out a bucket of underscores over this function? Ciao, Markus