Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp517139imm; Mon, 2 Jul 2018 16:18:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLg1gvxQBn4ZaxXfWZZ5IS5AA9gdJxJMlcujbqsjux8U9BGCO3QLEkuh5ENdzUYzZYn5PTB X-Received: by 2002:a65:6616:: with SMTP id w22-v6mr23411481pgv.332.1530573505793; Mon, 02 Jul 2018 16:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530573505; cv=none; d=google.com; s=arc-20160816; b=P9rvoE+qtoJX9LOXue+M5UAQdPR8/SmklcWtDMrplQm1dm+v0ktXzSIj9+xd6gjzxc PRZtaexIzKw5z+FZNJ6MDF7XJrITZNQBkAeHknBOSgh2xh6hBxqNgJvdJbDvjQMC6dEo kw81AFZmfXnPVrfaUnAR0ffNzjrdnCOgKc2Y3gkUREG/vOzuPcAq2/Ki44XYtWkOATcO FbGWld5M2g4L+jT7+WNGsJv4/g2yiFhUs7s6pzsWu3DC6bMdLQjQFg42UCUqO7YYVJ3R Ew4prrFUd2FTuttaqi1W6PmWTEWe8YLhrGY1C/7kPlUpPU7hWB7XetEYpQrlfLR9pyv7 8abw== 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=KSKM7pu8Zy4OeUTC0sMdR+VnF7EzwFsiHUkZcAS6zpY=; b=ZHzF480IaAIvSJLn9XOVwIp+JuCVqoshqW8UmipB/npY91Mon/nSKzp1VsSF1tDus8 hQKCJnznH4vsUbDDacuxpiZ4v/FORZt2WBDcjVcmOapcpDrX4UM7hvIys1wrSWjPYzig yWnem+KGZodhz2aVhujEOInKSmC9TA90FOJKuES0Ob0zrziPyyswVAeSBaSf8dAKwABs OZuWNVvlTw8lZ31P7H0dnnr+Zdp/oK8ItDcQa4DyskVcXQU883tw3rnxZzEOoxS9TRq2 +tr1pbjoTrhwU1tvSrYMunQkZ7TjTUZHe5ZhnRpRAaUK+5uqSukmpR7aPJwhNsEsuhAJ kz0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=Bm0yzJwh; 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 r28-v6si3027887pgk.458.2018.07.02.16.18.10; Mon, 02 Jul 2018 16:18: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=@efficios.com header.s=default header.b=Bm0yzJwh; 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 S1753445AbeGBXRD (ORCPT + 99 others); Mon, 2 Jul 2018 19:17:03 -0400 Received: from mail.efficios.com ([167.114.142.138]:48940 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752860AbeGBXRB (ORCPT ); Mon, 2 Jul 2018 19:17:01 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 96FF322FD71; Mon, 2 Jul 2018 19:17:00 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id yWHPsSq6uwkL; Mon, 2 Jul 2018 19:17:00 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id E0F6122FD65; Mon, 2 Jul 2018 19:16:59 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com E0F6122FD65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1530573419; bh=KSKM7pu8Zy4OeUTC0sMdR+VnF7EzwFsiHUkZcAS6zpY=; h=Date:From:To:Message-ID:MIME-Version; b=Bm0yzJwh4uN9BtB2yv2i3TjdCyR10NjGAaSGjmgvCcdSL+XO/7XX72QUrInt55Psm +S04JrOZcZOvGgSPnfjQL9lwnH1sb132SMUhSO10aAdjDzuj6ytBJ6xN+FdNV++doE r1chfXN9M0ihhpZ1wufFEXUS35UbDD+3e2pifOkU4WEfUe4G/D5skswOBQzzkXFZdk 1h1pPF6p6chIh4dK3viHCu86TsFXNvNfg1lb2Wj4Q2RkeHSutF5utq4F9mSRyTaHfy 2OuI8JfDRNtjXcdFsl1dycUYQS5Xnb8AjVwjwBQ506DQ/w5qIvbnjfK0esOHPX/ONZ IMZnl1lqqXZyA== 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 8i-EZ_w6V4Sc; Mon, 2 Jul 2018 19:16:59 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id BFF7122FD5F; Mon, 2 Jul 2018 19:16:59 -0400 (EDT) Date: Mon, 2 Jul 2018 19:16:59 -0400 (EDT) From: Mathieu Desnoyers To: Linus Torvalds Cc: Thomas Gleixner , linux-kernel , linux-api , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Andy Lutomirski , 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: <825871008.10839.1530573419561.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180702223143.4663-1-mathieu.desnoyers@efficios.com> <415287289.10831.1530572418907.JavaMail.zimbra@efficios.com> Subject: Re: [RFC PATCH for 4.18] rseq: use __u64 for rseq_cs fields, validate user inputs 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: use __u64 for rseq_cs fields, validate user inputs Thread-Index: SHiTQe7XPSOexphG2GWas6EadgayhQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jul 2, 2018, at 7:06 PM, Linus Torvalds torvalds@linux-foundation.org wrote: > 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? Are there any kind of guarantees that a __u64 update on a 32-bit architecture won't be torn into something daft like byte-per-byte stores when performed from C code ? I don't worry whether the upper bits get updated or how, but I really care about not having store tearing of the low bits update. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com