Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28556603rwd; Tue, 4 Jul 2023 22:24:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEffQHaSk1XAqF9+FJGr8Fo2ZrkdGBQ314xayuP7Vi7f6UN0koWOO4khlz6hopzQmQp7FBv X-Received: by 2002:a05:6a00:1506:b0:676:ad06:29d9 with SMTP id q6-20020a056a00150600b00676ad0629d9mr16761136pfu.17.1688534693487; Tue, 04 Jul 2023 22:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688534693; cv=none; d=google.com; s=arc-20160816; b=FyiB6b/6aQmGJ/yvUa1KL0Xs8eIMtTc1dzpNMduDgOlJHYW11CT4CI7fFqrCYzhN12 ktsRncxGOfASeOme2bnSxlecKHobMDwGMc9gsaFhP+vZSOXcJ3lrYAYmQhG0MtqLnUfF +qvRBzPzLENtXTauPovwM0+vIjZc5VSvEBQA5Km70cvcgSrMlwdNq7C6EuPFac4FEmpb TbcNZKpnWoYgqqCfXhy1kuxPSENVdGFzwAAX2qrOsuaz5HizCposo3kbWwI7ty0tStsq oS8JtBgezmfDxl0e9yo679lRqnQ193ZMpuEirawzo2KYdmS+oGk8Q0Jk/dikdl2nT4xs wvTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=A7koUXTGnXZ2BN6z2esFRUBwMxdqNEeh2TLixxqJrG4=; fh=tkicO8ftu+mDcxd4lPzVr7Qa9wZHsnhTfDFUiPCMli8=; b=MSHKI0riNRMf147IAAB8WC/oyG4oAKKn1vkQHpTpNphGcgS59QVhLxmK2QEBWbZraF lEPYwasXVYqys3xjcGGiTzSyC7vLRe88eunnVkav6UT6lvjTXoJ97Qeq4zsr356i/5Bk 709ikhK0orvLqEC53fzPO7alex2Ayx2xl5ta3BJTFMk1zJBWaO/crv1uwURvo3PIxAN0 O5xQBEglfNaqL3h+YjVePvOHz0PYn4fp/9owaE0sU4AOWcXR4Fm6h4K0AMOx0UxBdhXx ejmBbeiitfg2zmsBiwfvvl5C1oZAIW5yn9zjSWRiFlfYhNE4LzEVMsoDohsvZxnWC36K DcPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=OSqKEasX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q188-20020a632ac5000000b0053f6910ccc8si22019762pgq.747.2023.07.04.22.24.39; Tue, 04 Jul 2023 22:24:53 -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=@sifive.com header.s=google header.b=OSqKEasX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230196AbjGEDvI (ORCPT + 99 others); Tue, 4 Jul 2023 23:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjGEDvG (ORCPT ); Tue, 4 Jul 2023 23:51:06 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7065110FE for ; Tue, 4 Jul 2023 20:51:03 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fb94b1423eso9432429e87.1 for ; Tue, 04 Jul 2023 20:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1688529061; x=1691121061; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=A7koUXTGnXZ2BN6z2esFRUBwMxdqNEeh2TLixxqJrG4=; b=OSqKEasXz+D9ihlXJxO0mUy6ubDPxeEKZuYFwWcv1krSfchWaAhS7DeDkLUx0QA1Nf Wcu+k24HmcXRRG4dk9tQLpIwPIu3uEjdR4nJ2/Bj76VhFoiO915GQtOijA6CpWMCQua2 MGgf0fW4Y4QtDrv5sGIQnQBhQOaU8yWqO6kaG6X45nVOR753xmJYRC+Dkn0FO76gECQs qPFITbMHuDEsdbTfMcFUcHa2dRKWgfCIVllgI+0TGN7lZDNHOQVyYsH4+/5XqyeDBimG SUj6MOo6AiAD/D0foDLc5eKOc66iLEEIWux9Jcs5ACm39DbQ1IYsvBpH4CjGGGzcDBOY S0QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688529061; x=1691121061; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A7koUXTGnXZ2BN6z2esFRUBwMxdqNEeh2TLixxqJrG4=; b=V1BmUDugZecX+ojCywbYkWfvSwM+dEA0vOXVpUde6oIA0XmP/v0lP7hjNkA5RRqXi4 i1pMI6jh0y0wGtH1O3x7Hj18NtZLZ7BHhlIcqb79kx61B3Sc4r8ORDC3UzSprtcy1Gfs YwD5LifBfnWexaI+prHeJeGcD6Cg+4aFCueONMxWtoH9Njhjyiwh28DpVtJIa2Z9aTAs +i3ffDMoxWhHnj0/NcJ3JXZmp5dYzEU7H56ZxzB5V4b4OoYl/mzWCDXdwHe1RTpLgsH/ 777EWoNNZBbiQ3D5N+A0ay9TPIGEulaPyLsSm6x45PTLZYbNCTyG3Cxh8KTyrk0F01Q3 iQKQ== X-Gm-Message-State: ABy/qLbmDG0fiKZYQzf1Ul2lLx0NFp7P5y3/wpLBELAal3BD5SAFlNmg 1ojOhP/wUjXJsL26OQ0nDTUNu4hCaj8OdYuEU/vlyQ== X-Received: by 2002:a05:6512:3e10:b0:4fb:7bbf:daae with SMTP id i16-20020a0565123e1000b004fb7bbfdaaemr12214586lfv.64.1688529061686; Tue, 04 Jul 2023 20:51:01 -0700 (PDT) MIME-Version: 1.0 References: <20230629142228.1125715-1-bjorn@kernel.org> In-Reply-To: <20230629142228.1125715-1-bjorn@kernel.org> From: Andy Chiu Date: Wed, 5 Jul 2023 11:50:50 +0800 Message-ID: Subject: Re: [PATCH v4] riscv: Discard vector state on syscalls To: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , linux-kernel@vger.kernel.org, linux@rivosinc.com, Palmer Dabbelt , =?UTF-8?Q?R=C3=A9mi_Denis=2DCourmont?= , Darius Rad , Conor Dooley Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Thu, Jun 29, 2023 at 10:22=E2=80=AFPM Bj=C3=B6rn T=C3=B6pel wrote: > > From: Bj=C3=B6rn T=C3=B6pel > > The RISC-V vector specification states: > Executing a system call causes all caller-saved vector registers > (v0-v31, vl, vtype) and vstart to become unspecified. > > The vector registers are set to all 1s, vill is set (invalid), and the > vector status is set to Dirty. > > That way we can prevent userspace from accidentally relying on the > stated save. > > R=C3=A9mi pointed out [1] that writing to the registers might be > superfluous, and setting vill is sufficient. > > Link: https://lore.kernel.org/linux-riscv/12784326.9UPPK3MAeB@basile.reml= ab.net/ # [1] > Suggested-by: Darius Rad > Suggested-by: Palmer Dabbelt > Suggested-by: R=C3=A9mi Denis-Courmont > Signed-off-by: Bj=C3=B6rn T=C3=B6pel Thanks, Reviewed-by: Andy Chiu