Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7842718ybn; Mon, 30 Sep 2019 22:07:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9wT/yIYgHA5ZSnoh1lB66XpxpwFC8c5u9qKPnEgKE8HwkYzD1zUNR69qkFk55kTjNBu+v X-Received: by 2002:a17:906:1f89:: with SMTP id t9mr9041655ejr.241.1569906460613; Mon, 30 Sep 2019 22:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569906460; cv=none; d=google.com; s=arc-20160816; b=jeQ5X8iMfa+DtTfrQG5v02N9swWZTrMmPZk6l6UlUrkmFx5OEIk33DQkgVwJPB/EOx ywixx5kbyJMzI1HTQMMemmOm97EU7n9JQ3BJ1DqBQc/WIRqR7xIQqfO6ePOvABGaXBK4 WRLLEH6ZGo02+pOqo/SdgqnZuMZ6cQDD30FGtVE/WyQ5rhZ3g59g2te5zXgcOc5168G4 ePe/FHG6bw4Gs4XCyK7uj+DFwwS/vYfQn+clt7RcOalzjluPY6CzdIEUCAgW0v417xoC nHfJa9hcuEl1lsuWrSANfQpL8HRgr3HcM24eOtl9pS3qhezJVywbJtJgTJHW806MIBns 8b6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zP+By8MKdMx7Faagq8/p3AAKRibvoWKocNw4q0kRQxI=; b=cPyCWtAvCovOF6gspyUWMtFxNscigieDxcDxzl7l1GOQGMPkHHb9Kn7xE5JfUQM/4k yLrQ2YN8xa9d01z7VYPhvjQ7sZvBwl2Iq0YWg0wY15UUAzAgh3eAJGM4Lz+Cem7P/Ou6 rvyqQGlD3gWH+dtgxTqIMoj7NgVQTUhqjb/U5q62SkouuvyEJzzmPX2epf9BRDoGX4+u LFtbyekjLyTb8RT/jDqo/USuMWiXm6YnLeJl/zeF8SuDxzyyTGqHdmpBGRI95vKHmsPg XL3yoNv+Jb3ZF65hsK78WjmAPR7ttBqjITccErquPwnBEBg8SM9YBxAkj6R1UgCduXBE C+fw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h17si9089116edb.89.2019.09.30.22.07.14; Mon, 30 Sep 2019 22:07:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729406AbfJAFHH (ORCPT + 99 others); Tue, 1 Oct 2019 01:07:07 -0400 Received: from mga17.intel.com ([192.55.52.151]:16783 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbfJAFHG (ORCPT ); Tue, 1 Oct 2019 01:07:06 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 22:07:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,569,1559545200"; d="scan'208";a="190474561" Received: from lkp-server01.sh.intel.com (HELO lkp-server01) ([10.239.97.150]) by fmsmga008.fm.intel.com with ESMTP; 30 Sep 2019 22:06:56 -0700 Received: from kbuild by lkp-server01 with local (Exim 4.89) (envelope-from ) id 1iFANE-000IpB-8f; Tue, 01 Oct 2019 13:06:56 +0800 Date: Tue, 1 Oct 2019 13:06:23 +0800 From: kbuild test robot To: Aleksa Sarai Cc: kbuild-all@01.org, Al Viro , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Alexander Shishkin , Rasmus Villemoes , Alexei Starovoitov , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, Jiri Olsa , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Tycho Andersen , Aleksa Sarai , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, Kees Cook , Jann Horn , linuxppc-dev@lists.ozlabs.org, Aleksa Sarai , Andy Lutomirski , Namhyung Kim , David Drysdale , Christian Brauner , libc-alpha@sourceware.org, linux-parisc@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-api@vger.kernel.org, Chanho Min , Oleg Nesterov , Eric Biederman , linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Linus Torvalds , containers@lists.linux-foundation.org Subject: Re: [PATCH v13 7/9] open: openat2(2) syscall Message-ID: <201910011326.iTYOtJYo%lkp@intel.com> References: <20190930183316.10190-8-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190930183316.10190-8-cyphar@cyphar.com> X-Patchwork-Hint: ignore User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Aleksa, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [cannot apply to v5.4-rc1 next-20191001] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Aleksa-Sarai/namei-openat2-2-path-resolution-restrictions/20191001-025628 reproduce: # apt-get install sparse # sparse version: v0.6.1-rc1-37-gd466a02-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) fs/open.c:757:13: sparse: sparse: restricted fmode_t degrades to integer fs/open.c:983:18: sparse: sparse: restricted fmode_t degrades to integer >> fs/open.c:1011:36: sparse: sparse: invalid assignment: |= >> fs/open.c:1011:36: sparse: left side has type int >> fs/open.c:1011:36: sparse: right side has type restricted fmode_t fs/open.c:1013:36: sparse: sparse: invalid assignment: |= fs/open.c:1013:36: sparse: left side has type int fs/open.c:1013:36: sparse: right side has type restricted fmode_t >> fs/open.c:1029:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted fmode_t [usertype] opath_mask @@ got pe] opath_mask @@ >> fs/open.c:1029:24: sparse: expected restricted fmode_t [usertype] opath_mask >> fs/open.c:1029:24: sparse: got int opath_mask >> fs/open.c:1011:36: sparse: sparse: invalid assignment: |= >> fs/open.c:1011:36: sparse: left side has type int >> fs/open.c:1011:36: sparse: right side has type restricted fmode_t fs/open.c:1013:36: sparse: sparse: invalid assignment: |= fs/open.c:1013:36: sparse: left side has type int fs/open.c:1013:36: sparse: right side has type restricted fmode_t >> fs/open.c:1029:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted fmode_t [usertype] opath_mask @@ got pe] opath_mask @@ >> fs/open.c:1029:24: sparse: expected restricted fmode_t [usertype] opath_mask >> fs/open.c:1029:24: sparse: got int opath_mask >> fs/open.c:1011:36: sparse: sparse: invalid assignment: |= >> fs/open.c:1011:36: sparse: left side has type int >> fs/open.c:1011:36: sparse: right side has type restricted fmode_t fs/open.c:1013:36: sparse: sparse: invalid assignment: |= fs/open.c:1013:36: sparse: left side has type int fs/open.c:1013:36: sparse: right side has type restricted fmode_t >> fs/open.c:1029:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted fmode_t [usertype] opath_mask @@ got pe] opath_mask @@ >> fs/open.c:1029:24: sparse: expected restricted fmode_t [usertype] opath_mask >> fs/open.c:1029:24: sparse: got int opath_mask fs/open.c:1173:15: sparse: sparse: undefined identifier 'copy_struct_from_user' vim +1011 fs/open.c 957 958 static inline int build_open_flags(const struct open_how *how, 959 struct open_flags *op) 960 { 961 int flags = how->flags; 962 int lookup_flags = 0; 963 int opath_mask = 0; 964 int acc_mode = ACC_MODE(flags); 965 966 /* 967 * Older syscalls still clear these bits before calling 968 * build_open_flags(), but openat2(2) checks all its arguments. 969 */ 970 if (flags & ~VALID_OPEN_FLAGS) 971 return -EINVAL; 972 if (how->resolve & ~VALID_RESOLVE_FLAGS) 973 return -EINVAL; 974 if (!(how->flags & (O_PATH | O_CREAT | __O_TMPFILE)) && how->mode != 0) 975 return -EINVAL; 976 977 if (flags & (O_CREAT | __O_TMPFILE)) 978 op->mode = (how->mode & S_IALLUGO) | S_IFREG; 979 else 980 op->mode = 0; 981 982 /* Must never be set by userspace */ > 983 flags &= ~FMODE_NONOTIFY & ~O_CLOEXEC; 984 985 /* 986 * O_SYNC is implemented as __O_SYNC|O_DSYNC. As many places only 987 * check for O_DSYNC if the need any syncing at all we enforce it's 988 * always set instead of having to deal with possibly weird behaviour 989 * for malicious applications setting only __O_SYNC. 990 */ 991 if (flags & __O_SYNC) 992 flags |= O_DSYNC; 993 994 if (flags & __O_TMPFILE) { 995 if ((flags & O_TMPFILE_MASK) != O_TMPFILE) 996 return -EINVAL; 997 if (!(acc_mode & MAY_WRITE)) 998 return -EINVAL; 999 } else if (flags & O_PATH) { 1000 /* 1001 * If we have O_PATH in the open flag. Then we 1002 * cannot have anything other than the below set of flags 1003 */ 1004 flags &= O_DIRECTORY | O_NOFOLLOW | O_PATH; 1005 acc_mode = 0; 1006 1007 /* Allow userspace to restrict the re-opening of O_PATH fds. */ 1008 if (how->upgrade_mask & ~VALID_UPGRADE_FLAGS) 1009 return -EINVAL; 1010 if (!(how->upgrade_mask & UPGRADE_NOREAD)) > 1011 opath_mask |= FMODE_PATH_READ; 1012 if (!(how->upgrade_mask & UPGRADE_NOWRITE)) 1013 opath_mask |= FMODE_PATH_WRITE; 1014 } 1015 1016 op->open_flag = flags; 1017 1018 /* O_TRUNC implies we need access checks for write permissions */ 1019 if (flags & O_TRUNC) 1020 acc_mode |= MAY_WRITE; 1021 1022 /* Allow the LSM permission hook to distinguish append 1023 access from general write access. */ 1024 if (flags & O_APPEND) 1025 acc_mode |= MAY_APPEND; 1026 1027 op->acc_mode = acc_mode; 1028 op->intent = flags & O_PATH ? 0 : LOOKUP_OPEN; > 1029 op->opath_mask = opath_mask; 1030 1031 if (flags & O_CREAT) { 1032 op->intent |= LOOKUP_CREATE; 1033 if (flags & O_EXCL) 1034 op->intent |= LOOKUP_EXCL; 1035 } 1036 1037 if (flags & O_DIRECTORY) 1038 lookup_flags |= LOOKUP_DIRECTORY; 1039 if (!(flags & O_NOFOLLOW)) 1040 lookup_flags |= LOOKUP_FOLLOW; 1041 if (flags & O_EMPTYPATH) 1042 lookup_flags |= LOOKUP_EMPTY; 1043 1044 if (how->resolve & RESOLVE_NO_XDEV) 1045 lookup_flags |= LOOKUP_NO_XDEV; 1046 if (how->resolve & RESOLVE_NO_MAGICLINKS) 1047 lookup_flags |= LOOKUP_NO_MAGICLINKS; 1048 if (how->resolve & RESOLVE_NO_SYMLINKS) 1049 lookup_flags |= LOOKUP_NO_SYMLINKS; 1050 if (how->resolve & RESOLVE_BENEATH) 1051 lookup_flags |= LOOKUP_BENEATH; 1052 if (how->resolve & RESOLVE_IN_ROOT) 1053 lookup_flags |= LOOKUP_IN_ROOT; 1054 1055 op->lookup_flags = lookup_flags; 1056 return 0; 1057 } 1058 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation