Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp858498imm; Fri, 29 Jun 2018 07:32:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIrVtQkC1R29P8PGBQsE6JpBcfHnngAMY72xIqMObxAoG/icvGSHSyaLW+X6l9gVRMUcpKZ X-Received: by 2002:a17:902:bf0b:: with SMTP id bi11-v6mr14820310plb.25.1530282762766; Fri, 29 Jun 2018 07:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530282762; cv=none; d=google.com; s=arc-20160816; b=ikg+XxQ4Ky8tIk1Mf0NUvfCKrqK9KF3+Fw5gW8ecRurEtpan2o/YCjfYUJk1pMLoll Wvxqnz8jeGyx3y0xAnmRZUXCfSsVvtsocOF4TKkm7hvYAjcfnLf/7vTlZej7jcjEeIBY 3ly8PN+jUnDS6D1KRbYvQvv7RiJynqYZwpGyqFrv9PoIhU38mTY+RPxLxJZP+nuT0EQI WMLDyNWIAKKZ9J/e+quMh0bTOaBiIDdPC9W+MHGPKu3K3nCNW/E6NMlbcTPztTbJ6alF 7FzO9crhg1pYN0qvnPXokX39gj2gz1M9zIsVwHLdY+5uTk28DwTDzZvT/F5My0UNZY9P qMYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter :arc-authentication-results; bh=5ByuItJs0OiOc9kbxFpQMItF7m9NGxB+wpaTyGrZVNE=; b=0u3NzoDDwn1CAfJr96Kvtjmh7y3Exm16NiLeBwsOnY658Zxg2l8mZMR8HfRTZ4u33M yv99z+KbJuoqFDUAneFYSQCT88N+fLm1kuIuXUKQfVLf3EjZmVz02WETg/eNtEE5nemX lHsxLkEaKimFOTmptMAve+UfQRz0YgN7U91O7FXX4LREp3a6GCldRSBlAZLc7/SEKnSJ mpDrm01tSqUozT1gnxpGLcCq6mmaCNjYrTLPYU7zJ2qRaYohrsGdeZ2leUp16cgttXpp YEEyh6PLq46N8HLLV01aio98w7jlVTeUvviWUioA6ZSeklRnF867HOoYfHKUfNzXYhtR yvYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=hw238xHj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62-v6si8302871pgd.501.2018.06.29.07.32.28; Fri, 29 Jun 2018 07:32:42 -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; dkim=pass header.i=@efficios.com header.s=default header.b=hw238xHj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936685AbeF2OFs (ORCPT + 99 others); Fri, 29 Jun 2018 10:05:48 -0400 Received: from mail.efficios.com ([167.114.142.138]:56582 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932280AbeF2OFq (ORCPT ); Fri, 29 Jun 2018 10:05:46 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 3EB8C22D3FE; Fri, 29 Jun 2018 10:05:45 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id WTczEU2ZVxew; Fri, 29 Jun 2018 10:05:44 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id CEB4922D3F4; Fri, 29 Jun 2018 10:05:44 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com CEB4922D3F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1530281144; bh=5ByuItJs0OiOc9kbxFpQMItF7m9NGxB+wpaTyGrZVNE=; h=Date:From:To:Message-ID:MIME-Version; b=hw238xHjjt2SHSODQK6bqFh0xgtRlHi4aDZv2cLfoSOa+9dxJaG5QB1jV+UU4ptan 8Pf76UmHGzvEZ3nqsmwnaX26ESmhjfws2WbSPbApPlJ/SB3lCIQSG2lfkO5f6kpMqB mZMrT6oXu4J1kUMou5XTQdKvZdAVRClyS3Cega05PdAa9pYLPe2eqjftbP1H31De3N rWGCxtAOOItS4DVfeRcMNLThMCL1zTU8FAzzCYyOl+2yNdRBh8PZmUMlY3hOUOwmD2 UCNcjlangoXVGuSGd0philnkVnCYjfL0vhq/m3WHXV3Hiq5qP+CCXWg02Gh9OXRUWi E+Y6zYx2bBbsg== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id ZjB5QL1XcIkA; Fri, 29 Jun 2018 10:05:44 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id B1F8922D3E1; Fri, 29 Jun 2018 10:05:44 -0400 (EDT) Date: Fri, 29 Jun 2018 10:05:44 -0400 (EDT) From: Mathieu Desnoyers To: Linus Torvalds Cc: Andy Lutomirski , Andy Lutomirski , Thomas Gleixner , linux-kernel , linux-api , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Dave Watson , Paul Turner , Andrew Morton , Russell King , Ingo Molnar , "H. Peter Anvin" , Andi Kleen , Chris Lameter , Ben Maurer , rostedt , Josh Triplett , Catalin Marinas , Will Deacon , Michael Kerrisk , Joel Fernandes Message-ID: <1706339668.9644.1530281144560.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180628162359.9054-1-mathieu.desnoyers@efficios.com> <9200ED2A-AE4B-4094-81C9-E92240B4840F@amacapital.net> Subject: Re: [RFC PATCH for 4.18 1/2] rseq: validate rseq_cs fields are < TASK_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.8_GA_2096 (ZimbraWebClient - FF52 (Linux)/8.8.8_GA_1703) Thread-Topic: rseq: validate rseq_cs fields are < TASK_SIZE Thread-Index: LCPV3Tf5U+eY2oj4yJoy1Hp5/5f7Hw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jun 29, 2018, at 10:02 AM, Linus Torvalds torvalds@linux-foundation.org wrote: > On Thu, Jun 28, 2018 at 6:08 PM Andy Lutomirski wrote: >> > On Jun 28, 2018, at 5:18 PM, Linus Torvalds >> > wrote: >> > >> > >> > Make it do >> > >> > if (rseq_cs->abort_ip != (unsigned long)rseq_cs->abort_ip) >> > return -EINVAL; >> > >> > at abort time. >> >> You sure? Because, unless I remember wrong, a 32-bit user program on a 64-bit >> kernel will actually work at least most of the time even if high bits are set. > > Sure. > > If you run a 32-bit binary on a 64-bit kernel,. you will have access > to the 0xc0000000 - 0xffffffff area that you wouldn't have had access > to if it ran on a 32-bit kernel. > > But exactly *because* you have access to that area, those addresses > are actually valid addresses for the 32-bit case, so they shouldn't be > considered bad. They can't happen on a native 32-bit kerne, but a > 32-bit program doesn't even care. If it has user memory mapped in that > area, it should work. > > And if it *doesn't* have user memory mapped in that area, then it will > fail when the trying to execute the (non-existent) abort sequence. > > After all, depending on configuration, a native 32-bit kernel might > limit user space even more (ie some vendors had a 2G:2G split instead > of the traditional 3G:1G split. > > Was that the case you were thinking of, or was it something else? What I'm worried about is setting regs->ip of a compat 32-bit task to addresses in the range 0x100000000-0xFFFFFFFFFFFFFFFF. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com