Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1419937rdh; Mon, 25 Sep 2023 12:11:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWHPkSd0f64Fy9by3xP+8iy0/+icRsGz2JSZoJFeupkjcgV46TwCNoOgyexK0pVhr3s3N5 X-Received: by 2002:a05:6358:339e:b0:143:8020:b09a with SMTP id i30-20020a056358339e00b001438020b09amr11837346rwd.3.1695669068104; Mon, 25 Sep 2023 12:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695669068; cv=none; d=google.com; s=arc-20160816; b=g23+elwy64fD5WZDu03QrKH/+a5O+lM++pdb2HPx32rjD+YGPG0Oj5yyikjt84k31w bMjNoTwD4MqgpdDRa8R/C0vCSsLmkdmv4QI4ioqKhUr9koXQ1ODnxoBObrjrL5RpBtar CyKpf5iEibICYj7R+puhcoOEv7q+scEcLcmZri9Az+2R9/+TmqhqB0qlfb4SuS3zr1JL Yu1p91yn2sujO74iOVh7CL2BJvSOTqXY85M9Snwz8dGM4fu0OZKMaceHgftfbeG5HfOT cFfplHwvI/W2QCJyWF9A9E3mhTbmLmjUrECE0gmSVNQuC7OXKnE/AWpV9cdFKKe+IpXK PL3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=psu53B47Zw+z+D2u7wWqQ/a6N4tr+aS4fkyxU8KLlHI=; fh=2hQcIh/bfX5xaZ3teLtUEYpuon6UcCwRJz5IY/adbPc=; b=ZkFTFK5tyLIVxKAD56ErjuKJE0fkjDFmAUKrxVKb0PcUO7w2G8RXHC1fmENulo0qz9 atNMQRWjjU09kc3Ky/AQ7aI3Y4QXuIYW5YG18DeDOO4dM6gp1rSpp2k2PItaGFvrb4cS CfskteqRrfzVdB8vYvsFJ71+JgA9Is8G0dgPiDeKwe6AGQSyDPQvWB96aeAiZ7n34JYB 7GV8pJoY4nGD+PvAUG6lRNLuDl5YcH3qExUk8D79UlQOpy5u6jhzh+Ioa2LviFHErSv4 05mZCeHzqWHb4EEcra/Mv6hU6uOJtdj/DYMDs43vYSuuHAdsBpBuPvV+5su5zW0zChX1 N5IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I6wvvrUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bv8-20020a632e08000000b00578b6e32b58si10631013pgb.400.2023.09.25.12.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 12:11:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I6wvvrUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9676E82114A1; Mon, 25 Sep 2023 05:04:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbjIYME6 (ORCPT + 99 others); Mon, 25 Sep 2023 08:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231303AbjIYMEz (ORCPT ); Mon, 25 Sep 2023 08:04:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A580FB for ; Mon, 25 Sep 2023 05:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=psu53B47Zw+z+D2u7wWqQ/a6N4tr+aS4fkyxU8KLlHI=; b=I6wvvrUJC9TMUqYJOTkyUz0UjhKya/gt25blpg+yEAMFj0M14fIlMZeud4i9uWMEqFkCBC iAn264SYq/8TVUYzUPONnGsKYM/SqpmLHHmJ0LjFBbuieq9LEoO4Oalkf40QcRzBc/fb4v 9SRcxlEBGgRkG6eMVvKghqJV6Hu6/Gw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-396-94it2JUUPB6shaAaGHHbuA-1; Mon, 25 Sep 2023 08:03:22 -0400 X-MC-Unique: 94it2JUUPB6shaAaGHHbuA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE6CF8039D1; Mon, 25 Sep 2023 12:03:21 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E5B2711293; Mon, 25 Sep 2023 12:03:18 +0000 (UTC) From: David Howells To: Jens Axboe Cc: David Howells , Al Viro , Linus Torvalds , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Williams , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org Subject: [PATCH v7 02/12] iov_iter, x86: Be consistent about the __user tag on copy_mc_to_user() Date: Mon, 25 Sep 2023 13:02:59 +0100 Message-ID: <20230925120309.1731676-3-dhowells@redhat.com> In-Reply-To: <20230925120309.1731676-1-dhowells@redhat.com> References: <20230925120309.1731676-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 05:04:58 -0700 (PDT) copy_mc_to_user() has the destination marked __user on powerpc, but not on x86; the latter results in a sparse warning in lib/iov_iter.c. Fix this by applying the tag on x86 too. Fixes: ec6347bb4339 ("x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}()") Signed-off-by: David Howells cc: Dan Williams cc: Thomas Gleixner cc: Ingo Molnar cc: Borislav Petkov cc: Dave Hansen cc: "H. Peter Anvin" cc: Alexander Viro cc: Jens Axboe cc: Christoph Hellwig cc: Christian Brauner cc: Matthew Wilcox cc: Linus Torvalds cc: David Laight cc: x86@kernel.org cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- arch/x86/include/asm/uaccess.h | 2 +- arch/x86/lib/copy_mc.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 8bae40a66282..5c367c1290c3 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -496,7 +496,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len); #define copy_mc_to_kernel copy_mc_to_kernel unsigned long __must_check -copy_mc_to_user(void *to, const void *from, unsigned len); +copy_mc_to_user(void __user *to, const void *from, unsigned len); #endif /* diff --git a/arch/x86/lib/copy_mc.c b/arch/x86/lib/copy_mc.c index 80efd45a7761..6e8b7e600def 100644 --- a/arch/x86/lib/copy_mc.c +++ b/arch/x86/lib/copy_mc.c @@ -70,23 +70,23 @@ unsigned long __must_check copy_mc_to_kernel(void *dst, const void *src, unsigne } EXPORT_SYMBOL_GPL(copy_mc_to_kernel); -unsigned long __must_check copy_mc_to_user(void *dst, const void *src, unsigned len) +unsigned long __must_check copy_mc_to_user(void __user *dst, const void *src, unsigned len) { unsigned long ret; if (copy_mc_fragile_enabled) { __uaccess_begin(); - ret = copy_mc_fragile(dst, src, len); + ret = copy_mc_fragile((__force void *)dst, src, len); __uaccess_end(); return ret; } if (static_cpu_has(X86_FEATURE_ERMS)) { __uaccess_begin(); - ret = copy_mc_enhanced_fast_string(dst, src, len); + ret = copy_mc_enhanced_fast_string((__force void *)dst, src, len); __uaccess_end(); return ret; } - return copy_user_generic(dst, src, len); + return copy_user_generic((__force void *)dst, src, len); }