Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp390928rdb; Sat, 19 Aug 2023 06:04:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKvn71esybFZGgahr1bskzuRfKQIv0bbm0fS/8FsOEt7Ee5raeoaCi7gnDS+zesVkIyk5K X-Received: by 2002:a05:6a00:2993:b0:686:b990:560f with SMTP id cj19-20020a056a00299300b00686b990560fmr2349385pfb.2.1692450293364; Sat, 19 Aug 2023 06:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692450293; cv=none; d=google.com; s=arc-20160816; b=Anpx/7TaPqyO3NzI35N7g0+N+YiXEBvpX/P0jbAEZ1smlGyCo2biszDqV8OHpbafFv Iy1OUU1XWxk97Jh5P7Ue5Rh/NU4p87++zozSMhpEseRRGlspalE4Lipn7NsLNYKapmDL XS5OATm6LfH2fVJ48qMAuitUZkEU2dfid/UzcTYYhBLez2R+lFKhdaRjIPuF1bBomYqC BDHkIjy2skA0P5BBWYKjrkzUyR033lslHsE3N4XWYFdawSlt6jayE6zKmSSC7MQHddQf lw7+yd8JbwNhz/SqX4xn/RRul//vgB3Si8kxa7pqI/l9NoKt/ysKgvc3geMmZ5jWWo+M 0XSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:date:message-id :from:subject:content-transfer-encoding:mime-version:dkim-signature; bh=HrQMbQvLelfDe7BU+GdgHBdkRBReZxaf5lx2Bmg105M=; fh=2Xin7ty0CxDQAtiEIx743EfxKrBhf7tTNmmG4dRme2k=; b=amwPX1dQ2YJOfmJw4TAcyWfsY9cxrfM3WLt33MuxmUTI/u4EtzHColEpZDAaksZGGc cYMD9x20Nj16qSa12PLFsQzo3HlkGziUWEMIB8jWg9h4BDvYdas6z2LfeSpHw22z6bG5 FJUqj254jnRieYP7wuCPa9pWcYR/sGIaED4uZo2eFmFYfXqjNRq3bxyVr/5aSlhQkNx2 zoMtmobAHSy5otGHkn5bBwMb6nOFdAyGB+L8sXRiQIz0nY04JOG+5hBjCA9jOKSWvLqi eqoxHOVxb86XLR0XAV1dBzgxr5fgpK6Ro6IhKdNe2WIhZCXpqV/W53yhItA70E1zpyzq Nhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hmBcS6Le; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o132-20020a62cd8a000000b006870f6fd899si3343332pfg.166.2023.08.19.06.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 06:04:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hmBcS6Le; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A9A796DE7; Sat, 19 Aug 2023 01:39:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353131AbjHQPUq (ORCPT + 99 others); Thu, 17 Aug 2023 11:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353159AbjHQPU2 (ORCPT ); Thu, 17 Aug 2023 11:20:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF4530E1 for ; Thu, 17 Aug 2023 08:20:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7231B65828 for ; Thu, 17 Aug 2023 15:20:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id C9EF1C433CA; Thu, 17 Aug 2023 15:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692285624; bh=6uxie/2bpp4zoawaR0g8UbTUtiVTJv3xr2GiZ7zQz/s=; h=Subject:From:Date:References:In-Reply-To:To:Cc:From; b=hmBcS6LeNjacJIsVqaLleKWisEByI1pdUH2z6/NqSbXfZGqafxjco3E/Sb+alRqWw op1a2pVfOzlAuJASuw45rb37vJdUXkeB2uHzMypV0MS5TX/+/ec1BZa0A+2fv3aOFY rPkzXu9x8HTcY8KetdZnZuJ6S0DaPZjudGkNSYxVHPfWmXsmvm0WUJV0tZfD2j788S ekwryIV/8fPQA9MLFA4Vcf536gzoTnB95LVQS2KNvvvnKuOgw6R98TWGhxoHDO9Awl 0B1f1T8OFHuVWRJ4l5GZx/VnkabVSRvFSoOiaUSl7lDO9ExGAb5j/U2ULqOFO17AnE pH+CjVtOvk8DQ== Received: from aws-us-west-2-korg-oddjob-1.ci.codeaurora.org (localhost.localdomain [127.0.0.1]) by aws-us-west-2-korg-oddjob-1.ci.codeaurora.org (Postfix) with ESMTP id B1A7AC59A4C; Thu, 17 Aug 2023 15:20:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PATCH v5] riscv: entry: set a0 = -ENOSYS only when syscall != -1 From: patchwork-bot+linux-riscv@kernel.org Message-Id: <169228562472.20811.8481326212732586626.git-patchwork-notify@kernel.org> Date: Thu, 17 Aug 2023 15:20:24 +0000 References: <20230801141607.435192-1-CoelacanthusHex@gmail.com> In-Reply-To: <20230801141607.435192-1-CoelacanthusHex@gmail.com> To: Celeste Liu Cc: linux-riscv@lists.infradead.org, palmer@rivosinc.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, guoren@kernel.org, bjorn@rivosinc.com, conor.dooley@microchip.com, linux-kernel@vger.kernel.org, schwab@suse.de, David.Laight@ACULAB.COM, CoelacanthusHex@gmail.com, felixonmars@archlinux.org, c141028@gmail.com, shiqi@isrc.iscas.ac.cn, emil.renner.berthing@canonical.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello: This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt : On Tue, 1 Aug 2023 22:15:16 +0800 you wrote: > When we test seccomp with 6.4 kernel, we found errno has wrong value. > If we deny NETLINK_AUDIT with EAFNOSUPPORT, after f0bddf50586d, we will > get ENOSYS instead. We got same result with commit 9c2598d43510 ("riscv: > entry: Save a0 prior syscall_enter_from_user_mode()"). > > After analysing code, we think that regs->a0 = -ENOSYS should only be > executed when syscall != -1. In __seccomp_filter, when seccomp rejected > this syscall with specified errno, they will set a0 to return number as > syscall ABI, and then return -1. This return number is finally pass as > return number of syscall_enter_from_user_mode, and then is compared with > NR_syscalls after converted to ulong (so it will be ULONG_MAX). The > condition syscall < NR_syscalls will always be false, so regs->a0 = -ENOSYS > is always executed. It covered a0 set by seccomp, so we always get > ENOSYS when match seccomp RET_ERRNO rule. > > [...] Here is the summary with links: - [v5] riscv: entry: set a0 = -ENOSYS only when syscall != -1 https://git.kernel.org/riscv/c/52449c17bdd1 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html