Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp509328imm; Mon, 2 Jul 2018 16:07:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLepnAs6y5u23Uv93sT5dRkrfSUZsXvNvz9GTRIT541c3YlVF18qTYfFm7r14oqG2d0soT1 X-Received: by 2002:a17:902:7248:: with SMTP id c8-v6mr27790628pll.128.1530572845953; Mon, 02 Jul 2018 16:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530572845; cv=none; d=google.com; s=arc-20160816; b=IyrWX6vQZsGIRXpW7wu77xGu7SOj/DCIbWomnh7iwcrgdN9Tnp1DFDPombQrtESh0Y EVSCplR6I4NkVH3T5SfRDZ/11NANdV7srKJ2Oyo5xxhLOQRiO/l1I9e0jg6xneszJhqW IM7SRTxNigbHoAWPYt50f5eEeHgvjBOD18cjsc9wtac8p29AjFeCMWjEivgVZyd/9x3W 8VWiO6IWCr+URf4Epli+oDagdc4xJAxu7BvwKNq8t97UfneW6Z/ZxggYAMl7r/YU7hWj IL/LPMRLqifuU4KFUAkIiSg6DQsBkGbae5OBJfvk1vcXmy8G4SyLRS3UBm/F2zSC+QCB P4fA== 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=1dlupA3AzweWiJR1maj1D0qN/TWnz74EeMjLp2yQOPQ=; b=ypd+vjrvNQfXdrYOtH5KA+i83dqE0W4AgdmXP/NoUutbNbsjbAfl12Nr338HlypxcW qtVwJ4KO/RHOVn0WkPsCcufmUIOEMM4zfQve3GXpphPmMfkVHko930WZTMUsr0qRs5Kw oybG8YLTU/VK9hkTQJr/cAja0+f85B/4JHRDMBYxIMMoW5/wTn3e688h6eMPXdDACAoL Eq/v+Nuv/iwsDZ4Uyyj3eDBCTqMf8APjzgGYjfcToMfBORA4+61EYGHEZPO1cpIVnD4h rHJ60dEtvzOxbBFttnVKhk/mWpU7sqF1I9IViGV5pdkNF6CI9hAtKNuYY7BroRs2Oxn2 Hi7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Onp1mEjH; 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 64-v6si17647309ply.476.2018.07.02.16.07.11; Mon, 02 Jul 2018 16:07:25 -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=Onp1mEjH; 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 S1753281AbeGBXGY (ORCPT + 99 others); Mon, 2 Jul 2018 19:06:24 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:38235 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752808AbeGBXGW (ORCPT ); Mon, 2 Jul 2018 19:06:22 -0400 Received: by mail-io0-f193.google.com with SMTP id v26-v6so49610iog.5; Mon, 02 Jul 2018 16:06:21 -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=1dlupA3AzweWiJR1maj1D0qN/TWnz74EeMjLp2yQOPQ=; b=Onp1mEjH4pQqeZhJ4xIVKM9A8L1iK9ycXIZ7XrfTVqqbbuNAVnRXxvQ8by+f458dqQ OUjrNkZZyjBhFNmoaVxwm7ujHN5cL4Z6Ogq0fzs4omR0WKCd6wsUqOF6dCmGo4qrv0LQ JsfcXvN5EYTBlaaPqJXfS0GoIFFK57d54YR4M= 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=1dlupA3AzweWiJR1maj1D0qN/TWnz74EeMjLp2yQOPQ=; b=P7WTjEw/09Fr25dFuG8f2FCCOrHRLvwhLd/12qmG7qkLyZGTZYfwZyreINCJlQlvLl zBPOycqGpbxWjP8GzPdiZTzvy5qNjvnYRMVoyARQbd0o6rHu4Q8kec7ygTjNk6wfFCeG IHs6KUG/1AxR0BPm38x5U+5mABS5jQ7WuYWXkfZUPWppyyD/dRJ6bS2fGnDDUXCJDkKo OGVgyCO/D5mBXs9fuDy1kxLpYWtDow0lFioQnmLO2uEGv2FrUGHgMxgE1HmbTPjdG0Xh kEEzEUmSf0FDdelHmJlMlKKWJyU6W4l7rJPI5ifAjvHy3ltdnhCtxl4isiBgtkO30JFL NbQw== X-Gm-Message-State: APt69E2sN3OgmMvv9GfgBGiAsCcD2rVgkf/T5CdgG1wQC633rFP40elE 6bmfFlffQdTM/lBdvapoFuGGV2BIwO7NlW+/IPY= X-Received: by 2002:a6b:1502:: with SMTP id 2-v6mr23944919iov.203.1530572780926; Mon, 02 Jul 2018 16:06:20 -0700 (PDT) MIME-Version: 1.0 References: <20180702223143.4663-1-mathieu.desnoyers@efficios.com> <415287289.10831.1530572418907.JavaMail.zimbra@efficios.com> In-Reply-To: <415287289.10831.1530572418907.JavaMail.zimbra@efficios.com> From: Linus Torvalds Date: Mon, 2 Jul 2018 16:06:09 -0700 Message-ID: Subject: Re: [RFC PATCH for 4.18] rseq: use __u64 for rseq_cs fields, validate user inputs To: Mathieu Desnoyers Cc: Thomas Gleixner , Linux Kernel Mailing List , Linux API , Peter Zijlstra , Paul McKenney , Boqun Feng , Andy Lutomirski , 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 , 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 4:00 PM Mathieu Desnoyers wrote: > > Unfortunately, that rseq->rseq_cs field needs to be updated by user-space > with single-copy atomicity. Therefore, we want 32-bit user-space to initialize > the padding with 0, and only update the low bits with single-copy atomicity. Well... It's actually still single-copy atomicity as a 64-bit value. Why? Because it doesn't matter how you write the upper bits. You'll be writing the same value to them (zero) anyway. So who cares if the write ends up being two instructions, because the write to the upper bits doesn't actually *do* anything. Hmm? Linus