From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6577C28CF6 for ; Fri, 3 Aug 2018 15:09:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A3AE2176D for ; Fri, 3 Aug 2018 15:09:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A3AE2176D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732544AbeHCRGf (ORCPT ); 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-6.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 681CC7E3B1 for ; Fri, 3 Aug 2018 15:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732312AbeHCRGf (ORCPT ); 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-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@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 -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Fri, 3 Aug 2018 17:09:45 +0200 Subject: [PATCH v4 0/7] arm64: untag user pointers passed to the kernel In-Reply-To: References: <20180626172900.ufclp2pfrhwkxjco@armageddon.cambridge.arm.com> <20180801174256.5mbyf33eszml4nmu@armageddon.cambridge.arm.com> Message-ID: <20180803150945.GC9297@kroah.com> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregkh@linuxfoundation.org (Greg Kroah-Hartman) Date: Fri, 3 Aug 2018 17:09:45 +0200 Subject: [PATCH v4 0/7] arm64: untag user pointers passed to the kernel In-Reply-To: References: <20180626172900.ufclp2pfrhwkxjco@armageddon.cambridge.arm.com> <20180801174256.5mbyf33eszml4nmu@armageddon.cambridge.arm.com> Message-ID: <20180803150945.GC9297@kroah.com> Content-Type: text/plain; charset="UTF-8" Message-ID: <20180803150945.IeDeCsygcZgsSut-kFnWgc8sV-5kf1RBMTVxkPPwUfo@z> On Fri, Aug 03, 2018@04:59:18PM +0200, Andrey Konovalov wrote: > On Thu, Aug 2, 2018@5:00 PM, Andrey Konovalov wrote: > > On Wed, Aug 1, 2018@7:42 PM, Catalin Marinas wrote: > >> On Mon, Jul 16, 2018@01:25:59PM +0200, Andrey Konovalov wrote: > >>> On Thu, Jun 28, 2018@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 -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH v4 0/7] arm64: untag user pointers passed to the kernel Date: Fri, 3 Aug 2018 17:09:45 +0200 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 Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-arch.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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregkh@linuxfoundation.org (Greg Kroah-Hartman) Date: Fri, 3 Aug 2018 17:09:45 +0200 Subject: [PATCH v4 0/7] arm64: untag user pointers passed to the kernel In-Reply-To: References: <20180626172900.ufclp2pfrhwkxjco@armageddon.cambridge.arm.com> <20180801174256.5mbyf33eszml4nmu@armageddon.cambridge.arm.com> Message-ID: <20180803150945.GC9297@kroah.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.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