Received: by 10.223.164.202 with SMTP id h10csp3464719wrb; Tue, 28 Nov 2017 11:45:32 -0800 (PST) X-Google-Smtp-Source: AGs4zMbaasClufXFmSmxj1gg4MPiOB3+zQcmIjM3wGNSsoL9cDBHUvxUWFnNDZ+yetuzv6e/L5q7 X-Received: by 10.159.218.144 with SMTP id w16mr246303plp.443.1511898332482; Tue, 28 Nov 2017 11:45:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511898332; cv=none; d=google.com; s=arc-20160816; b=rOPryA3UIQrvssQj4x9gtUZNbrU8JHS2Zog0z3mO6gWJTRoNz0220UMtqXhdG4D8hN EvpeBJe0QZWxJE37CzK0TxQuk7XM8iIPe9LeIwBv/4BZgBK7cWyXQVQqYvPerFkhH7Or iFpF3KovI63c4P49YlS5N/RTo2MIyUsE3hs0g3C0qZFYj01YMlttD32plEw4nG0RDIB9 M4u61QaacfyfROR/h/KzaZEuy/YIOvX7AMuPMKhTVTZ9Tz606AzEqeJ3LLxNgNKT0HLh OrSdor2xjmo7/WEurZGHkYcdFxE3iuVlhx/hO8Nh3ZZHmQdlvmR/0kL/PamSCbjfAmys hHKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=6gLJwRl5XU/OnFj3RLuOHJtSAZ2yvGyLIZ+y3bTS5Ik=; b=spw6GQmHBo5AJe14j98ggpHzrcBZ34zIj9SueIJg+2BBOODkFc8g6CGveZ66G3ZDXI /VFTAmVxCuBwWVSENUIQVQPe9w4SOi3FZesMisKcHXdPzdDv0w9I7tHe8Ie+6vXNmeOk getDflTwjOj3spky7ZXs1Ue2ehnt/lPkAavsq54OEUq5DLnNua3y71n7grILKj+aLVj3 RDIrfBENigsksUkFntm8xRhiCMgRa9O4BDpWqNNoWJsfWV/OUMr2g02FKUy8g2b6410T cp6F+zSIIYZBX5L1lgNCOlF24aG5oeyMTevCfKie7ikR5ZtMFkxB14CyB2+iklYrH3yb MuMg== 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 w1si23899331plk.259.2017.11.28.11.45.21; Tue, 28 Nov 2017 11:45:32 -0800 (PST) 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 S1753855AbdK1Tna (ORCPT + 71 others); Tue, 28 Nov 2017 14:43:30 -0500 Received: from 9pmail.ess.barracuda.com ([64.235.154.211]:57565 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbdK1Tn3 (ORCPT ); Tue, 28 Nov 2017 14:43:29 -0500 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx1401.ess.rzc.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Tue, 28 Nov 2017 19:43:22 +0000 Received: from localhost (10.20.1.18) by mips01.mipstec.com (10.20.43.31) with Microsoft SMTP Server id 14.3.361.1; Tue, 28 Nov 2017 11:30:53 -0800 Date: Tue, 28 Nov 2017 11:31:33 -0800 From: Paul Burton To: "Maciej W. Rozycki" CC: Ralf Baechle , James Hogan , , , Subject: Re: [PATCH] MIPS: Validate PR_SET_FP_MODE prctl(2) requests against the ABI of the task Message-ID: <20171128193133.ip6weo4tgstqun44@pburton-laptop> References: <20171127184642.ny2lad4y6zz6am2b@pburton-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171013 X-BESS-ID: 1511898172-321457-8854-7709-8 X-BESS-VER: 2017.14-r1710272128 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.01 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.187379 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 Maciej, On Mon, Nov 27, 2017 at 09:39:10PM +0000, Maciej W. Rozycki wrote: > > > Always succeed however without taking any further action if the mode > > > requested is the same as one already in effect, regardless of whether > > > any mode change, should it be requested, would actually be allowed for > > > the task concerned. > > > > This seems like a distinct change that I think would be worth splitting > > out to a separate patch. > > I've been thinking about it before posting and decided it's inherent. > > Indeed in developing this fix this part was the last one I realised that > had to be done for the change to be overall self-consistent, following a > principle typically applied to hardware registers where the programmer is > architecturally allowed to write individual bits with the values > previously read from them even if these bits are undefined in the > specification of hardware concerned. > > So here you'll be able to issue a PR_SET_FP_MODE request with a value > previously obtained with PR_GET_FP_MODE and it will succeed, even if all > the bits are actually read-only for the ABI in effect. This is important > as GDB will soon be using these calls and expect PR_SET_FP_MODE not to > fail if an attempt is made to write back a value previously obtained with > PR_GET_FP_MODE. > > I could have buried this check in the two conditions that follow, making > execution fall through if the mode remains unchanged, however I have > realised that making the check upfront makes the resulting code cleaner. > > That written, I could make it 1/2 with the ABI checks becoming 2/2, but > then 1/2 wouldn't make sense on its own (except perhaps as a > microoptimisation, but that would be an entirely different purpose) and > would have to be considered in conjunction with 2/2 anyway. Ah - OK, I see. Prior to this patch the value returned by PR_GET_FP_MODE would always be one accepted by PR_SET_FP_MODE anyway, but with the patch that will cease to be true for non-o32 ABIs without the special case. Gotcha. > > Both changes look good to me though, so feel free to add: > > > > Reviewed-by: Paul Burton > > Thanks for your review. Do you feel convinced with the justification I > gave? Yes - I follow, please consider the Reviewed-by tag valid for the patch as-is. Thanks, Paul From 1585257001366260489@xxx Mon Nov 27 21:41:27 +0000 2017 X-GM-THRID: 1585211647942183839 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread