Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3192660lqo; Wed, 15 May 2024 02:30:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXNPlbvbGHvWDmkXdV5E/eVfO1eMSQlzgar5qcpfj1pFW1zJmI3/yWZTTWIQdNSoya3DQ1aH5ra1KsqiAg2BYiQFEobeHdgptBCLeDifg== X-Google-Smtp-Source: AGHT+IH2LW03ipcSVzScI3Iy+4G1WYJZ557dcvwzmfBVjFawSdYFASoyjAROdnjGIq/apLdFI+mB X-Received: by 2002:a17:906:a389:b0:a59:bdb7:73f4 with SMTP id a640c23a62f3a-a5a2d672e3bmr1119338166b.61.1715765448359; Wed, 15 May 2024 02:30:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715765448; cv=pass; d=google.com; s=arc-20160816; b=tMW88FkuyMKtR699T+OBfo/aMKqkR6kgtZU6UrZ4cFzP0VLN1sAmXoTKn81JcnCBtM FbifPfXs/FH6K0jkqpU1R5m/gjnl7uTSJGCbfx5eh3UG8IcC57aYfnaIK+lP7cek5n+O 1n6zBlxtx4mxxqLWCP4UvdCvBFs1sXuioYo7LYUlDdObaLjkzjtHn1a/D0KcEK8LymrF xgobEvKFUJTWugQuJJt/nk9feBkyBRTtcS5j/R+CQi7/p0/YDktDf2sTvSRvq1/Zpfly ZkNk1WpEkyd83L9k4M5rvxeYgxEMRG+vqf4arKhh1OJgNSzD9kNp8ItL6aWsSQ3eksFO esXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=xxzhPv1tHX2wvAdYlfv3gvCR6D8I7glxEuWKpX3u0qE=; fh=H1Y9VLqwIH/3eyqemCC/Gjte2t9y+nsr6zVAK8RLJr4=; b=ASQOLGxKixnmbv3KZOUKlXJc0CwWoL9bntZG/XcAUNWRfEEofMMEkTtuCfPjQKMB9n 9WiHyIfHD69/Dxl2XyRUNU4goAFmbCSmkL34f4KBs0jRzdAO2znY0DvaJ+CCWjK5OooF g4/YBT7YFoTLKL2DvXEH/6YhC+dsgybVut1tJOb6isz1lIPTTstp4sNsSA+ch+qe9m2z ZNrNwVjha2up9P8t3yOJsRserjbpd75n7As+dgaWDQo3hEpYCXuYgxqb2ef9OFxRJQQa chxEVnxoNJhgI9IJ9kfhsP9vS+vLKcu4g2oqbAz0hqiXb8lNHcyhn0v6nNt+zm4Qg6pz VdDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-179703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179703-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17bb1a78si743081066b.697.2024.05.15.02.30.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 02:30:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-179703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179703-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 19E141F23BBA for ; Wed, 15 May 2024 09:30:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2F9F5A117; Wed, 15 May 2024 09:30:32 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FCE85914D; Wed, 15 May 2024 09:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715765432; cv=none; b=fLBwk56va6Nxon+SsyaZQleqO6Lxs26MjFO1cCa53Z1K89kGi3T2A+XGBHPuf7844EU+T61uPBkFBPIf47S2i1K5/8i9JEpUJFHlPSCiGgIbIsWuyLAeX3dIktISGLx/SjESK3CIeUzj69KG9CNk3D7ua7woyh0INdH0q4fPtMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715765432; c=relaxed/simple; bh=U4sqkEy7jQH3kzXAo6QyI7bYMwu7KBPvs6VnC9+VuxY=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=TmGAuMyJYR+IEWXh6HIH4KEPfBO0LnV63o7ucFc1UPjACveKZdoDjiA3OR8xq0qyM5HearSO6uNQFPTZsWkja2Mj5o6GLC5x/01lJwCvjFR5gzYUupbYm7Btnorv4CbRdsIlEMiR7cYRM4ZNztcMDiL5unS35LSUmNJubOc+CsM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.20.42.173]) by gateway (Coremail) with SMTP id _____8AxJ+mxgERmjgMNAA--.18817S3; Wed, 15 May 2024 17:30:25 +0800 (CST) Received: from [10.20.42.173] (unknown [10.20.42.173]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cx3VStgERmmqYgAA--.20S3; Wed, 15 May 2024 17:30:23 +0800 (CST) Subject: Re: [PATCH] LoongArch: Define __ARCH_WANT_NEW_STAT in unistd.h To: Arnd Bergmann , Huacai Chen , Huacai Chen Cc: loongarch@lists.linux.dev, Linux-Arch , Xuefeng Li , guoren , WANG Xuerui , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org References: <20240511100157.2334539-1-chenhuacai@loongson.cn> From: maobibo Message-ID: <3937d6b1-119b-195e-8b9b-314a0bfbeaeb@loongson.cn> Date: Wed, 15 May 2024 17:30:21 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8Cx3VStgERmmqYgAA--.20S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7tFWUuF4UXFyftr4fJrW5urX_yoW8ZrW7pF WSya43uF4kGry7Aw17uw1jqrs5AF18GF43XF1SgryxCay3Jr4Iyr10qrWIgasFkFyxZF4j vF4jkFn8Za98Z3gCm3ZEXasCq-sJn29KB7ZKAUJUUUUx529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUPab4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU AVWUtwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI4 8JMxk0xIA0c2IEe2xFo4CEbIxvr21lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vI r41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67 AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIY rxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14 v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUcbAwUU UUU On 2024/5/11 下午8:17, Arnd Bergmann wrote: > On Sat, May 11, 2024, at 12:01, Huacai Chen wrote: >> Chromium sandbox apparently wants to deny statx [1] so it could properly >> inspect arguments after the sandboxed process later falls back to fstat. >> Because there's currently not a "fd-only" version of statx, so that the >> sandbox has no way to ensure the path argument is empty without being >> able to peek into the sandboxed process's memory. For architectures able >> to do newfstatat though, glibc falls back to newfstatat after getting >> -ENOSYS for statx, then the respective SIGSYS handler [2] takes care of >> inspecting the path argument, transforming allowed newfstatat's into >> fstat instead which is allowed and has the same type of return value. >> >> But, as LoongArch is the first architecture to not have fstat nor >> newfstatat, the LoongArch glibc does not attempt falling back at all >> when it gets -ENOSYS for statx -- and you see the problem there! > > My main objection here is that this is inconsistent with 32-bit > architectures: we normally have newfstatat() on 64-bit > architectures but fstatat64() on 32-bit ones. While loongarch64 > is the first 64-bit one that is missing newfstatat(), we have > riscv32 already without fstatat64(). > > Importantly, we can't just add fstatat64() on riscv32 because > there is no time64 version for it other than statx(), and I don't > want the architectures to diverge more than necessary. yes, I agree. Normally there is newfstatat() on 64-bit architectures but fstatat64() on 32-bit ones. I do not understand why fstatat64() can be added for riscv32 still. 32bit timestamp seems works well for the present, it is valid until (0x1UL << 32) / 365 / 24 / 3600 + 1970 == 2106 year. Year 2106 should be enough for 32bit system. Regards Bibo Mao > I would not mind adding a variant of statx() that works for > both riscv32 and loongarch64 though, if it gets added to all > architectures. > > Arnd >