Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp419181imm; Thu, 28 Jun 2018 23:31:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIyR3zUI5KOQzwnNMVRwpZiKqfrYYrtn/r8D69sAa10MojCxVZWs/oyhc2sIlcGVIkoptrs X-Received: by 2002:a65:6604:: with SMTP id w4-v6mr11457331pgv.346.1530253903191; Thu, 28 Jun 2018 23:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253903; cv=none; d=google.com; s=arc-20160816; b=n3or277H6jbzhSJMevGNsz7Mu5zBbR6ENzCdsTMCs+dDilDoS8IDpWY5TuV/eXVHrT KzuxdoROiOtNcnO8oL8d44kXvFE5u6u/0Y/s/D4pHWqyja6D5vnE+K2hyUH7rdiPNoTi AWL9RKl4ZVBollq0sWIfi8nfrxExKrlXmgA3n6Azf36VGoynVCZkZmG4jenuPowAO5Gk dYsNpJbPdNEl5yfEKdWpFDioMB8MfjDQqGt77cZ+TGVHik8985aL/5j7Hg+gYBDzvOCi 5LZlg3DyEJYMZ0xERPsrnUx+pEaoeHMLXZtpjGFD644ZQKDbvFTZX1z7CX4n7zhfOPET cIpw== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=107XICFehgDCJLrRKVRUPK9jm84kP2RAAMakx69wqnQ=; b=RRyCBN5zEBUV+nQebQE5VvPeXNbvCqD+uL7E1t8K2M5Ra1TFN7815shtdKNXw1B1wG FqrOyMj1RVVqR6SXJoo+fVP/Ud7scga6xrwvyXmA49nsAhn/9vptSkAviNnIjJSvp5sB qHMIK9nwk/Xldg/mlC5agcOz1YMiDUOvaw/nlO57tnYUmkyzCjxa8lwp5hZSbv9ks1G4 HGWB70HaFH22ov95DvY82I0Q2DeVE+j1b0KfcRAFSa/kCsNhnjWjekeHsw8bm54Y+AC8 LxwRwiY2C1IIEtoDi2iVCvJAqciJWCV+Z5FpQ3NvWm8l/iVzm6+mSby5fwnzr/7F+4+t wnyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="b7RFD2/C"; 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 t65-v6si7596055pgt.300.2018.06.28.23.31.29; Thu, 28 Jun 2018 23:31:43 -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=@linux-foundation.org header.s=google header.b="b7RFD2/C"; 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 S936361AbeF2ASh (ORCPT + 99 others); Thu, 28 Jun 2018 20:18:37 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:37128 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934190AbeF2ASd (ORCPT ); Thu, 28 Jun 2018 20:18:33 -0400 Received: by mail-io0-f196.google.com with SMTP id s26-v6so6905612ioj.4; Thu, 28 Jun 2018 17:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=107XICFehgDCJLrRKVRUPK9jm84kP2RAAMakx69wqnQ=; b=b7RFD2/CTvzTjX6aeklvdl7eOz76beQONGkhNVR6x0ImELpW06/x4QOiwF/xdqPldQ hvOoE7busM/fqKh34luzWUUnkAMGCjyyhPtWvEZDMOZ54l7p+6nR8N1Fof9M7Mp66ndB HJYU4e4EFn0uH0oj7fpBp8D5+JVcTTsC0aqbU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=107XICFehgDCJLrRKVRUPK9jm84kP2RAAMakx69wqnQ=; b=TlcDVUlACkVpaJCq/jlMGjTjF4wKEfepTyjTsiV6Y1Mkr1CHxcBEOhB5ERNKRSmLnU SLesLZowUbYnNQl3MMnusnd0urVx0aGyvhltbrVvYVNl1L6OBzC7vPe/QXuEV01JTBAv VJ74lkprEW8dab1XXWOgxZDkYAYMCWMhrOpGjPspOaXBrnjcjBw79O3nnFhV97187nPI 2F7E5+JOItHqIdWCkBQDydSuiwKez2TH9cmtvMcoaSHtE6cO5E1RwV3NrGy9L1GNr6ZC EJ42Q7O9ABQD+/Xvgfr3vXXLLysf7aq7rT3UYNL6zc2iQAeRt1ckstaIta8sU8lCZYBV XTHw== X-Gm-Message-State: APt69E227zFvru2LKcgKgZxh8y6PaRu3vNnVY0nhEqC4ZfUwjjanaXBf qZwE3iWcAWFvvralrMZUQSs/iM+Qh6mwrrXs15c= X-Received: by 2002:a6b:274f:: with SMTP id n76-v6mr10906893ion.259.1530231512936; Thu, 28 Jun 2018 17:18:32 -0700 (PDT) MIME-Version: 1.0 References: <20180628162359.9054-1-mathieu.desnoyers@efficios.com> In-Reply-To: From: Linus Torvalds Date: Thu, 28 Jun 2018 17:18:22 -0700 Message-ID: Subject: Re: [RFC PATCH for 4.18 1/2] rseq: validate rseq_cs fields are < TASK_SIZE To: Andrew Lutomirski Cc: Mathieu Desnoyers , Thomas Gleixner , Linux Kernel Mailing List , Linux API , Peter Zijlstra , Paul McKenney , Boqun Feng , Dave Watson , Paul Turner , Andrew Morton , Russell King - ARM Linux , Ingo Molnar , Peter Anvin , Andi Kleen , Christoph Lameter , Ben Maurer , Steven Rostedt , Josh Triplett , Catalin Marinas , Will Deacon , Michael Kerrisk , joelaf@google.com 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 Thu, Jun 28, 2018 at 4:30 PM Andy Lutomirski wrote: > > The idea is that, if someone screws up and sticks a number like > 0xbaadf00d00045678 into their rseq abort_ip in a 32-bit x86 program > (when they actually mean 0x00045678), we want to something consistent. I think the "something consistent" is perfectly fine with just "it won't work". Make it do if (rseq_cs->abort_ip != (unsigned long)rseq_cs->abort_ip) return -EINVAL; at abort time. Done. If it's a 32-bit kernel, the above will reject the thing, and if it's a 64-bit kernel, it will be a no-op, but the abort won't work in a 32-bit caller. Problem solved. Linus