Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp597542imm; Mon, 2 Jul 2018 18:18:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKc15BTrZA5WlCPnPprmIriP9GqLlYEyU5iG/mnNqFauS1L1qOshxDvx77V9l3bawcm5NnV X-Received: by 2002:a65:4aca:: with SMTP id c10-v6mr23509904pgu.327.1530580715513; Mon, 02 Jul 2018 18:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530580715; cv=none; d=google.com; s=arc-20160816; b=D9eJEIMv0Y8I8hEVM9iahF0G5ZWnX3a4+k67qOh6cIdGooT2g+sGl8/j1KlM6fyG92 vwc/rdTq55CQxdjL+Q7PRk1WUc290qXj1I8Wi/osd224uJU2AGAp8FsqmGXtPYDKp+ct b5IOSy5Im/WEg5rHrNh7JD0m3cG1kpLeDMZ8Q27vMci4IxISdoOKlbtn0s7Ek/l7oq3w sfDXobI22Rn8Gm/qZPoXf0q5fECeiTSvDDNiQzZAub+UD7SQZQt8yiIKkS4GMmU7MvLw 8BZVHF0VleO1AfZ5mySnfVXK5ZEEJJS6qhMJdKVgFMzGchiJ7CkRKmZd4crNtFxKO/SS B3Ng== 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=KPfGng9a7kMU+tLJlHy8m1sdd/vM5MI+qTBPl4sv6Vw=; b=Sh4L67wtkHs81p+u5kP2XPr3WAV3SaGFKfbuGCZ/pU2pryOzB9g8uk+83+7LF1GXjm +SNKjXk0pCsydoRi/Oh5MlPHnNyiks1mH2/G6KLAWaG3OkNBmZbbh/Jt7R3hHzUs8hCd xk4ZX/MPsBSK8mVGlobGPj6/dcqLreFOJE0DqBHktbqEqdEGX2w3hSufky3ciyUdpYyH Q8E6NGzWfRG8LrtxqO6s+oLKxUOZ37osMeUStzInIT0Rkgs3DYqSoI5XTnAuCVjNdmyk PLtjLwath5bQZc7dSMyOsJ0DL/CNlQRJ0lLS62J/fQSqfsLVFEMDPCeNQdpwqJ6O/NQa ltHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b="ahK/wGSQ"; 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 n34-v6si17517006pld.91.2018.07.02.18.18.21; Mon, 02 Jul 2018 18:18:35 -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="ahK/wGSQ"; 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 S1753560AbeGCBR2 (ORCPT + 99 others); Mon, 2 Jul 2018 21:17:28 -0400 Received: from mail.efficios.com ([167.114.142.138]:56078 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753155AbeGCBR0 (ORCPT ); Mon, 2 Jul 2018 21:17:26 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 6D93022F559; Mon, 2 Jul 2018 21:17:25 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id rCcg4ejGQAEo; Mon, 2 Jul 2018 21:17:24 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id D71EC22F556; Mon, 2 Jul 2018 21:17:24 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com D71EC22F556 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1530580644; bh=KPfGng9a7kMU+tLJlHy8m1sdd/vM5MI+qTBPl4sv6Vw=; h=Date:From:To:Message-ID:MIME-Version; b=ahK/wGSQYmwma0Q1eWTXqULP0bmbcwXgW5LNyXt+3i5SGPtgU5Wa4hj9qT61Ysf9j 3alDYZPxPP8+/cLBbBcls5eT70z0AVJxtH05XcIu1OHaMnQrY8ol4IXxblmXgEOy9f BiF4QgCBHzx5QIct/Nq0UCOzFq6wa0e4CASd1V+vYKpUQvake7Ca9nBtVSmtoHj+zj NBG7gg5OPMQINSIGY02/e1OTAtmrdCKbL0okzZHIilJC92qUGGBp06zzoJ7REau+IE 9KCyBIvB2nK/ZC0DosbRSbHiB6XaG8erdbysId2QHHNCqjaCNuNsTbSckIGKmGi00p sDfEAMlrRL/6A== 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 31pGN52aD5RW; Mon, 2 Jul 2018 21:17:24 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id BB95D22F54C; Mon, 2 Jul 2018 21:17:24 -0400 (EDT) Date: Mon, 2 Jul 2018 21:17:24 -0400 (EDT) From: Mathieu Desnoyers To: Chris Lameter Cc: Linus Torvalds , 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 , Ben Maurer , rostedt , Josh Triplett , Catalin Marinas , Will Deacon , Michael Kerrisk , Joel Fernandes Message-ID: <1341786193.10862.1530580644566.JavaMail.zimbra@efficios.com> In-Reply-To: <010001645d90c295-71d0a2e6-d5ce-4b8a-a60d-5d66fe17c8b3-000000@email.amazonses.com> References: <20180702223143.4663-1-mathieu.desnoyers@efficios.com> <415287289.10831.1530572418907.JavaMail.zimbra@efficios.com> <825871008.10839.1530573419561.JavaMail.zimbra@efficios.com> <010001645d81f652-8a506dd2-cd49-47f9-950a-24ef52bda9f7-000000@email.amazonses.com> <1020760632.10855.1530577391822.JavaMail.zimbra@efficios.com> <010001645d90c295-71d0a2e6-d5ce-4b8a-a60d-5d66fe17c8b3-000000@email.amazonses.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: DUJOEUdf5vsg2kaxzc2AM9OxRCO2+g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jul 2, 2018, at 8:35 PM, Chris Lameter cl@linux.com wrote: > On Mon, 2 Jul 2018, Mathieu Desnoyers wrote: > >> > >> > Platforms with 32 bit word size only guarantee atomicity of a 32 bit >> > write or RMV instruction. >> > >> > Special instructions may exist on a platform to perform 64 bit atomic >> > updates. We use cmpxchg64 f.e. on Intel 32 bit platforms to guarantee >> > atomicity8. >> > >> > So use the macros that we have to guarantee 64 bit ops and you should be >> > fine. See linux/arch/x86/include/asm/atomic64_32.h >> >> We are talking about user-space here. What we need is a single instruction >> atomic store, similar to what WRITE_ONCE() does in the kernel. The discussion >> is about whether doing the user-space equivalent of a WRITE_ONCE() to a u64 >> on a 32-bit architecture should be considered to provide single-copy atomicity >> on the low 32 bits. > > Right. You would need to make this work for userspace. atomic64_32.h is a > good reference as to which instructions provide 64 bit atomicity on 32 > bit platforms. We only need to update a pointer, so we don't need 64-bit atomicity on 32-bit processes. What we need is to ensure single-copy atomicity of the 32-bit pointer update on the 32-bit process in a field read from the kernel as a __u64. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com