Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp318895imm; Mon, 2 Jul 2018 12:05:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpebqpl9FadcqSzcQl1y1BCgvdJ17TEa1M7BrOWTHPk7t84YtGwSO0x+c2siZBGsgCib6D1w X-Received: by 2002:a17:902:42a3:: with SMTP id h32-v6mr7257509pld.72.1530558301060; Mon, 02 Jul 2018 12:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530558301; cv=none; d=google.com; s=arc-20160816; b=LJ0VRBM3R6AVfQqI49ER0yK/TY0jcmY1wJgbXZ9Ns2Qfyjj8mDaBOWn4EtZ+Re7jZD WB/U8C8D/8atf0k5Ah/DMH45QPXBZu+YOk3kMMfFr0AkIrUESTYd8H7IWK+YOZPif6Hn ua7yj3/+xFal7BDTnxbZ3fgn52os1hYzqJezDVCJANWAR1aDmUTe4Srj5RwD8bvn08xX Okx9B+CwFqHfGg00X5nk5tkf40G33rJjkoHEwUqdu+huaIo0SVIqpb94i8o9soakebmT 4QVWCdafd1nzVv8CLXdXwsORQCD5ElNIbeFfXgFc1yMTQ02z18TA6qwwtxGgYM8EkPfW RlIQ== 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=vVgqrqj3WRFTqYm+MpnoZPNEqzTaFl3kRh36rkTTJ6I=; b=lVFwS0HyBLpn4lADrCdyBEo2ehfzHiX82MyQDABd/92g+YiN51ZFMX7YGWzBl1IO4G 5FMLBAWtfdSSXWdhOAk0oZGcaBgJ0Zp+GjSIdS7Qaf4PlQQ3EKkcbri3iw8oYzEZaPiw MAeHIE8LtiMJOqxaaQecfgideT1MtdEw0awHAJv4Nsdv/RIbrcTacjWIEsoLTlqee0IW tcqC272Dp3YHv0S3VB/nde+H1nRIle97OII27nyF8cncAmei/4tmkizXv/fzHhEC8UK4 XC2XmS0foahN3b6DnQZV0AlAY+t0nlKGWlGQYfbs7bSKSn1YZSVQIHHE5tdgHD3vjMnT g5xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=sNJLmh01; 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 f34-v6si16611177ple.165.2018.07.02.12.04.46; Mon, 02 Jul 2018 12:05:01 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=sNJLmh01; 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 S932261AbeGBTCo (ORCPT + 99 others); Mon, 2 Jul 2018 15:02:44 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:53753 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932213AbeGBTCl (ORCPT ); Mon, 2 Jul 2018 15:02:41 -0400 Received: by mail-wm0-f66.google.com with SMTP id b188-v6so10135337wme.3 for ; Mon, 02 Jul 2018 12:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vVgqrqj3WRFTqYm+MpnoZPNEqzTaFl3kRh36rkTTJ6I=; b=sNJLmh01oBdiEEcxl8pNMjtxoLVa0a3bDYVa4dzDaq8YtgF1VIAPo7nTPlERezqADk wuJ2gB1bac+9FVor4CwkWnOA4l7wCL6EKqxtrT8Xyl5d89mUhOZFjCdusmH/sfFOPmlS BbCPGXx5/Exl7ZZhsbIjzp60/RgLxmeXyFPYQN1pelF/MNPrMOvLvj43+gAvywmilooU hVQZhQSwsZDreoPeYgeZuoe5TMAQuI/wET+eljbLLTv3DPsFKCkwLCPq0536cd92NKMp HXPRqmj2RKV4WDyZzdoI0xxdTxoyyylWOFGmwh1is5prWyl2CMmnUWZ1VF7gC18ZZjza SYgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vVgqrqj3WRFTqYm+MpnoZPNEqzTaFl3kRh36rkTTJ6I=; b=dv50zo3ocVMzbLwcofOUl3pTsfeVkfROpN6fDke7ZvUjSwwFQys0zNw9MCB91Coy3K WRUGT3JNzdIOlB4r8w9dZ78/6d+HBkz/LEGTK3OYZfANeTj9jnH8ntbZqWCxvLuczvCf YXP9KNfIuYSeUfAFDJUvAcENphK7mu9FbqgUxrPPv9IPGqwdghlhfznOM5ezcIwS/Qy7 xxP6xeuDOrjwoDGzh6W0eWc2FIcNM98R200BbnSm4ka485G5n05t+uzLBrMBJDJ0AuRu iwYhYu/2vLHlFvWMtCAWs2fiNFkGpst1EdyvB7XUEGxJeSurjC01dnSnydhHFqpwCT/z eyRw== X-Gm-Message-State: APt69E3/wKUsfSVLjanXSlpageyO0t5kVVidvevdIrIAfiNVpGtKdWI8 wlX+TdtiTm876seq0TicjJwy9d0XldayxsBFThGo1Q== X-Received: by 2002:a1c:8b0d:: with SMTP id n13-v6mr6872531wmd.46.1530558159637; Mon, 02 Jul 2018 12:02:39 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:7e92:0:0:0:0:0 with HTTP; Mon, 2 Jul 2018 12:02:18 -0700 (PDT) In-Reply-To: <84003252.10754.1530558015813.JavaMail.zimbra@efficios.com> 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> <84003252.10754.1530558015813.JavaMail.zimbra@efficios.com> From: Andy Lutomirski Date: Mon, 2 Jul 2018 12:02:18 -0700 Message-ID: Subject: Re: [RFC PATCH for 4.18 1/2] rseq: validate rseq_cs fields are < TASK_SIZE To: Mathieu Desnoyers 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 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 Mon, Jul 2, 2018 at 12:00 PM, Mathieu Desnoyers wrote: > ----- 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 ? > Works for me. Linus, any objection?