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.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 4757 invoked from network); 25 Jan 2021 08:32:07 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 25 Jan 2021 08:32:07 -0000 Received: (qmail 11661 invoked by uid 550); 25 Jan 2021 08:32:05 -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 11631 invoked from network); 25 Jan 2021 08:32:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1611563513; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:From:Subject:Sender; bh=a4yK4mLNFrUloxLXQdUWpdGlJQh7dZDMJtllDK+6xw0=; b=A8S4dUyJF8UU2xqJR/TT60X2B0BTYYjRkUZbZV6FM2LVpH6kW3TzaWBC5tLpSlTpzP WQ+yVhnupH3VRRxabDoUOxMeI4AMykoIZvQDs+wUx3XjNuIAmcEs+l4rVQKasHAnlFRy IR803s2btqhowgCbU+OYxmqzFGVtjOB0seDO2F3u8No7nw05At1HXROKVlLxRx8G9E7t zANAOlWB2MdBtfXq0544b8ATuGi0cHlm/Rm/HSkl65TcRu1RwPamsuzR53VHb5Tab/Xl dfYqKz2rw15WlCJxJ543BgKQLE7OO7ldHh4JDvwWZwJ3d2X3BBpv9H+FEKl/wVMazOYe 2BhA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOHqfyyvs=" X-RZG-CLASS-ID: mo00 From: Bruno Haible To: musl@lists.openwall.com Date: Mon, 25 Jan 2021 09:31:50 +0100 Message-ID: <3521697.b4TYcCAa2N@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: [musl] insufficient checking in posix_spawn_file_actions_add{open,dup2} Hi, POSIX [1][2] says about the functions posix_spawn_file_actions_addopen posix_spawn_file_actions_adddup2 The function "shall fail if: [EBADF] The value specified by fildes is negative or greater than or equal to {OPEN_MAX}." However, in musl libc 1.2.2, these two test programs exit with status 2: ======================================================================== #include #include int main () { posix_spawn_file_actions_t actions; if (posix_spawn_file_actions_init (&actions) != 0) return 1; if (posix_spawn_file_actions_addopen (&actions, 10000000, "foo", 0, O_RDONLY) == 0) return 2; return 0; } ======================================================================== #include int main () { posix_spawn_file_actions_t actions; if (posix_spawn_file_actions_init (&actions) != 0) return 1; if (posix_spawn_file_actions_adddup2 (&actions, 10000000, 2) == 0) return 2; return 0; } ======================================================================== sysconf (_SC_OPEN_MAX) is 1024, on that system. Best regards, Bruno [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addopen.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_adddup2.html