Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5842723rwl; Tue, 11 Apr 2023 10:41:50 -0700 (PDT) X-Google-Smtp-Source: AKy350ZaC/txdK9tAqgCclNTUQ9e0BV+oOv6Tbd5dcA2D0bYaHoYqxQGSm7e6dbKq64Ng7BCcpfg X-Received: by 2002:a50:e713:0:b0:502:24a4:b0ad with SMTP id a19-20020a50e713000000b0050224a4b0admr15104035edn.4.1681234909922; Tue, 11 Apr 2023 10:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681234909; cv=none; d=google.com; s=arc-20160816; b=cgcAi+bZ76rWUBBpgPC0BVSa1QWYXmuqFN7hcW8887IVkfKhdNqmKJW/iwwVSyxvXu jmwmf+BZfJPtTn4r8n9RzytVWgjpfvbY0yAq/LKhOVMxYW3HKL5Vz0q83S2UzWDLRGLb Au/DFFqXpa2FrwUAjBSJDKdZEeYZ0/5wvf/uXlFbFI37CItehGScvWzVKEfWxdI6q036 IYugRG0yIxnt1wUNclkEZ75mk4AeM/xPPFNVNocvzk/MtpcTOi3gPBBsP4pc8l76tYcs KxjvvvLEdPhTgvWlMdH0rd3rvPkkTfaSqZahIU2LczDmit7isLlTatpMQkIMRGiYxSMp Sn6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:date:message-id:subject:references:in-reply-to :dkim-signature; bh=Q7pct+dMjqiVr0F6C0Ngb551md/gaAhmGoQbOMdY6l0=; b=gQXzi8FDWvBD2Gm7PezTA3Vho/yOoE9c7o6x9AYRD988x/L3uMDfLR727l2u3zAahF Eun/h+rliF7h+xojeQEgqEB6nPjavgOyaJ6ZA7VJYz8oDyPGXyb0brei5M2hisx4tEQR krH1MiO56Zk6khW8ppQUdfz1S25RN3NFxMsqxv9QDPcCe4Jv64I0fvXQaaR2kEnWuH8R 5wjL0SHoJeiBRQDWhvlJbCutxrj8ka/kntlL8xWzl894/DzJpxL9mO+xgAMsMvJ5JdoD 26DZ5b/dzs8XjwxWWgZpzOh0mez8xE30a11S4VNks5fvVPCcgg8dRX4ejxgR37BVePBP MAiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=VCnOKB7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020a056402050500b004bba31f3e01si1221460edv.65.2023.04.11.10.41.18; Tue, 11 Apr 2023 10:41:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=VCnOKB7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbjDKRkD (ORCPT + 99 others); Tue, 11 Apr 2023 13:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjDKRj6 (ORCPT ); Tue, 11 Apr 2023 13:39:58 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CF9C72A8 for ; Tue, 11 Apr 2023 10:39:31 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-51843c78ee6so7924a12.1 for ; Tue, 11 Apr 2023 10:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1681234771; h=to:from:cc:content-transfer-encoding:mime-version:date:message-id :subject:references:in-reply-to:from:to:cc:subject:date:message-id :reply-to; bh=Q7pct+dMjqiVr0F6C0Ngb551md/gaAhmGoQbOMdY6l0=; b=VCnOKB7O+R3rx2QJgQk+H76PSX9UqiXTO19L4ieeibPM7fkJd6muBXdHWN8GaQcGfr 0BjwL4NsGsQFHkT/CJZgfltdch5C47yw4K876P471CXwfRSj/00O6H61ZVxrmdpkRc5r 4pYW/qNJUquMFVnrS2ZlraLQmSJ3h2XM7diaWmQy6wV3TYPPTQnDQ8hKqdc5lPrkYOm3 TQKI0IxR6WeQM1lqxBUzRKMGYDd/PR7jaxvcFicisM7epKdXgmvyxN3gVHTnYji9enI7 1uawsGcdwebp9Q0YDAbIIXtHR7u4AEJGvSnzqISlmOOfZ0BtaihjOzWyOuXtJXOE28is u9BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681234771; h=to:from:cc:content-transfer-encoding:mime-version:date:message-id :subject:references:in-reply-to:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q7pct+dMjqiVr0F6C0Ngb551md/gaAhmGoQbOMdY6l0=; b=h1Lc/5O67jdVHA7tfNqpWq9ldwCiDrnfvB5K4GWkE8sLIkEAHUEvyEVaoKQExQBeXQ nXCOMNO8udSWtT7E4TY3+DNJ/WeJ0/uduARYljr0o3lvue92va6naALLh6LNBxn2K/cz h5nNI4ZotY6QUKOdZOo5oVYJbLGFWj1Xb1tOvYBZ3gJUFXazcr+M4edwwe5XJPBbSQV/ e9hDD8i2F2LXE8jP21dGY7y7NZeVOSLOSLCATggpyFl9UhJQEq2v/KnyVFsqNbgr5KFe l7PtaZXK+qH/pJL46LL2A8PG79atm1SsspFLSDUmiugzQlhF7L9iD0N1Q9eUxBShueTv vx5Q== X-Gm-Message-State: AAQBX9eJEWEAjU93qL+uA8DvcqT0E2sO3giD6yBvvcIeAIygvAkkmx6C DJKCivtOyv8EVrdzJidMd7aXfg== X-Received: by 2002:a62:8492:0:b0:627:ea7a:ff46 with SMTP id k140-20020a628492000000b00627ea7aff46mr15278563pfd.16.1681234770885; Tue, 11 Apr 2023 10:39:30 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id n4-20020aa78a44000000b006338e0a9728sm6432340pfa.109.2023.04.11.10.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 10:39:30 -0700 (PDT) In-Reply-To: <20230403065207.1070974-1-bjorn@kernel.org> References: <20230403065207.1070974-1-bjorn@kernel.org> Subject: Re: [PATCH] riscv: entry: Save a0 prior syscall_enter_from_user_mode() Message-Id: <168123475135.4147.9051999374596978440.b4-ty@rivosinc.com> Date: Tue, 11 Apr 2023 10:39:11 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailer: b4 0.13-dev-901c5 Cc: =C3=B6rn_T=C3=B6pel?= , iko_St=C3=BCbner?= , Conor Dooley , Yipeng Zou , linux-kernel@vger.kernel.org, Heiko Stuebner From: Palmer Dabbelt To: Albert Ou , Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Guo Ren , =C3=B6rn_T=C3=B6pel?= X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On Mon, 03 Apr 2023 08:52:07 +0200, Björn Töpel wrote: > The RISC-V calling convention passes the first argument, and the > return value in the a0 register. For this reason, the a0 register > needs some extra care; When handling syscalls, the a0 register is > saved into regs->orig_a0, so a0 can be properly restored for, > e.g. interrupted syscalls. > > This functionality was broken with the introduction of the generic > entry patches. Here, a0 was saved into orig_a0 after calling > syscall_enter_from_user_mode(), which can change regs->a0 for some > paths, incorrectly restoring a0. > > [...] Applied, thanks! [1/1] riscv: entry: Save a0 prior syscall_enter_from_user_mode() https://git.kernel.org/palmer/c/9c2598d43510 Best regards, -- Palmer Dabbelt