From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sender4-pp-o94.zoho.com (sender4-pp-o94.zoho.com [136.143.188.94]) by sourceware.org (Postfix) with ESMTPS id B3F693858C3A for ; Mon, 12 Feb 2024 18:34:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B3F693858C3A Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=zohomail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zohomail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B3F693858C3A Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=136.143.188.94 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1707762859; cv=pass; b=azy0L7s1FqwY1SDMEkg+K5JRCSaCAZPertzlPpPxe3tHlIQ0fk3/gpgzLzFE3ZHzfpe1lFBJGSyB/EPG3tIRJJdtBezN3dPpIv/VZ02z1w0GwdoAUs0KJxcVhr8O9X/nlJJpoPyhHEiI3s6jxG4r5wxvL+ZUPVAFXSQS6hgJ1x4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1707762859; c=relaxed/simple; bh=aywvYh+mdCGSijtaU+otLHPQ3xNmxdX+ESz/TheG4kM=; h=DKIM-Signature:Date:From:To:Message-ID:Subject:MIME-Version; b=mJLC53JVJ5q1Ed1ZMhhVIhOGtRn5TnQuZUyqADEzyfnsdrmaNIr6k3cp+Rm3xT3K+vsINSWNd8zic7xtV3a8GLel06zgfkuYAta29MWqrw3VYEiLhV6XCwSwM/NRgrXt+tOTHL30aAmPkYETxa5VKNkfT4bb4PqQ5q29ujfUG+s= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1707762855; cv=none; d=zohomail.com; s=zohoarc; b=QY+2Tc05dp3n0wtT/Pr8JQNeaMZ9AU8GiN/r1LhtsIdz5Arm/4d+EfjJ3wz5afq70mLPUzdnIa56iw8zuWbKX9+qNVdF0Me/Diu93296VSvLXpThskMa0Rgu6+6jk5pQlmgWB2X+ChmHxrs2WPqkym+yh76/+NvVtv1WHzywpEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707762855; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Dbf8GaMT6F2Kr75nFlF2cycsz7l116c/2bE6bCp5pFc=; b=FexCNP+6abDiidbcqnM1/kLSpCiPpmZd40fPB6noJtgCX3F1yAPkBZzFMFtyII4VnzqpRofdfzptzu+l4w4x26PZj9N5oYwkJgK5wJcWQdADRIDRuETHYjJXdSLrsRTeP3Ipe06fjPRUfW1KHJBiODfinSzebTH8or5aCmD3Quk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zohomail.com; spf=pass smtp.mailfrom=safinaskar@zohomail.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1707762855; s=zm2022; d=zohomail.com; i=safinaskar@zohomail.com; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Feedback-ID:Message-Id:Reply-To; bh=Dbf8GaMT6F2Kr75nFlF2cycsz7l116c/2bE6bCp5pFc=; b=fVi9nQOD12n6e0dgQTQYiq3sbURTvU+Vy1WNRVcWPq08aN0B/EDz86d8iJ2CueBQ 7IR+3wvZ1+/U0NRim6MWRWs0BPZNbdke+Gm91/ZPQqeR3+dgT2GAG/07aP1FPpkkk21 z8qw3nZc7JauTEsQZH5vJru/khyXMWJa1v5MW/dc= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1707762853736313.8714147501199; Mon, 12 Feb 2024 10:34:13 -0800 (PST) Received: from [212.73.77.98] by mail.zoho.com with HTTP;Mon, 12 Feb 2024 10:34:13 -0800 (PST) Date: Mon, 12 Feb 2024 22:34:13 +0400 From: Askar Safin To: "Zack Weinberg" Cc: "GNU libc development" Message-ID: <18d9e992755.acbdc13046260.2085489331463195884@zohomail.com> In-Reply-To: References: <20240208152224.11031-2-safinaskar@zohomail.com> <87wmr9ahfv.fsf@oldenburg3.str.redhat.com> <20240212144439.GO22081@brightrain.aerifal.cx> <18d9e1b74fd.108074ea744834.1983132793117906544@zohomail.com> Subject: Re: [PATCH v2] Add public function syscall_no_errno MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Feedback-ID: rr08011227ea751ad2860244d92bacd74a00007b1680c70b80ad0be3057e7dad67c1dea3c524542cdbaac788:zu08011227bbc6325e8bba0a8fa29411f700006dcd301e362182be05839a3e1e9862fe43d5bc04c9f415d038:rf0801122c477877c68ac7b232f9675f170000123e38f5a1323a090a5844f57a2b944075c5b3d4a83ebd16e1eb053e399c:ZohoMail X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: ---- On Mon, 12 Feb 2024 21:25:27 +0400 Zack Weinberg wrote --- > I have a question for you: Do glibc's existing getuid() and getgid() > functions correctly handle IDs in the [-4095, -1] range (perhaps better > described as the [4294963201, 4294967295] range) ? Yes. > here's the assembly dump of > getuid() on x86-64: Even "incorrect" getuid implementation will work correctly on x86_64, because uids are 32 bit on Linux. Whole this problem matters for 32-bit architectures, not 64-bit ones. > But I am not having any luck figuring out what bit of glibc's *source* > code tells the syscall stub generator not to emit the code to check for > error returns for these syscalls, so it's plausible to me that there is > a bug in here somewhere, possibly only on lesser-used architectures. If > you know of a case where we get this wrong, please tell us about it so > we can fix it. getuid is defined in ./sysdeps/unix/sysv/linux/i386/syscalls.list (and similar files). In 4th column we see "E". This means that getuid never fails and we should pass raw syscall result to userspace. "E" gets processed here: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/make-syscalls.sh;h=4f6c3490a20bc3eb34f11f1e7aab0ddec7e82e5d;hb=155bb9d036646138348fee0ac045de601811e0c5#l169 Then here: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/make-syscalls.sh;h=4f6c3490a20bc3eb34f11f1e7aab0ddec7e82e5d;hb=155bb9d036646138348fee0ac045de601811e0c5#l273 -- Askar Safin https://types.pl/@safinaskar