Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1505118rwd; Sat, 20 May 2023 23:23:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5e3CMeu786Bf6cOoIVhLih27psK7wQ0KQvY5rPlgusJmw4itVUoj6fo8fFHti+2vYZArA3 X-Received: by 2002:a17:902:8689:b0:1af:af79:eee0 with SMTP id g9-20020a170902868900b001afaf79eee0mr181261plo.6.1684650222948; Sat, 20 May 2023 23:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684650222; cv=none; d=google.com; s=arc-20160816; b=url3RQwO3Pe/TVJMHPRY4Ml49vJF5gNErsH0zWPKrQSJJ+TWoYviWwaoqznKD70jxK YJM5sfAWpgS6eUPioIxZV5tNbXmEEAQsASDKTQ3mzeDPfUyBHrR8W8Rw3u8sGYjlKa4H rzoDUV7VehsUj3T8IAqPs2UW3BdQFaDrizv3g7IFCo8+NFwytEpFzDDnezjD0Y8xn80v 3WH1dJ84uDY4EiXhsCJicioUAfWYqAjY3MZmd7B6SKgMSH3bv7OVVDrBgx6jSSk9miOM dFQpDF+Pu/7cRs/DJ6FPxhctIj5s/9mK1NU1Lv3In/vvwSVIOcuKs1KMnpctvFxpZfxl d06g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=cWc/OSvODqp6osuBLe1W0jUwf1R9PI+KQAuUjR/WBqo=; b=OhQWGDh6vYgnnEFcURaCT2N9ms47YH6Vt8uqL/67Bf3gckPg6WCNXb7sDy8IDWsBpB VP0rIbjlG/nnEYIaeY4hh6XQWopFy4zdlpc/byOyo8H0t9cZ4F9fjoY3Kogb+TL5Srfl zlJsIw3MCqGP3p2h3ckliqbq36YZpAkn8e3Iia3GxeSOA7Lq9G98OHeRrkSV0FqnZz+4 BPh+b9LqN1ZQZ9COmhofzoaFuhF/8WrxEvWBpApg8TcmCwhzYR/awnwtkHkXDqjnsNog c4jx8+HXMD6VZGlgxj8MyWK75JgXl+T+dYg3lNeqVitu4AMsYQon2cCH3iiwzBEifUgi 6ArA== ARC-Authentication-Results: i=1; mx.google.com; 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 d14-20020a17090a7bce00b0024de98a941esi4605909pjl.189.2023.05.20.23.23.30; Sat, 20 May 2023 23:23:42 -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; 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 S229761AbjEUFiT convert rfc822-to-8bit (ORCPT + 99 others); Sun, 21 May 2023 01:38:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjEUFiS (ORCPT ); Sun, 21 May 2023 01:38:18 -0400 Received: from tulikuusama2.dnainternet.net (tulikuusama2.dnainternet.net [83.102.40.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF0912B for ; Sat, 20 May 2023 22:38:17 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by tulikuusama2.dnainternet.net (Postfix) with ESMTP id 58B8820A1D; Sun, 21 May 2023 08:38:15 +0300 (EEST) X-Virus-Scanned: DNA Internet at dnainternet.net X-Spam-Score: 0.92 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_FAIL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Received: from tulikuusama2.dnainternet.net ([83.102.40.151]) by localhost (tulikuusama2.dnainternet.net [127.0.0.1]) (DNA Internet, port 10041) with ESMTP id R8ZWNftgSxvj; Sun, 21 May 2023 08:38:15 +0300 (EEST) Received: from omenapuu2.dnainternet.net (omenapuu2.dnainternet.net [83.102.40.54]) by tulikuusama2.dnainternet.net (Postfix) with ESMTP id 1ADF5208D5; Sun, 21 May 2023 08:38:15 +0300 (EEST) Received: from basile.localnet (87-92-194-88.rev.dnainternet.fi [87.92.194.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by omenapuu2.dnainternet.net (Postfix) with ESMTPS id C19BC204; Sun, 21 May 2023 08:38:12 +0300 (EEST) From: =?ISO-8859-1?Q?R=E9mi?= Denis-Courmont To: linux-riscv@lists.infradead.org Cc: LKML Subject: Re: [PATCH -next v20 20/26] riscv: Add prctl controls for userspace vector management Date: Sun, 21 May 2023 08:38:12 +0300 Message-ID: <5677700.DvuYhMxLoT@basile.remlab.net> Organization: Remlab In-Reply-To: <20230518161949.11203-21-andy.chiu@sifive.com> References: <20230518161949.11203-1-andy.chiu@sifive.com> <20230518161949.11203-21-andy.chiu@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" 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 Hi all, Le torstaina 18. toukokuuta 2023 19.19.43 EEST, vous avez écrit : > This patch add two riscv-specific prctls, to allow usespace control the > use of vector unit: > > * PR_RISCV_V_SET_CONTROL: control the permission to use Vector at next, > or all following execve for a thread. Turning off a thread's Vector > live is not possible since libraries may have registered ifunc that > may execute Vector instructions. > * PR_RISCV_V_GET_CONTROL: get the same permission setting for the > current thread, and the setting for following execve(s). So far the story was that if the nth bit in the ELF HWCAP auxillary vector was set, then the nth single lettered extension was supported. There is already userspace code out there that expects this of the V bit. (I know I have written such code, and I also know others did likewise.) This is how it already works for the D and F bits. Admittedly, upstream Linux has never ever set that bit to this day. But still, if we end up with the bit set in a process that has had V support disabled by the parent (or the sysctl), existing userspace will encounter SIGILL and break. IMO, the bit must be masked not only whence the kernel lacks V support (as PATCH 02 does), but also if the process starts with V disabled. There are two ways to achieve this: 1) V is never ever set, and userspace is forced to use hwprobe() instead. 2) V is set only in processes starting with V enabled (and it's their own fault if they disabled it in future child threads). Br, -- レミ・デニ-クールモン http://www.remlab.net/