Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp422213imm; Thu, 28 Jun 2018 23:35:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcBbg30vKGk51mGhcaAFVWHl7zMczZI8MjadfFl3AJw1XAgLrbK65RmZEQN14R5PuGj2ool X-Received: by 2002:a62:3481:: with SMTP id b123-v6mr13192818pfa.4.1530254146924; Thu, 28 Jun 2018 23:35:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530254146; cv=none; d=google.com; s=arc-20160816; b=patAtQ0d6KpPQQIeaCGVWyyjAna+5wjVALg/xHxBPLNhP04R4BwYAKNWAs62w7nCTZ HHSZ9uOU2niegQwX7DRpA5HpDwA0vJxIWbJs7DuW5hoex6zI2vo/GCp9cqbKK4GScQ6K Aimx4lfPHQu9aNeRukS6aOO32y/9bg/r52evOoYJOA5qq9HLf1kAKSRdYQoBYCJr1IsT oqJ/ek1FY/ralbMXdC4a08VVj9bvnkcF0tom4cXwBgiTALjzTx//4rAGncHm0G0F2Lfq z4Tr1XWXYCf2cYdQaQSiTkA03LopHpNKsEBx6jbG4FJ71ZcEAuD/AVAHtQFxaPUba61o qsbw== 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=2aRCpAgCcd0NQt6EShYSQfT3/P6w3x8WNNZ4CVcsfh0=; b=j6fO2UNXzkLRtgT3jzpnFk7CzwH1xMCPRFRxtb1waUOp9LED9mR0+N6Fol+fij0kiS 5UZdSFbrhn9XfxlvdJyyJR9WP6NcP0fTPtZRJ37BvmALcPVL0coY5Vt3kBsSzxaY4r8I dci4fC6J4AesGAk76bJnMUHSPyPgkB/KnYczUgGNIY2UZx5WEpwhGVOZVcJHnHMorhWX KYcZrbf+ndboXERyFzcf4TOy3OfKbLhgVNPjz6FgTf5nLngBSDIi+Fu/YTeaeGalLB9q 7bxJg68gQwYwY9RcL0BmgWelJl1USELcN04/Q041o0+9enPYZSg3tdoCjBgv8UePTAQb 7t+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=f1cOGhGF; 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 d11-v6si8371207pla.184.2018.06.28.23.35.32; Thu, 28 Jun 2018 23:35:46 -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=f1cOGhGF; 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 S936418AbeF2Ayv (ORCPT + 99 others); Thu, 28 Jun 2018 20:54:51 -0400 Received: from mail.efficios.com ([167.114.142.138]:37190 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933008AbeF2Ays (ORCPT ); Thu, 28 Jun 2018 20:54:48 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 54E2422EA2E; Thu, 28 Jun 2018 20:54:47 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id mfij72EvQCZN; Thu, 28 Jun 2018 20:54:46 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id BB54822EA2A; Thu, 28 Jun 2018 20:54:46 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com BB54822EA2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1530233686; bh=2aRCpAgCcd0NQt6EShYSQfT3/P6w3x8WNNZ4CVcsfh0=; h=Date:From:To:Message-ID:MIME-Version; b=f1cOGhGFYFH0Vy9HE67LPnC2F8BD/+ur/g6p6gBeBvgnaG7Rj8bS4GqZitIYJqbIc X7CrfQSrG2GbNzoubptLnu7A+Wt+kiVwgs3IB5y2efiscAQ5lMBPa80BarRhTyf71+ 3+jx7jO0erFu53b8BNkm3gkGsi+LF2aMElOCajmGdS7mqhh0Tr/NugdIsBHEswgMxl cW1yZzAhJAdMu6JScaQd3RSBQxs6ppuUN0BJLReWIfogYEsJn0tpvnp4kYaao9P4pU nNyHtGzA8BTSk8rgKa7Cof9hG9OO+43qt59NPmDVWB5JyXaxIWIAgEzEuxpFjBf9Ev ibdsKXHTGzM8w== 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 i8gpuH29ZuRj; Thu, 28 Jun 2018 20:54:46 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 9CA5B22EA14; Thu, 28 Jun 2018 20:54:46 -0400 (EDT) Date: Thu, 28 Jun 2018 20:54:46 -0400 (EDT) From: Mathieu Desnoyers To: Linus Torvalds Cc: 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: <665398433.9488.1530233686432.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180628162359.9054-1-mathieu.desnoyers@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: Ni+KcT6w8fHZnMfOQpG8vowZ5X/7cg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jun 28, 2018, at 8:18 PM, Linus Torvalds torvalds@linux-foundation.org wrote: > 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. This assumes a 64-bit kernel returning to a 32-bit compat task with garbage it the upper 32 bits of regs->ip behaves correctly (e.g. kill the offending process rather than crash the kernel) on all architectures. Is this something we can rely on ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com