Received: by 10.223.176.5 with SMTP id f5csp1209999wra; Tue, 6 Feb 2018 14:54:28 -0800 (PST) X-Google-Smtp-Source: AH8x224ldVijRN7wxkNt9UZVXoWqGm2mmw0M9WhECSN6waZ/TI063zUo2pejET4Yqga8wZewu5Hm X-Received: by 2002:a17:902:624:: with SMTP id 33-v6mr3779331plg.327.1517957668571; Tue, 06 Feb 2018 14:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517957668; cv=none; d=google.com; s=arc-20160816; b=tR0vNTO7XUQJt6xSYKJHA/4CEUwDcsJvWJu7TLfxIm6UZlR1zybuWf0xfzQWYj80zd I7hu0KG0m3UGanIn32A3HEooByTkjYrwPb2+NXpPOLYXwlnYxy7ifzYCQLbtuNQmmNcI Ap4o/aUabHyNKYsVprMCgSR2DasIPcmgL84+38/BSiVvSW77hE0WvAIhXw6KO750sgUz kiXB8hirqwha6HJVdqAsSq3BiA0Y2t8k34Urcurc6cbOamAXJZxt5qHXlpHe3997t2YA ODHJzzfDRXKqlAB2oa9v+Z1j4pSUgmjzvYoYu5xPj1wYXTiVdtUXjJ5gFDWNSroh52UN mxJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=QX0zFOQWpFQFm1SRbqnkZJxgmLvrgXII3QK9k9gcHrg=; b=sPXis4iPo1mDko9hw2Bo58RUh3qHC8wa8QaJWbjko7viieeRvgz9Vn5IQvMeKJHXhG 20D+kXxo72bWVfA/d+HDGSKMt+WfNor3TvSM4Uv8cC4Fhc854VActc5rklhhNqQuluVq ElfmEAoo+/bxA086FTj0K5tIrnTGnSvZ67trDEdrGbo7zUf8HBiWFWlpMXrLPV6bQdv0 Z/Xopr0Ose8/Wkat3l5PQV6HwEeK05FyllgJ1lppmNoLFvIpYqsjl4yV3hZHhNu6Og3l Npa0DbEPzlMB4gJI3B4AIwdmchx7mAVVbSeUq8H5hiq9OKZ/4235eFwD+EjKAFXYMRDT QCGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fxL0gtKM; 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 d23si42903pgn.737.2018.02.06.14.54.14; Tue, 06 Feb 2018 14:54:28 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fxL0gtKM; 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 S1753817AbeBFWxC (ORCPT + 99 others); Tue, 6 Feb 2018 17:53:02 -0500 Received: from mail-io0-f179.google.com ([209.85.223.179]:41307 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753798AbeBFWxA (ORCPT ); Tue, 6 Feb 2018 17:53:00 -0500 Received: by mail-io0-f179.google.com with SMTP id f4so4260868ioh.8; Tue, 06 Feb 2018 14:53:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QX0zFOQWpFQFm1SRbqnkZJxgmLvrgXII3QK9k9gcHrg=; b=fxL0gtKMroSZFH2/1Apjdi6j+a9L/8oxbhASpMJysE99NJRlV1bvyKenVzf4km9JO8 mlh5u6Jsrvt4XgKeDOtTEJ4nSOrCMdk6fEqRNqPQ3SlbllUbuyG4nVv71HC8GfLZC4iw migXDjeRp/u5MTURpWdL7m9mIvl3IEqcRnuwf+ybOVdttGwzYikhcwXRUeDEE6kdCWsU ZAvgUjTXKSBZD/umj7lWmDOdCw7i2xmPt3WKOc/I/SEi+CjWu6uV1W59EPQYIJDcL7kB 2gCAH+WEjPZYTPPBN68MUTqyLIUxC03S++wHhbvZzEUJRYm7raP95fOTdcdW+5lUJV8T D3pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=QX0zFOQWpFQFm1SRbqnkZJxgmLvrgXII3QK9k9gcHrg=; b=Lg5wvPjyzWNH34liDfdKzOQgfzhI5tzca8KZZaEe2QGj/iqPgfjxMoLGXoGuMzzxzB Dha66XF4eCUUHpbxSj+7PHGdWNBTxfVEmXozhcs52ZtaqwajzRAnWTf1eBmYhIVrm9xk f0EvoWf1as1h/VeEZXItxNXQxN3nhxTkLaB2oDwgRqVVVl27LO46oujau29lJPF1aT6C QKGDZIewgHN6kJ1eD18FxWKeGWAt6C+16KMdeOKz1UWlmtWqoHUUymD10FyC1J2+CZy2 xQrFG0g3iBZTcF4/0h2TIRWILSFPah1KMNhdvPa2v2IcEsrka9fqWDuZOxAQg5KPQxKu FQbQ== X-Gm-Message-State: APf1xPAUeRwrW5YcF70NHnZ+5FXh7NS8EL6o43H8+F9BcBgN6v5H3M3I ikc+8sb3A4k3qD4dH9GbsVkeG+hEAtyugRMI55U= X-Received: by 10.107.78.5 with SMTP id c5mr5262304iob.120.1517957579997; Tue, 06 Feb 2018 14:52:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.59.196 with HTTP; Tue, 6 Feb 2018 14:52:59 -0800 (PST) In-Reply-To: References: <151632009605.21271.11304291057104672116.stgit@dwillia2-desk3.amr.corp.intel.com> <151632014097.21271.16980532033566583357.stgit@dwillia2-desk3.amr.corp.intel.com> <20180206192925.qkmghwsbaysr4iv2@hermes.olymp> From: Linus Torvalds Date: Tue, 6 Feb 2018 14:52:59 -0800 X-Google-Sender-Auth: IsKuuxJzSRaTOIUlbpHqUiZEfoo Message-ID: Subject: Re: [PATCH v4 07/10] x86: narrow out of bounds syscalls to sys_read under speculation To: Dan Williams Cc: Andy Lutomirski , Luis Henriques , Linux Kernel Mailing List , linux-arch , Kernel Hardening , Greg KH , X86 ML , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Andrew Morton , Alan Cox Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 6, 2018 at 1:37 PM, Dan Williams wrote: > > At that point we're basically just back to the array_ptr() version > that returned a sanitized pointer to an array element. .. that one does an extra unnecessary 'andq' instead of the duplicated cmp. But at least it avoids comparing that 32-bit integer twice, so it's probably slightly smaller. (And your code generation is without the "r" -> "ir" fix for the size argument) Probably doesn't matter. But a "asm goto" would give you at least potentially optimal code. Linus