Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4817311ybl; Mon, 13 Jan 2020 21:41:59 -0800 (PST) X-Google-Smtp-Source: APXvYqzj4ve6icZRU+/6koM18c5Q5iO8yVSQ84h4MlWM5gEL/8yjXCzXQCzbUxL1caJnW8HhE14+ X-Received: by 2002:aca:5487:: with SMTP id i129mr14545233oib.167.1578980519376; Mon, 13 Jan 2020 21:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578980519; cv=none; d=google.com; s=arc-20160816; b=p8C1AkDCXWiVBsV3/Qx+LIgNmVS13O6xGzWgJidqB8GG3MFabwj4Oew/Y4n7Vt3uP2 VY7C3Jd3CzRFP8tBWfauE6f69wGfrghCBzkOEl81BQfVFHUm6Q5EaiL/H/IkQQkC0kJN th5AOGSUxLn5Req46xfcOtBn1Onb9B8xk7q0JFbls+5lzlAhs636v4Ww9Fowwnb9RzST wJO5Iwxfppk3gqR7j9WAqDaNrukF5k6Dm/E3bE/Hwe/CKhzKxoR2TqQ4qfwdRZnKNoiR XW84CRCR4t9rIievhUjxZ5ptPrCDbdmm8PExSgJr5ml0kkHPHvIjI7/+fqCZXF77mWfy xtTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=3RoVxtUHXM04fwCgNKeXav2wOxSVz6HLLv79bjgMRXM=; b=Tx+Rse+nf8NfWOH+e//RKGcErxLhWMCM6lTWbJ/6Lb1UMANZeTMT+U1tWmQA/ne1a6 g4crV+o4owCjXRtf4ZTHNfBzUCv3hIZ8p/MsPROz6PlorVv0sgMtOCCSxyS0ktXtZPY1 iRxUa5br+fw3Cwdg2VuEs+YQJtQCvfpFf2GM5ZQFM6IZhRhitEw3hBcHS0ohiG9Wtgk6 9Mvkj0kD2b4FEei8bSAJbISBK/bvRmUGp2ZHoQP0YYHr1E40Wsr+vO2fzyWLx1IfMRWJ 22pWQCnfYZbymEXG5PNgVMHiZDBX/o/jH/NBeuIS1EWq6/dMCCWFT62O1ukleb5yZ9Nr phrw== 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 w10si8521129otg.295.2020.01.13.21.41.47; Mon, 13 Jan 2020 21:41:59 -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 S1728695AbgANFkA (ORCPT + 99 others); Tue, 14 Jan 2020 00:40:00 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:44658 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgANFkA (ORCPT ); Tue, 14 Jan 2020 00:40:00 -0500 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S23990431AbgANFj45Upcz (ORCPT + 2 others); Tue, 14 Jan 2020 06:39:56 +0100 Date: Tue, 14 Jan 2020 05:39:56 +0000 (GMT) From: "Maciej W. Rozycki" To: Paul Burton cc: David Laight , Ralf Baechle , "linux-mips@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: RE: [PATCH] MIPS: Use __copy_{to,from}_user() for emulated FP loads/stores In-Reply-To: <20191229190123.ju24cz7thuvybejs@lantea.localdomain> Message-ID: References: <20191203204933.1642259-1-paulburton@kernel.org> <20191204154048.eotzglp4rdlx4yzl@lantea.localdomain> <20191229190123.ju24cz7thuvybejs@lantea.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, Sorry to take so long; it took me a while to track down the discussion I had in mind, and I was quite busy too. Also greetings from linux.conf.au! > > As I recall we only emulate unaligned accesses with a subset of integer > > load/store instructions (and then only if TIF_FIXADE is set, which is the > > default), and never with FP load/store instructions. Consequently I see > > no point in doing this in the FP emulator either and I think these ought > > to just send SIGBUS instead. Otherwise you'll end up with user code that > > works differently depending on whether the FP hardware is real or > > emulated, which is really bad. > > That might simplify things here, but it's incorrect. I'm fairly certain > the intent is that emulate_load_store_insn() handles all non-FP loads & > stores (though looking at it we're missing some instructions added in > r6). More importantly though we've been emulating FP loads & stores > since v3.10 which introduced the change alongside microMIPS support in > commit 102cedc32a6e ("MIPS: microMIPS: Floating point support."). The > commit contains no description of why, and I'm not aware of any reason > microMIPS specifically would need this so I suspect that commit bundled > this change for no good reason... See the thread of discussion starting from this submission: and in particular Ralf's response (not referred directly due to the monthly archive rollover): I think Ralf's argument still stands and I find it regrettable that an unwanted feature was sneaked in with a trick along with a submission supposed to only add a different, unrelated feature. I can't even track down a public submission/review of the change you refer, which is not how things are supposed to work with Linux! And neither the `Signed-off-by' tags help figuring out what the route of the change was to get there upstream. At that time there was supposed to be Ralf's tag there, as it was him who was the sole port maintainer. > It's also worth noting that some hardware will handle unaligned FP > loads/stores, which means having the emulator reject them will result in > more of a visible difference to userland. ie. on some hardware they'll > work just fine, but on some you'd get SIGBUS. So I do think emulating > them makes some sense - just as for non-FP loads & stores it lets > userland not care whether the hardware will handle them, so long as it's > not performance critical code. If we knew that had never been used then > perhaps we could enforce the alignment requirement (and maybe that's > what you recall doing), but since we've been emulating them for the past > 6 years it's too late for that now. I don't think it's ever too late to remove a broken feature that everyone knows is not a part of the architecture and the emulation of which has never been advertised as a part of the Linux ABI either. You just don't make it a part of the ABI when you sneak in a feature without a proper review, we do not accept the fait accompli method in Linux development. The presence of unaligned FP data is a sign of user code breakage and whoever caused that breakage will best know that ASAP by seeing their program trap (they can emulate the trap in their software by installing a suitable signal handler if they are so desperate to have unaligned FP data handled). So I think that not only the new submission should be rejected, but also parts of commit 102cedc32a6e ("MIPS: microMIPS: Floating point support.") reverted that are not a part of actual microMIPS support. If someone relied on it by accident or ignorance, they'll simply have to adjust. Maciej