Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp645654imm; Mon, 2 Jul 2018 19:36:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKn971HqNTHyRDU2MdHmUmaKl7kA6D47A/rE6TsPGCw3xC7jmYfnwPfDZdj/ZXOAh+cjGiW X-Received: by 2002:a63:647:: with SMTP id 68-v6mr24003116pgg.205.1530585398387; Mon, 02 Jul 2018 19:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530585398; cv=none; d=google.com; s=arc-20160816; b=tw4FHwixeqOdByspbrCNHA4T5S2axb5x087JLWnN1JtOblNGfWURw7+8Jx5NywmSSQ PoEgBXLxA78Io6XFT2Tmu1Rr1gH/j9L8eOviFXY/6Jc8Q83bNU6OrN/PHZBZBapGeHlh sSHwN6Fl3HesgvEdw/gtakilDBFYhM7XlIQDs/fpWFmoR6y9cWNuEC2BX+azoGP9emnj VfTGb9HUnBXW7RTK4qTBqweM6CG5vhwj0XRNwEO04Es7cddrYZKlsNbY1iV/Q3xg8i3c zX+fOKtb90kQWyv5nzAdiiIab4bkiLskw/KsP43p9QVvSZCXzhO9c6tsUAt+IiWuXncj jG+A== 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=bgloRoVrRNkcn0xVljkCkBk+raAyGylNVWWmVAvG1Ks=; b=N/FY8jVvx8ouSUmHgfJkz7iu2x0mqbTqbNQdRfb4IMX/V9ExnzviA0FQJCxz3+yVmo 1sBDYp4OhO0K0uJkq6WmACR8Gd7HrvVY1xcpA+4VfWlfg5V/rwFo/sU1qdg8aBBkq6xH P9NN9VjCV1/vVZBmOhDsufO05MKLfz+tBstXdHl6fD3ZuJuex5983m4MwwCOxh/LpZs7 ZnDvOffZDH8WRXn/kCCLKdENcX7uOdSEpzGNqc7DpsScqW6Kwv14uSmBmsU7wMHJkrt7 CO+BUAnl2h7zKFxMvz/rqhJJ9je+6OetY6YkiC2WXNsCAaAXK1TnAF0k9SjWEA1OxItc lUzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=TGGPLpEf; 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 w31-v6si36050pla.127.2018.07.02.19.36.23; Mon, 02 Jul 2018 19:36:38 -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=TGGPLpEf; 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 S932487AbeGCCeK (ORCPT + 99 others); Mon, 2 Jul 2018 22:34:10 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34430 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932309AbeGCCeI (ORCPT ); Mon, 2 Jul 2018 22:34:08 -0400 Received: by mail-wm0-f65.google.com with SMTP id l15-v6so9165216wmc.1 for ; Mon, 02 Jul 2018 19:34:08 -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=bgloRoVrRNkcn0xVljkCkBk+raAyGylNVWWmVAvG1Ks=; b=TGGPLpEfzZRJccF9PNEgL/d83UBZdJgJodcDdabBkY7V4ik3vmcIFgxFMn6iceCJOI ep/ToIyoeg4hCfslgZVleTxzSrTl9U8zIucWBNgC0rQid/nQfltTE11d+RLEdWqleVY2 LN3vKCezk4Ud6eOhvHgrBrsqyZW5jskWDseKPCoWESkU1aoWRh6kY7E4XwGi3AFFsfXk ch25oiTksd0yMR8+N4quu0ZhOWUuWtnu+rJhqFi7BPI+v7STkt9v/6f2fyHhyTwf3U1J 4jqeCQNa8ZTYOtJxo8xcUdrWun+Jusy17mmZt3Zakg5cNfNRES0U9dI4Jdz7OBW23y/u 0TQw== 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=bgloRoVrRNkcn0xVljkCkBk+raAyGylNVWWmVAvG1Ks=; b=ZwDLNzpxvTRt5z+l/5lWcwrFb+keQC1DvKLgcCvNJ1KAWCa6uGx9uPbatLyvaHtJkK vr3fVtV62Dv2cPKQiWktropfb5WxH42vy9uH0P1w9xmvaA5QxfML61r8Slmz0tFZ18Ut amZGOFMCBgRceWq4Z0BvauPwvfAMBhTheetaRjOzbnzIE4W/4wgJiDV4F2O2qs3ul590 r9YdjQDrLNp9q5y4xPBYqU/TPKLop5Wrh7fj2ntC3prPruWUYsNaqLUx8RoVE556nGnw QcaYFNrJoQ7pEfBnGhsLLbSqDv/yCkR4NW3VOdGCQibMwvALf+d7TD5V9+yZ792nZRR2 ZK1Q== X-Gm-Message-State: APt69E32OTJ1rqNkhuszUclIJDcE0XwFmAQbkgXNcnGxwT9IgA986OFb TJajo1nB4McQrwKpkGr8ASQDWddOaZFYICIotBmWNg== X-Received: by 2002:a1c:34c9:: with SMTP id b192-v6mr10070557wma.21.1530585247310; Mon, 02 Jul 2018 19:34:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:7e92:0:0:0:0:0 with HTTP; Mon, 2 Jul 2018 19:33:46 -0700 (PDT) In-Reply-To: <1776351430.10902.1530585009519.JavaMail.zimbra@efficios.com> References: <20180702223143.4663-1-mathieu.desnoyers@efficios.com> <825871008.10839.1530573419561.JavaMail.zimbra@efficios.com> <1959930320.10843.1530573742647.JavaMail.zimbra@efficios.com> <8B2E4CEB-3080-4602-8B62-774E400892EB@amacapital.net> <459661281.10865.1530580742205.JavaMail.zimbra@efficios.com> <858886246.10882.1530583291379.JavaMail.zimbra@efficios.com> <1776351430.10902.1530585009519.JavaMail.zimbra@efficios.com> From: Andy Lutomirski Date: Mon, 2 Jul 2018 19:33:46 -0700 Message-ID: Subject: Re: [RFC PATCH for 4.18] rseq: use __u64 for rseq_cs fields, validate user inputs To: Mathieu Desnoyers Cc: Linus Torvalds , 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 7:30 PM, Mathieu Desnoyers wrote: > ----- On Jul 2, 2018, at 10:18 PM, Linus Torvalds torvalds@linux-foundation.org wrote: > >> On Mon, Jul 2, 2018 at 7:01 PM Mathieu Desnoyers >> wrote: >>> >>> One thing to consider is how we will implement the load of that pointer >>> on the kernel side. >> >> Use "get_user()". It works for 64-bit objects too, and it will be >> atomic in the 32-bit sub-parts on a 32-bit architecture. > > Is it really ? Last time we had this discussion, not all architectures > guaranteed that reading a 64-bit integer would happen in two atomic > 32-bit sub-parts. This was the main motivation for the LINUX_FIELD_u32_u64() > macro as it stands today (rather than using a union). > If you're nervous, you could do this by open-coding: #if BITS_PER_LONG == 64 get_user(...) #else get_user(...); get_user(...); #endif No need to make the header more complicated just for this.