Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5347505ioo; Wed, 1 Jun 2022 03:46:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrGGrnf8mVQYfAQM8KJrDS/4Jb6N6mM592zOcg9PD7pXIyGCWNgrzTlVrPZmoGmVIGFeK4 X-Received: by 2002:a17:90a:4093:b0:1e0:a6f4:ea1a with SMTP id l19-20020a17090a409300b001e0a6f4ea1amr33955016pjg.12.1654080391963; Wed, 01 Jun 2022 03:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654080391; cv=none; d=google.com; s=arc-20160816; b=DMmzgklgs3QZH4zRIVESk4mbJTeWLhhdZSHaMCUts5hxOil2iwCvMD0nwibhY3AF8t cOinONwqkdcj1jqFYCSQnwzWojQwB2lCWoluH9OdIXkD4YEsGY4LRs2QGfb5fMMjPg/5 wr5LuNgiA4vCzd3lb/qU3IkyKu/bfmdHjUPLyP3MRjMyltSYJ31brE4PSgAVO05Wc7Cy AH5fuaLFv/grnGboaVtlQ3dk5DNUFYw51D8qTwkty8wBmklBBB4SaI+ZiX0AqI54N3Io vgZwn5lFVbMkpP6hOPRHmSM/JS/Zl2CXVCef5UHMNvZ2lIO0T7fvCSUo+jagL7XMNcaJ 5mIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=P7qEuFLAFdk1GVKM3QR+oH1p/xeVt3KQ1l4o82U7WNs=; b=0FK3glKna4WQfTVIhLkvp15p6+RRGzk99mnw/uS/Onfki3WPSKsaAldx0Ypb6a/5+l 2+ED8li7XchObtpOvHh1T3v7JRA9tKmEXGio76GXd2lRAskLCkeZ0ON0aWXt/l9TgP1J jF4iSBdMYSox2WVtvW3mhEliXpvw4WkI25ePC9XRwB5VU7/0bjFutSe7OYGcL/3ONzhH 9P6vdef1D7G0sQ8AZcsmpENhlQOBl/vYfF9CeiC0Y0v/FCkHAy+fHiCrSgI0zcpwkgxx ZpTMNU/xmFTIZcpVP00+ZGmeAUPqp7a8Mn7WbCm2Id71jnoKch9K6kGn2qaUD8ayb55l nuGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a63cf02000000b003f84815e5d8si1799349pgg.634.2022.06.01.03.46.18; Wed, 01 Jun 2022 03:46:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346305AbiEaRHO (ORCPT + 99 others); Tue, 31 May 2022 13:07:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346041AbiEaRHM (ORCPT ); Tue, 31 May 2022 13:07:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C1816B025 for ; Tue, 31 May 2022 10:07:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F78DB815F3 for ; Tue, 31 May 2022 17:07:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF5B1C3411D; Tue, 31 May 2022 17:07:07 +0000 (UTC) Date: Tue, 31 May 2022 18:07:04 +0100 From: Catalin Marinas To: kernel test robot Cc: Mark Brown , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: arch/arm64/kernel/signal.c:663:43: sparse: sparse: incorrect type in argument 1 (different address spaces) Message-ID: References: <202205280710.c7k1K4sD-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202205280710.c7k1K4sD-lkp@intel.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 28, 2022 at 07:40:31AM +0800, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: bf272460d744112bacd4c4d562592decbf0edf64 > commit: a1f4ccd25cc256255813f584f10e5527369d4a02 arm64/sme: Provide Kconfig for SME > date: 5 weeks ago > config: arm64-randconfig-s032-20220527 (https://download.01.org/0day-ci/archive/20220528/202205280710.c7k1K4sD-lkp@intel.com/config) > compiler: aarch64-linux-gcc (GCC) 11.3.0 > reproduce: > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # apt-get install sparse > # sparse version: v0.6.4-14-g5a0004b5-dirty > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a1f4ccd25cc256255813f584f10e5527369d4a02 > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > git fetch --no-tags linus master > git checkout a1f4ccd25cc256255813f584f10e5527369d4a02 > # save the config file > mkdir build_dir && cp config build_dir/.config > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/kernel/ > > If you fix the issue, kindly add following tag where applicable > Reported-by: kernel test robot > > > sparse warnings: (new ones prefixed by >>) > >> arch/arm64/kernel/signal.c:663:43: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct user_ctxs [noderef] __user *user @@ got struct user_ctxs * @@ > arch/arm64/kernel/signal.c:663:43: sparse: expected struct user_ctxs [noderef] __user *user > arch/arm64/kernel/signal.c:663:43: sparse: got struct user_ctxs * > arch/arm64/kernel/signal.c:933:26: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void ( [noderef] [usertype] __user *[assigned] [usertype] sigtramp )( ... ) @@ got void * @@ > arch/arm64/kernel/signal.c:933:26: sparse: expected void ( [noderef] [usertype] __user *[assigned] [usertype] sigtramp )( ... ) > arch/arm64/kernel/signal.c:933:26: sparse: got void * > >> arch/arm64/kernel/signal.c:394:35: sparse: sparse: dereference of noderef expression > >> arch/arm64/kernel/signal.c:394:35: sparse: sparse: dereference of noderef expression > arch/arm64/kernel/signal.c:428:53: sparse: sparse: dereference of noderef expression > arch/arm64/kernel/signal.c:428:53: sparse: sparse: dereference of noderef expression > > vim +663 arch/arm64/kernel/signal.c > > 47ccb02868cead Dave Martin 2017-06-15 620 > 2c020ed8d148f7 Catalin Marinas 2012-03-05 621 static int restore_sigframe(struct pt_regs *regs, > 2c020ed8d148f7 Catalin Marinas 2012-03-05 622 struct rt_sigframe __user *sf) > 2c020ed8d148f7 Catalin Marinas 2012-03-05 623 { > 2c020ed8d148f7 Catalin Marinas 2012-03-05 624 sigset_t set; > 2c020ed8d148f7 Catalin Marinas 2012-03-05 625 int i, err; > 47ccb02868cead Dave Martin 2017-06-15 626 struct user_ctxs user; > 2c020ed8d148f7 Catalin Marinas 2012-03-05 627 > 2c020ed8d148f7 Catalin Marinas 2012-03-05 628 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 629 if (err == 0) > 2c020ed8d148f7 Catalin Marinas 2012-03-05 630 set_current_blocked(&set); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 631 > 2c020ed8d148f7 Catalin Marinas 2012-03-05 632 for (i = 0; i < 31; i++) > 2c020ed8d148f7 Catalin Marinas 2012-03-05 633 __get_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i], > 2c020ed8d148f7 Catalin Marinas 2012-03-05 634 err); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 635 __get_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 636 __get_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 637 __get_user_error(regs->pstate, &sf->uc.uc_mcontext.pstate, err); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 638 > 2c020ed8d148f7 Catalin Marinas 2012-03-05 639 /* > 2c020ed8d148f7 Catalin Marinas 2012-03-05 640 * Avoid sys_rt_sigreturn() restarting. > 2c020ed8d148f7 Catalin Marinas 2012-03-05 641 */ > 17c28958600928 Dave Martin 2017-08-01 642 forget_syscall(regs); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 643 > dbd4d7ca563fd0 Mark Rutland 2016-03-01 644 err |= !valid_user_regs(®s->user_regs, current); > 47ccb02868cead Dave Martin 2017-06-15 645 if (err == 0) > 47ccb02868cead Dave Martin 2017-06-15 646 err = parse_user_sigframe(&user, sf); > 2c020ed8d148f7 Catalin Marinas 2012-03-05 647 > 6d502b6ba1b267 Suzuki K Poulose 2020-01-13 648 if (err == 0 && system_supports_fpsimd()) { > 8cd969d28fd284 Dave Martin 2017-10-31 649 if (!user.fpsimd) > 8cd969d28fd284 Dave Martin 2017-10-31 650 return -EINVAL; > 8cd969d28fd284 Dave Martin 2017-10-31 651 > 8cd969d28fd284 Dave Martin 2017-10-31 652 if (user.sve) { > 8cd969d28fd284 Dave Martin 2017-10-31 653 if (!system_supports_sve()) > 8cd969d28fd284 Dave Martin 2017-10-31 654 return -EINVAL; > 8cd969d28fd284 Dave Martin 2017-10-31 655 > 8cd969d28fd284 Dave Martin 2017-10-31 656 err = restore_sve_fpsimd_context(&user); > 8cd969d28fd284 Dave Martin 2017-10-31 657 } else { > 47ccb02868cead Dave Martin 2017-06-15 658 err = restore_fpsimd_context(user.fpsimd); > 8cd969d28fd284 Dave Martin 2017-10-31 659 } > 8cd969d28fd284 Dave Martin 2017-10-31 660 } > 2c020ed8d148f7 Catalin Marinas 2012-03-05 661 > 39782210eb7e87 Mark Brown 2022-04-19 662 if (err == 0 && system_supports_sme() && user.za) > 39782210eb7e87 Mark Brown 2022-04-19 @663 err = restore_za_context(&user); I think the restore_za_context() definition is wrong. struct user_ctxs __user *user shouldn't have the '__user' annotation, that's for the pointers inside the structure. So: diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index edb2d9206a78..b0980fbb6bc7 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -385,7 +385,7 @@ static int preserve_za_context(struct za_context __user *ctx) return err ? -EFAULT : 0; } -static int restore_za_context(struct user_ctxs __user *user) +static int restore_za_context(struct user_ctxs *user) { int err; unsigned int vq; I'll do some proper patches tomorrow and send them for -rc1. -- Catalin