Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1674150ybb; Fri, 29 Mar 2019 09:03:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUYh+Wfn2GibsYChQZvo4MXKukaTUo0tUufiedxmGbKP3iCFd7wc+T6Mkx4XAVD70NXMw8 X-Received: by 2002:a63:7152:: with SMTP id b18mr38358628pgn.186.1553875415635; Fri, 29 Mar 2019 09:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553875415; cv=none; d=google.com; s=arc-20160816; b=Ym1x91qSnt6sQKkvjk9xCfy0mmTIbpzpal4vjzH28lIiiXvg1wHC21Ijxhv28mXRYg 8OPEp28bkLaBBnEE4PtMaRJMBdFm+b4II21XTFcsWrga+fsNVKm6gLRhuTCz1LlAeeut +4OGl39rmYWlRcfFyuco0wSrYAyiejrF201XdiSenx+GuYdQMVewgR0AbQB5q/JAKJ7e 1FeJVfzcGTvxhGbMhp9mLzDywZTVj9rcbVnliyxgCFsjAVeu8LIFp7+gy9L46Uc+EHBQ XkWJX+TS7wOu2ZRwh8xlrCOmcCcWXR9MdlxiIiBAsV+4bBPPODz33juRnRWtnH/ZJXnt cGyg== 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=gZocI1SHIOi+y+CZmlS2EmaUnqDOacK/vDCn4VI5GrM=; b=l9A41m3BA2WIrtAHEeXJAFgyMaYwsB/b+rspSTqkTFY8fwxmcMbVO11mqVjaEboOWA 2AcS6jbt4FIDnf0n5ZLPxarg2P0QB/RXZQw90bf0al+IBAt7H/waxx3IsFAIHRYjO/J+ HglGDmHmsaocDTNE+YdjN1dJrLsDc0rWgAd8JYHlkfGAqqFQNjMIyor1uui7fZS0WpXK 9wYu5WrlcLi401Py2xen6AIeCjeOAi9LpcQYJi0/guNlTL5Ew//JkTxdC4kG3w4a3AgM YLNGaNq0Hw36Pm4RrnKvSh4gqkUv/og9NrJiZqzJsZgKI/H5xd0P3M6uJaSxtOwlI7rO GSag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JzgR25kC; 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 d2si2348414pld.110.2019.03.29.09.03.20; Fri, 29 Mar 2019 09:03: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=@google.com header.s=20161025 header.b=JzgR25kC; 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 S1729715AbfC2QCe (ORCPT + 99 others); Fri, 29 Mar 2019 12:02:34 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:37231 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728961AbfC2QCe (ORCPT ); Fri, 29 Mar 2019 12:02:34 -0400 Received: by mail-ot1-f67.google.com with SMTP id c16so2576879otn.4 for ; Fri, 29 Mar 2019 09:02:34 -0700 (PDT) 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=gZocI1SHIOi+y+CZmlS2EmaUnqDOacK/vDCn4VI5GrM=; b=JzgR25kC4l++7jTABaN2rrKfoz+i48okcWfMkYR7hmO5IFY8sx/LcuEonBUkP0/0dZ s7YNniyP3nNQGfxt5sNp/E19XK9VHFYNR85hlCAix8pjXSOACpRtCVivcW5bqPUegl0+ 2bufc+FYmO+24EwOl9bIrS6S/KmeJ+eNWv2fuGQ0arI9QUSm6UgHM5fPmExFNDsnAaJc +ZSL8N5uh5woYa8iQZnODLnf+/Vy1hIGn/frlRm/xYFjJD/GTrhx9rMZvEp1zxy9UPWH V+VgZJvImfEe2tGVqwAWxl7h176E6zVdaxUdRi6oI5yEdV9aIFVubUR0svK8TJXAE3tM GQPw== 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=gZocI1SHIOi+y+CZmlS2EmaUnqDOacK/vDCn4VI5GrM=; b=DBRWkDYjdem0JeQ8DIzge/U6vNSHZJ/5lGISS87YUZo8whdja7moHBBzARqy2vN3Tb FK3kBQDrsTwaxt3USZKwfwvl/zi5zr/4nHABEJpbxPuIDG8k+GZV7sLEXLXktzM7Ki2j r5oWR2JzSLkNq1cvU8+QehMPqjj51CXcNlpIqJLY8HLdhA4uRUXUxsNjfedAsM23eqD8 eJaAFYP6TN1Dc8p+gwLa0APb5eJzMn6BESemGJ76yIazn3Xy7qZe86ECutIbLqyHbhbh 0XzMW3NAR2v7wteqLToSs88iNWGk866lgAZfRKBUbmsCmVZEvTReFcSj1Ujkf/6ValRg rhGg== X-Gm-Message-State: APjAAAXee3E32W5cuggU2E0v3AuRoQfcSoWT1BleW9tQ10BF+jRVn8HF nGdHUVCTkKUWhXh/3PO3+8zziMhhLzpPSvLKoIY+wA== X-Received: by 2002:a9d:694c:: with SMTP id p12mr34273929oto.242.1553875353202; Fri, 29 Mar 2019 09:02:33 -0700 (PDT) MIME-Version: 1.0 References: <20190328212321.92463-1-jannh@google.com> <20190328212321.92463-2-jannh@google.com> <20190329133956.GE21152@zn.tnic> In-Reply-To: <20190329133956.GE21152@zn.tnic> From: Jann Horn Date: Fri, 29 Mar 2019 17:02:06 +0100 Message-ID: Subject: Re: [PATCH 2/2] x86: fix __user annotations To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , kernel list , Andrew Morton , Qiaowei Ren , Ben Dooks 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, Mar 29, 2019 at 2:39 PM Borislav Petkov wrote: > > On Thu, Mar 28, 2019 at 10:23:21PM +0100, Jann Horn wrote: > > Fix __user annotations in various places across the x86 tree: > > > > - cast to wrong pointer type in __user_atomic_cmpxchg_inatomic() > > - generic_load_microcode() deals with a pointer that can be either a > > kernel pointer or a user pointer; change the code to pass it around as > > a __user pointer, and add explicit casts to convert between __user and > > __kernel > > - save_xstate_epilog() has missing __user in explicit casts > > - setup_sigcontext() and x32_setup_rt_frame() rely on the cast performed > > by put_user_ex() on its first argument, but sparse requires __force for > > casting __user pointers to unsigned long > > - xen_hvm_config() has missing __user > > > > This patch removes all sparse warnings about the asn:1 address space > > (__user) in arch/x86/ for my kernel config. > > > > Signed-off-by: Jann Horn > > --- > > This patch requires the previous one, "[PATCH 1/2] kernel.h: use > > parentheses around argument in u64_to_user_ptr()", otherwise > > xen_hvm_config() breaks. Can we take both together through the x86 tree, > > or does the first one have to go through akpm's tree? > > I don't see why not, unless akpm has objections. > > However, > > > arch/x86/include/asm/uaccess.h | 3 +-- > > arch/x86/include/asm/uaccess_64.h | 2 +- > > This chunk is being discussed here already: > > https://lkml.kernel.org/r/20190228185027.2480-1-ben.dooks@codethink.co.uk > > and I'd like to take Ben's v2 when Ben adds Linus' explanation. Alright, dropped the changes in: arch/x86/lib/usercopy_64.c arch/x86/include/asm/uaccess_64.h > Then, it would be probably easier if you could split that patch into: > > > arch/x86/kernel/cpu/microcode/intel.c | 20 ++++++++++++-------- > > microcode > > > arch/x86/kernel/fpu/signal.c | 6 +++--- > > arch/x86/kernel/signal.c | 4 ++-- > > fpu patch > > > arch/x86/kvm/x86.c | 8 ++++---- Split these out as suggested. Additionally, I've split out one commit for x86/uaccess (the change to arch/x86/include/asm/uaccess.h wasn't in Ben's patch). > kvm patch Actually, looking at the log of that file, and at MAINTAINERS, it looks like that should go through the KVM tree? There's also something I want to fix in virt/kvm/kvm_main.c, so I have to send some stuff to Paolo anyway.