Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp314088imm; Mon, 2 Jul 2018 12:01:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe2OsRJi10I/48KH8vxEbmBhzyDrNjwKTgSOwJMRPk+k6KA6RGeOBCdbRjH71VAknCV+BZL X-Received: by 2002:a62:a3d1:: with SMTP id q78-v6mr26338380pfl.5.1530558077869; Mon, 02 Jul 2018 12:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530558077; cv=none; d=google.com; s=arc-20160816; b=kwdHVtVA5OH5HE5idW98QUkWkCilzYw4BEyyPihGRB3AOcXHznWdunTVJOVTtifOHs rvFx2okXWmni+VSVqKPHGhYvHf51+ZfNj2hc0MidXPLOJ9KwA07TwNYwrFH8Ub/LL6Y0 vBkiN3jQX47AMeSCj87bDqcIzt34vveXWUbxZiF49nh/OekTRM+zlbj2xYOj6yFKLbcF oNvJve8yfP1WTktAmCHxJslQjRwpkwfyAeHhGw2W6+LIrUZ3XdZPZ+0kgKbvSvVieg+K w0E4oUTZC5OA2R4J+pBGkp7XJrSS8AxI143OOpauRP6xLekcpXI3v9Bl4AR4Tr7b8s5V SdgA== 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=41l1hGE2RoKcMZcMG7RhGdM8b1xVU7R9dcFWpnmpsaE=; b=jKqbmf1lxTnwKuRIiU2FUcuYTMIF2Wue0GJetFLZbvH2O8NMBZF/z1UWs5yVc48x7d WAbgGomPfd8TK8bt0Q3revyOjnRWxvNuXeyoMeEYUaRZ7XjtP8+l7SlPNOUNOrH98S9n AtcxZ76feMiAZV3Jy4x2XBsg1Cipz6d6UaXpkTuujQ6WwtWbCyZoxuThgbh+b1Yxb23f PWV3r6D70wTAYwQnq2fKQaEG+37Ma0matad6V+9338Jqz4JHYoouGBIlvHQr7GldcOHR +I/SeKFxLMDCOILwry9PnaCcxjN+WXPLpoyRkrnnt1i53W2s4F/ZCvcBcdkHbD12vVZX 3RAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=NdQN4USa; 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 b35-v6si16989514plh.36.2018.07.02.12.01.02; Mon, 02 Jul 2018 12:01:17 -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=NdQN4USa; 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 S1753377AbeGBTAT (ORCPT + 99 others); Mon, 2 Jul 2018 15:00:19 -0400 Received: from mail.efficios.com ([167.114.142.138]:59330 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753263AbeGBTAR (ORCPT ); Mon, 2 Jul 2018 15:00:17 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 95B6422F6E9; Mon, 2 Jul 2018 15:00:16 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id kwKDPYS4CbHp; Mon, 2 Jul 2018 15:00:16 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 0B86022F6E6; Mon, 2 Jul 2018 15:00:16 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 0B86022F6E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1530558016; bh=41l1hGE2RoKcMZcMG7RhGdM8b1xVU7R9dcFWpnmpsaE=; h=Date:From:To:Message-ID:MIME-Version; b=NdQN4USayJOcw1c5WIZhiCL6tYwUZb8VP6NlS3n3iryjQYXWtnHSXkP1/wBYegeR3 XiZkZu40Le/MhAApk3RSPiQ7NRyF7NkGBeobbgRIgU2fdHkqozJADaGdbkzs2nZ12M Ue+NFNuFjHO37dXftQ7ZXHqtvVLCJdlVhGJvaj9hulU+3md2MLY8WmBulfccEoFrCj inzTqm0dKVhx5s8cBKsoxpaO770IzU7M6uKRNAWnWlH33xdtV3HwiqtjjNdd1mjuKE jZNAPleCEQoTqLsw3HGRfDisxU2iB2ZBhu5Fn1zRirCgBXOdASeHzcewCiJ8avgC19 hl8g6STXzv+cw== 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 aDfyeMwUnSqX; Mon, 2 Jul 2018 15:00:15 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id E29A822F6DA; Mon, 2 Jul 2018 15:00:15 -0400 (EDT) Date: Mon, 2 Jul 2018 15:00:15 -0400 (EDT) From: Mathieu Desnoyers To: Andy Lutomirski Cc: Linus Torvalds , 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: <84003252.10754.1530558015813.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180628162359.9054-1-mathieu.desnoyers@efficios.com> <247789350.9741.1530288432573.JavaMail.zimbra@efficios.com> <184287091.10022.1530301738384.JavaMail.zimbra@efficios.com> <1527399163.10673.1530541966296.JavaMail.zimbra@efficios.com> 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: sMVSw2nYxUZ+cM/mhjRVRgdtPHn7Sg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jul 2, 2018, at 1:11 PM, Andy Lutomirski luto@amacapital.net wrote: > > But I think that the limited solution of changing > instruction_pointer_set() really is a sufficient > architecture-dependent change to fully solve your problem. So let me recap with the changes I gather for 4.18 and 4.19: 4.18: * Change struct rseq_cs field types from LINUX_FIELD_u32_u64() to __u64 in uapi/linux/rseq.h, * Compare rseq->rseq_cs->abort_ip with TASK_SIZE before using it. Kill offending process if its value is over TASK_SIZE, * Explicitly check that padding of rseq->rseq_cs is zero on 32-bit kernels (#ifndef __LP64__). 4.19: * Introduce instruction_pointer_set() with input validation, use it when setting IP to abort_ip in rseq. This replaces the comparison of abort_ip with TASK_SIZE. Is that consistent with what you have in mind ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com