From patchwork Mon Sep 25 12:02:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13397688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1630CE7A81 for ; Mon, 25 Sep 2023 12:03:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 449A46B0139; Mon, 25 Sep 2023 08:03:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D2046B013A; Mon, 25 Sep 2023 08:03:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 272416B013B; Mon, 25 Sep 2023 08:03:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 101AB6B0139 for ; Mon, 25 Sep 2023 08:03:32 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7F27E1A0B3F for ; Mon, 25 Sep 2023 12:03:31 +0000 (UTC) X-FDA: 81274985022.18.F205B74 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 1DA5F4001B for ; Mon, 25 Sep 2023 12:03:27 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I6wvvrUJ; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695643408; a=rsa-sha256; cv=none; b=J26jb/OOPyhXbS1YIdpiHSfCBl/J6pywXxqyE3ZNW9bTbCcAEl9dVALsn4NJhGDqBJ99uL AVgIf8seZQqYVeUVA6NY3dtMvlsv+0yZdOJShO0onaps+MygDbLv4kk0uviLn/jXzTx/hi pGB4aUrsUWB/jfz+/s93Vk4LtqG6q2w= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I6wvvrUJ; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695643408; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=psu53B47Zw+z+D2u7wWqQ/a6N4tr+aS4fkyxU8KLlHI=; b=k+KRKihqR8fnMRnOoeBfYXyv8qcfFQIYRFglAmDpSt5l4wfFm2HsUY107ApMiUCOhhES3w 55UKr9Yc7Df8oLWmKztdWdPKTniHA66plAalOyFREXvYVd/FVsvTqJnckklxTrvI1curiC oGhsgSOWzZdw2xbDIJajl+2yY1Tn744= 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1DA5F4001B X-Stat-Signature: 7kf4o1zxozermzt7u8eqg854gtu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qhOtBHqMQG4s072UprGu6xbc5aYYBIW3tZoM7rScRwdgRxlIQsZNfJvXHTlFzT/wsnTNmdCpX/Xw3xHvjzzoM4bDXmo+vKb9Ns5j7fi3lN7HqnvoEI1V59jNnd6hVSVcFwaAp3BSPj9hw/8QF3kJivAHGqNZzr7sIE0TtKh2PMwXTakugImBj9XMsC/ado9Anu+e/Y2lVmRb0qxdHkL4EiO6WUS0xj3woGmU0W33Yzg8unci7VPofSEd9VBiZYBK6k8O9uwswprz4ZJm2dPgleKIYv/BjEKK317ziAf9GurH1I7/Z4COMqfSCisH2C8gmeoZJyCctnwMApiO0D2HjwoJkOMvZP5cys6GpDPMEX9syNrPIopMkcabdQNZW+1KLsABdXIFfrwi//H+KAYJu9ajuRsGeuZXVEFIio6mJOnpKN7l5j2PduOXh1/2j+ByKFS8DeGbRWoqCMbd71a0NSallr+rjcrsGNRd/ZP6rD6edO+ZH9m2VreMDhQCvV3RtUX73ojwlU+fIBDU5fqrHvyh0gW6NanGuDw2cP1eHLh6Ru4RW2iuwqfUui1sh+Ir0TVLdAYVMoHtFH6dV5U1BUZSmHgjDQIQXDXlixcThMEVEfruAR X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Acked-by: Borislav Petkov (AMD) --- 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); }