Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1853583ybb; Fri, 29 Mar 2019 12:43:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJYk2zG3u8wQhm52Q+b1b3L3e1s0ZNiHP4KodJkFQe4FL83lius2JvywkcQ8dDmQ1yW53o X-Received: by 2002:a17:902:b181:: with SMTP id s1mr50225392plr.321.1553888591118; Fri, 29 Mar 2019 12:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553888591; cv=none; d=google.com; s=arc-20160816; b=gtUeQ74uGqYqT3wmPbUUqqddxsFK0neY0mH/MjcHotbYFxqSkIqfNhaeUaGTE5mDeO XE0G3LUtN4CbKyk0Ro4m5r+zLqhyr5P1ITp8myGU5r60ucUcOgEyr5firtSz6lqdFqEK 5ZmfFJaBsMIHzinCaqeKSxBcHoFjLIe6v8uRtnFYQtg8IRiOAEMAuG5rtECcDlK80vM7 3tM/CMSZxL0o8h0MPoevywzQOS2NNMKEgwwscZ6f+tbZyZe8Od1q9dFsLAVM0GrYDed4 C2mJ4zkOTPsRYZeU4WfT6rUDx4JhNlrJOO1HlM7/pEz/znTEKQz5/+5C22RXYn9B/tYU 5gRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aOqdBMixIgHX/ynJuPOtIkUiPeq0t3KwbOuxnBzeA/4=; b=GBjj34qM6koqJGRBxgGZ1TAK/cNTOV4B5MfBcetP6tZW5uCSKAMqjLdVGb1J3gz/W/ sYgP8rA2APlc6ksnPYJYpSgpS9NEqCadJNiBHDf4PQzUwTCfD/cfayTiWq+ngqM8w6q4 5VnHeoXKnKJczWMNIfbAlYqkSg5w1JmsImFQcgFmg4slVttD6NJ7T1DA+A+CQKjTucFL trJ3R0dbxeQjmqauMkjEKv/gakpjDwEDUSDBe1Eteaqif2UB6d4r/1W3ZmrE8UcPOmn/ krxWHvEtadyZOkEMfbIRtRbqj2q0Aco1+f1Vpk/96cbcADh4kdn9UyKsX6td3VpNq4wt nbNA== ARC-Authentication-Results: i=1; mx.google.com; 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 h29si2581600pfd.180.2019.03.29.12.42.55; Fri, 29 Mar 2019 12:43:11 -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; 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 S1730028AbfC2TmR (ORCPT + 99 others); Fri, 29 Mar 2019 15:42:17 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:39304 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729652AbfC2TmQ (ORCPT ); Fri, 29 Mar 2019 15:42:16 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1h9xOC-00078P-WE; Fri, 29 Mar 2019 19:42:09 +0000 Date: Fri, 29 Mar 2019 19:42:08 +0000 From: Al Viro To: Jann Horn Cc: Luc Van Oostenryck , linux-sparse@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , the arch/x86 maintainers , kernel list , Qiaowei Ren Subject: Re: [PATCH v2 3/4] x86/fpu: Fix __user annotations Message-ID: <20190329194208.GE2217@ZenIV.linux.org.uk> References: <20190329163047.223508-1-jannh@google.com> <20190329163047.223508-3-jannh@google.com> <20190329180329.hl3t7a43sg3sshsf@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 29, 2019 at 08:25:25PM +0100, Jann Horn wrote: > Oooh, it's a sparse bug. It's *not* a bug. > Apparently it's significant that the user pointer is stored as a > __u64, and __u64 is defined as unsigned long long. Yes, it is. Casts to uintptr_t (== unsigned long on all targets) are OK; any other arithmetical type gives a warning, and quite deliberately so. Don't do it. If you want to say "I'm converting it to integer, all traces of its origin are gone", use an idiomatic cast.