Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2941273imm; Thu, 24 May 2018 19:32:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqUmNWYaYMyK+XuixaQOot2HUpv2H6uPV2gox4JuUnLF11XCdJYKwICio8RKPVyTLIbMudc X-Received: by 2002:a17:902:7896:: with SMTP id q22-v6mr575202pll.243.1527215529141; Thu, 24 May 2018 19:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527215529; cv=none; d=google.com; s=arc-20160816; b=RYvemebNyVDWVSSI0ifUrOOVlBHT2ld8r8CxG9xKlY2MeIbTQWp/McLGLePwBXZtFm D5T8+69HspJoMJhi9if/ZiKSq7CvtmvLabxGFUopYqSH2ihJNa4rauQIL4OLkWiFKUwp FymJUDoRiJmdGUHISPp65u0I60YzRIgsV2wUgcALOlnQSmXyXh5gU2IXIgVFNVJl6HDu ZQo6RfhvvZyiPfh0Zd4k8C3MxV6nGI7MI99Iczuz9dza8hVsOo3cwhuSwOGyLO39oYzz 9pJg1xWHh7wsy5pP4SOiBa88BmO67f32MZoo9TRMJzZkYJsjP/AxaT/SxAf6K92mmvwA EP5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=tpKnEEPPTJp14Pk4cVsSNvCp0hn739GOfsmjZSQFi+8=; b=s4D2RW7sTZyh9lbq/tKwuYe3dw2cWQpMxXrgdBSX/KH0BF4OMlgUdJqT0A3IMuHx6e N3WjJMxhQQpTBJYZiDP2xzlOFrQyUOAlPKLdhfHrFLZyY8rXX5M+u7YXiD+67wh2s1g3 MBF0adncGi352jX/ZzDlWqQr/MKCdp42LLvGK0Ka9a/OYnBG2pOFvcvW5IRNF6M/qHTJ s8xoUJ/xvE03DzWlulSgZcXZiHlUaiK4OfOT2+tc3gI4TvE1KnZy1ClDQqVUHeTOMtxC 8/VsxDPsAO/0NoGsCdVspOUreGt/aFow7nKb9UhUHONIhVAYo6urKvN42zf529ma90Wz /cVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u32-v6si4614622pgn.488.2018.05.24.19.31.54; Thu, 24 May 2018 19:32:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034096AbeEXRGU (ORCPT + 99 others); Thu, 24 May 2018 13:06:20 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.154.211]:59626 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033609AbeEXRGS (ORCPT ); Thu, 24 May 2018 13:06:18 -0400 Received: from mipsdag02.mipstec.com (mail2.mips.com [12.201.5.32]) by mx1401.ess.rzc.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO); Thu, 24 May 2018 17:06:13 +0000 Received: from [10.20.78.188] (10.20.78.188) by mipsdag02.mipstec.com (10.20.40.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Thu, 24 May 2018 10:06:14 -0700 Date: Thu, 24 May 2018 18:06:05 +0100 From: "Maciej W. Rozycki" To: Paul Burton CC: James Hogan , Ralf Baechle , , , Subject: Re: [PATCH] MIPS: prctl: Disallow FRE without FR with PR_SET_FP_MODE requests In-Reply-To: <20180524163617.dts46enhigc2yjfo@pburton-laptop> Message-ID: References: <20180524163617.dts46enhigc2yjfo@pburton-laptop> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [10.20.78.188] X-ClientProxiedBy: mipsdag02.mipstec.com (10.20.40.47) To mipsdag02.mipstec.com (10.20.40.47) X-BESS-ID: 1527181573-321457-30576-10480-1 X-BESS-VER: 2018.6-r1805181819 X-BESS-Apparent-Source-IP: 12.201.5.32 X-BESS-Outbound-Spam-Score: 0.01 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.193318 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.01 BSF_SC0_SA_TO_FROM_DOMAIN_MATCH META: Sender Domain Matches Recipient Domain X-BESS-Outbound-Spam-Status: SCORE=0.01 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_SC0_SA_TO_FROM_DOMAIN_MATCH X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, > > Having PR_FP_MODE_FRE (i.e. Config5.FRE) set without PR_FP_MODE_FR (i.e. > > Status.FR) is not supported as the lone purpose of Config5.FRE is to > > emulate Status.FR=0 handling on FPU hardware that has Status.FR=1 > > hardwired[1][2]. Also we do not handle this case elsewhere, and assume > > throughout our code that TIF_HYBRID_FPREGS and TIF_32BIT_FPREGS cannot > > be set both at once for a task, leading to inconsistent behaviour if > > this does happen. > > Reviewing the code I think we should actually end up with FR=1 in this > case, because neither __own_fpu() nor the FPU emulator depend on the > value of TIF_32BIT_FPREGS if TIF_HYBRID_FPREGS is set. So it's not too > awful & I don't see the kernel doing anything too crazy, but it > definitely isn't what the user asked for. However `arch_ptrace' does check TIF_32BIT_FPREGS and gets things wrong if TIF_HYBRID_FPREGS is also set. Which is actually how I discovered this issue. > > Return unsuccessfully then from prctl(2) PR_SET_FP_MODE calls requesting > > PR_FP_MODE_FRE to be set with PR_FP_MODE_FR clear. This corresponds to > > modes allowed by `mips_set_personality_fp'. > > Looks good to me: > > Reviewed-by: Paul Burton Thanks for your review. Maciej