Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp832997img; Tue, 26 Feb 2019 09:19:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IbknmrdACZvkMrKugQJ86iBNac0iXV9Dv+0w9jweaht1T9f6qDoVFuA40FoadPPHXnO4pjb X-Received: by 2002:a17:902:2e81:: with SMTP id r1mr26128627plb.278.1551201582466; Tue, 26 Feb 2019 09:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551201582; cv=none; d=google.com; s=arc-20160816; b=xc2gxztHKIaY94RTAYw/BbJ//i2REdiKyruXeZ1Dplowzjvf7FpIMy+wCO6oevD6wU TokiqB0iywGLnaW+b0iUQlOrp2HnpdmNcpj8MJRdqlF6Im1GQNJi/tVEF4LvCgaSrkL9 PXG3GQNIiI3It3yF7oPaLRIFr402SBYWbk6SmyLcybFG2yCguboLVCkA4jLeGKW9Pnyv 6jXR0axtn8XEXT2mHuOwlh+3L2lH4wyDPIDKhzbYfaCf8IC3Ccxef9lQgrEVlAjPziIb p6tLHtiNiVvAdEqRmDwBSTt8DC2pJk+hbTkpP8vZA6pYahum7DzbpDzPtqatmPU2xXY5 kQ/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OOLLQFuNWZNcLbvoTKuul2PBnwLCZZV2yl5Rkby6ik0=; b=WFv8f/Jjs+qaQoSjJ1f0XqK9KruA8uSw4DMH1hFHCzZ3jS7zbCvKwk/B/UacS0PH1H Ptq5+ddFtTtNHXK+wiIeVBcHRtnkr/58RpCamQ2CXFXr0uBRiOKxjzj5lvwRE38VzS3M d5DtteESOV1JNpgwb10kQhserrpeumETV+aMdsGxA8bJisqZ9rY/H5zAZzmppIEkdLQZ 7TjKK19KzQ/esC3/Jox7W4idH6VGSsKx/GFANFsCpSLxDMCPOxS0iQdjYQThhdHMivqV O5QbxYDuJXK79TJ57ezy3GU0lbEEAKutQMEfJ0gTGzDRBRQTl4eyyvtVVhgrCMP39fFC pJ3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="jKQxnJ/2"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17si12312239pgv.39.2019.02.26.09.19.27; Tue, 26 Feb 2019 09:19:42 -0800 (PST) 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=@google.com header.s=20161025 header.b="jKQxnJ/2"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728462AbfBZRSi (ORCPT + 99 others); Tue, 26 Feb 2019 12:18:38 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37281 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728341AbfBZRSi (ORCPT ); Tue, 26 Feb 2019 12:18:38 -0500 Received: by mail-pg1-f194.google.com with SMTP id q206so6518704pgq.4 for ; Tue, 26 Feb 2019 09:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OOLLQFuNWZNcLbvoTKuul2PBnwLCZZV2yl5Rkby6ik0=; b=jKQxnJ/2x4dghTfRCCMI3Ml+fWRz4qrTqCcicLGZ011UNcos0yKVjUpXrkbq1VSVeW thw1sbzK7pCfkew2gQKrUI4Um5IJtqCZYZl1rRF7/8YMUzhpPVGNh8aOoaGrih+yhLcy LCoJSquWccU9cGAkJnes4V09W4/XvNYzxNcibfJSCuI99Gg6RPHY5pmjvUZ1DuZqFDit ziJwyd/cyIJEi3eTWqcjGCyQMJaZAOTApXtCDMV5IOpvOaGfw5zzajED6bFcBJNSmM3I YcDKPQPB7vjE9vMtguW2z7/5cxVHfa+F/TkDtfCUR0jZU+bpcDyeyF4vkjHEHWHZXTfm OCaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OOLLQFuNWZNcLbvoTKuul2PBnwLCZZV2yl5Rkby6ik0=; b=qX4IUxWyee0/I/cPiNW0P0xsMGIrmu1/rl/nkudeK3lKfbqNBy3G3/8fkBUaV5w9jA V6kG2fl7rGc/8t9qoxbHQhuAaaOkoqshbOPCshlr3fhEMpvAdMzPlFrQ2Pswmwem7Ran xNcFje3J2Tn7PhqRIJsz3jt8bUOCXUPRZapWdDAFAlxPIlwNeOOMZzfydFXUD7MNGxiC /gn1pt2kvqCRgTGODrqqY81GHZZWWTDect1TBMLn1uP1u5coCV4UlsSLmyf3HnFBZbvB dZow3SklzMm4tAwajMDTRmxPDylkqyhkVO+AbTrEPIh0Mt+e14Y7IShPJc1eHH53gMb2 /V9w== X-Gm-Message-State: AHQUAubbYWuZcMss3XR9uKFXne4i26LNfV6vUclYvBbFB3yxIyjhdc1G RosoMvLljXh/pwmedbYKfmfweRf2BcPk44w4V3K+OQ== X-Received: by 2002:a63:d80b:: with SMTP id b11mr25226432pgh.168.1551201516864; Tue, 26 Feb 2019 09:18:36 -0800 (PST) MIME-Version: 1.0 References: <2ad5f897-25c0-90cf-f54f-827876873a0a@intel.com> In-Reply-To: <2ad5f897-25c0-90cf-f54f-827876873a0a@intel.com> From: Andrey Konovalov Date: Tue, 26 Feb 2019 18:18:25 +0100 Message-ID: Subject: Re: [PATCH v10 00/12] arm64: untag user pointers passed to the kernel To: Dave Hansen Cc: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , Vincenzo Frascino , Linux ARM , "open list:DOCUMENTATION" , Linux Memory Management List , linux-arch , "open list:KERNEL SELFTEST FRAMEWORK" , LKML , Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya , Luc Van Oostenryck , Dave Martin , Kevin Brodsky , Szabolcs Nagy Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 22, 2019 at 11:55 PM Dave Hansen wrote: > > On 2/22/19 4:53 AM, Andrey Konovalov wrote: > > The following testing approaches has been taken to find potential issues > > with user pointer untagging: > > > > 1. Static testing (with sparse [3] and separately with a custom static > > analyzer based on Clang) to track casts of __user pointers to integer > > types to find places where untagging needs to be done. > > First of all, it's really cool that you took this approach. Sounds like > there was a lot of systematic work to fix up the sites in the existing > codebase. > > But, isn't this a _bit_ fragile going forward? Folks can't just "make > sparse" to find issues with missing untags. Yes, this static approach can only be used as a hint to find some places where untagging is needed, but certainly not all. > This seems like something > where we would ideally add an __tagged annotation (or something) to the > source tree and then have sparse rules that can look for missed untags. This has been suggested before, search for __untagged here [1]. However there are many places in the kernel where a __user pointer is casted into unsigned long and passed further. I'm not sure if it's possible apply a __tagged/__untagged kind of attribute to non-pointer types, is it? [1] https://patchwork.kernel.org/patch/10581535/