Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp582972imm; Fri, 3 Aug 2018 08:11:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfudOa0Kkcbg9HCQ+6aW9V7lswPKnc+WlXCLylpPIIYDkQhAL/jxz4PgjuBGOZzQ1Wj07DL X-Received: by 2002:a62:591a:: with SMTP id n26-v6mr5023199pfb.94.1533309087688; Fri, 03 Aug 2018 08:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533309087; cv=none; d=google.com; s=arc-20160816; b=sGL8nX3Nz9ONwoOVCU9H7M5BWqfxspkMOsF3iYzMgCxub8IU5C9VKZsoIsg3PNvQtd 00ksAN1iLIBV598KNVVAg/4Xm8N3r/IJ+T2N7uehyQ6ujHYS5teJWgcjkjamtng7cDTA 2PwH1QEQiTLStqsybubhynZTs/fZ80YsUIjcpJFx5qcYA4O2r57bNRB06beHgB6ciJCf zFcHIZfyvbdcveK3l0Xh2YgWEj4qtKEcaXcCggAmZ/hv/kCYiICMnAWuipBD9T8ONBPC LLOOlnwQ303hl//iEAJUx2/+E6NQTcGTCPw+7OE/TiLcENTTClfbnj8LpOzm25xOmDAZ dPiQ== 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:arc-authentication-results; bh=WQAeDjWtCfkUFX3SeHunAClRgYE6qpyLBOF/ueWp7aQ=; b=C5fU7kOvX2z6hMt35YWj+sb2mQct/Axj5hkiAgGW+Skq1DC0hM5ci6W/8tGn1tZyGM 8YaQeEF15PmjsbfB0niT6hR9eKBqrVqxSlUyEDW2o3klFy6Ot27/ZdJei04hugIfOrZ/ IzJC2aP+q4S1z7srS2PIeEBokNaIOYcQxlsL0rbxgaw+/9y0fvrHqzDAJirddzqYoHum vQEO7lexHPzy5NWRb2Dj8EIdBGnThj55HcR3hA3Rtop+DE7oFdXa/UnB3uYVgyNnq+aU 6en7mAmv9vjDra4xWW5o/IYVHvv0oIwSMaPzkD3xZ4++i+Xt0RkzeFjoqb5zJLLT26nq Q8EQ== 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 f24-v6si4953855pgh.287.2018.08.03.08.11.12; Fri, 03 Aug 2018 08:11:27 -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 S1732540AbeHCRGf (ORCPT + 99 others); Fri, 3 Aug 2018 13:06:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32878 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbeHCRGf (ORCPT ); Fri, 3 Aug 2018 13:06:35 -0400 Received: from localhost (ip-213-127-46-170.ip.prioritytelecom.net [213.127.46.170]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 771C13EE; Fri, 3 Aug 2018 15:09:49 +0000 (UTC) Date: Fri, 3 Aug 2018 17:09:45 +0200 From: Greg Kroah-Hartman To: Andrey Konovalov Cc: Catalin Marinas , Mark Rutland , Kate Stewart , linux-doc@vger.kernel.org, Will Deacon , Kostya Serebryany , linux-kselftest@vger.kernel.org, Chintan Pandya , Shuah Khan , Ingo Molnar , linux-arch@vger.kernel.org, Jacob Bramley , Dmitry Vyukov , Evgeniy Stepanov , Kees Cook , Ruben Ayrapetyan , Ramana Radhakrishnan , Al Viro , Linux ARM , Linux Memory Management List , LKML , Lee Smith , Andrew Morton , Robin Murphy , "Kirill A . Shutemov" Subject: Re: [PATCH v4 0/7] arm64: untag user pointers passed to the kernel Message-ID: <20180803150945.GC9297@kroah.com> References: <20180626172900.ufclp2pfrhwkxjco@armageddon.cambridge.arm.com> <20180801174256.5mbyf33eszml4nmu@armageddon.cambridge.arm.com> 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, Aug 03, 2018 at 04:59:18PM +0200, Andrey Konovalov wrote: > On Thu, Aug 2, 2018 at 5:00 PM, Andrey Konovalov wrote: > > On Wed, Aug 1, 2018 at 7:42 PM, Catalin Marinas wrote: > >> On Mon, Jul 16, 2018 at 01:25:59PM +0200, Andrey Konovalov wrote: > >>> On Thu, Jun 28, 2018 at 9:30 PM, Andrey Konovalov wrote: > >>> So the checker reports ~100 different places where a __user pointer > >>> being casted. I've looked through them and found 3 places where we > >>> need to add untagging. Source code lines below come from 4.18-rc2+ > >>> (6f0d349d). > >> [...] > >>> I'll add the 3 patches with fixes to v5 of this patchset. > >> > >> Thanks for investigating. You can fix those three places in your code > > > > OK, will do. > > > >> but I was rather looking for a way to check such casting in the future > >> for newly added code. While for the khwasan we can assume it's a debug > >> option, the tagged user pointers are ABI and we need to keep it stable. > >> > >> We could we actually add some macros for explicit conversion between > >> __user ptr and long and silence the warning there (I guess this would > >> work better for sparse). We can then detect new ptr to long casts as > >> they appear. I just hope that's not too intrusive. > >> > >> (I haven't tried the sparse patch yet, hopefully sometime this week) > > > > Haven't look at that sparse patch yet myself, but sounds doable. > > Should these macros go into this patchset or should they go > > separately? > > Started looking at this. When I run sparse with default checks enabled > (make C=1) I get countless warnings. Does anybody actually use it? Try using a more up-to-date version of sparse. Odds are you are using an old one, there is a newer version in a different branch on kernel.org somewhere... greg k-h