From mboxrd@z Thu Jan 1 00:00:00 1970 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 31855C3DA6F for ; Thu, 24 Aug 2023 13:04:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A4312800A9; Thu, 24 Aug 2023 09:04:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2547D2800A1; Thu, 24 Aug 2023 09:04:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11D6C2800A9; Thu, 24 Aug 2023 09:04:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id F2D162800A1 for ; Thu, 24 Aug 2023 09:03:59 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9FB291601E4 for ; Thu, 24 Aug 2023 13:03:59 +0000 (UTC) X-FDA: 81159015798.21.42B97E7 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by imf10.hostedemail.com (Postfix) with ESMTP id 39FB2C001B for ; Thu, 24 Aug 2023 13:03:55 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="AGRZ/w33"; spf=pass (imf10.hostedemail.com: domain of lkp@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692882237; a=rsa-sha256; cv=none; b=jqjrNQx2txeF0aG5fYpYrVSD6nKwFHdubnWt2VxQNfUnftiMGXFMzIHVqVsO8VOA6ppzC7 u8fn0GVYwdUW9z/+zgG7BCsKuGI6xal6D88K+/FG23qwxtuBuBvBL1u6J0Ti7/nKArHMtS c6ZONRcl6XZgcnBu/wPK5dZ6/JaJAoI= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="AGRZ/w33"; spf=pass (imf10.hostedemail.com: domain of lkp@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692882237; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=O2FAjjhoHK/ne/TnwVWMlK5HFWxLGzsHa4L5fEp/xEo=; b=DQ/B/NfThsmB69fi7C3ISL28TqMHRVnxZv/qCkMqVMpRnnVvNGP6m7Jile0kkm+AMYAdyB PYfdJnJL06DPh+T+IvbXwVzj6ExZSqK136jbdQT6Kw/RfUkIT7QBFfHIh0Kmy+CiDySxwv H9/pUCKLDFk0Xe7CzbP8CaglibCn6do= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692882236; x=1724418236; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=jHMVu6k8S9w3sW744CRbIo5kUtynAHJhFX02muevFVU=; b=AGRZ/w33TKHV3yYUZWLxxQmKg26tvwMJUKlHfZNSR+TtwCXBGrRLQWfC gEm+sZ1Ta+hoF7b54X/vnnF+tIpYEUpOrX20HjgeO0SjpGwzL3wl/Fggi L2OeufaRARF3+LevLSEkN11ELRoEmxJY4zWsp5rpCmLyIVvQ53nyl6L+Q QvQQIbfzktBQP9a04KggYHmddTtOiFawiY8uECAr+dKUYH9HqkDqGKRmU AxE0WtWIizWS1QnhKZh2hzKxwvGnYdIJrSOsEJ48AIVq1/uCXyYgAPmVh uykse2QTYyNEhYL6TaFn2Pxggh7c109rtKWbKDxp3EPngFntYpiIEmoW+ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="359414864" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="359414864" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2023 06:03:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="807121086" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="807121086" Received: from lkp-server02.sh.intel.com (HELO daf8bb0a381d) ([10.239.97.151]) by fmsmga004.fm.intel.com with ESMTP; 24 Aug 2023 06:03:41 -0700 Received: from kbuild by daf8bb0a381d with local (Exim 4.96) (envelope-from ) id 1qZ9zt-0002gS-0G; Thu, 24 Aug 2023 13:03:38 +0000 Date: Thu, 24 Aug 2023 21:03:34 +0800 From: kernel test robot To: Khadija Kamran , linux-kernel@vger.kernel.org, Andrew Morton , Serge Hallyn , Paul Moore , James Morris , linux-security-module@vger.kernel.org, Stephen Smalley , Eric Paris , selinux@vger.kernel.org, ztarkhani@microsoft.com, alison.schofield@intel.com Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List Subject: Re: [PATCH] lsm: constify the 'mm' parameter in security_vm_enough_memory_mm() Message-ID: <202308242024.q4KF0YIN-lkp@intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 39FB2C001B X-Stat-Signature: qxkjdsx34admn8chaefmgtcss7wjwttj X-Rspam-User: X-HE-Tag: 1692882235-674839 X-HE-Meta: U2FsdGVkX19UYMcySdz/pgITTpf4+k+vQXYq1RJZMM5MTU9cZP7M3cBbYx3/VfZwukHeDdHQYfQZz1IcFkpNt4EdJAxrR9TA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u070VXfhcuGihwSAWeF3ra3JJWkJ1k1q8jFi3UHPPjOdgZsxLZHtMMPwQRlrFXlvx9Wg8D6QlcbBWySzXvJ4aGlykIpvtMtw0fuB3oVqVDHVL9N8LZJvWHjwriwebUy0v181orvSi9fjsoh5W1PS6zug970YzAxsCtTjTpGhblH/Omt6KsrzEgDmYRU4Fgj1B7JjceGeyNnstziDoPlLBzheL9JIplZIw2EYGg7ijExl8iun7X0VlTaX5tL7lAXM8GRe5jZauuCEJXxds3PfxSXuuM9Q9tv9uF9kSRqmL6tJdIEceuQUVmqaFpzrmfgJfTJDKS+9IWUz0CbHqHOg 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: Hi Khadija, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] [also build test ERROR on pcmoore-selinux/next pcmoore-audit/next linus/master v6.5-rc7 next-20230824] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Khadija-Kamran/lsm-constify-the-mm-parameter-in-security_vm_enough_memory_mm/20230823-145455 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/ZOWtBTKkfcc8sKkY%40gmail.com patch subject: [PATCH] lsm: constify the 'mm' parameter in security_vm_enough_memory_mm() config: arc-randconfig-001-20230824 (https://download.01.org/0day-ci/archive/20230824/202308242024.q4KF0YIN-lkp@intel.com/config) compiler: arc-elf-gcc (GCC) 13.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230824/202308242024.q4KF0YIN-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202308242024.q4KF0YIN-lkp@intel.com/ All errors (new ones prefixed by >>): >> mm/util.c:928:5: error: conflicting types for '__vm_enough_memory'; have 'int(struct mm_struct *, long int, int)' 928 | int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) | ^~~~~~~~~~~~~~~~~~ In file included from mm/util.c:2: include/linux/mm.h:3199:12: note: previous declaration of '__vm_enough_memory' with type 'int(const struct mm_struct *, long int, int)' 3199 | extern int __vm_enough_memory(const struct mm_struct *mm, long pages, int cap_sys_admin); | ^~~~~~~~~~~~~~~~~~ vim +928 mm/util.c 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 911 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 912 /* 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 913 * Check that a process has enough memory to allocate a new virtual 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 914 * mapping. 0 means there is enough memory for the allocation to 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 915 * succeed and -ENOMEM implies there is not. 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 916 * 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 917 * We currently support three overcommit policies, which are set via the ee65728e103bb7 Mike Rapoport 2022-06-27 918 * vm.overcommit_memory sysctl. See Documentation/mm/overcommit-accounting.rst 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 919 * 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 920 * Strict overcommit modes added 2002 Feb 26 by Alan Cox. 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 921 * Additional code 2002 Jul 20 by Robert Love. 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 922 * 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 923 * cap_sys_admin is 1 if the process has admin privileges, 0 otherwise. 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 924 * 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 925 * Note this is a helper function intended to be used by LSMs which 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 926 * wish to use this logic. 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 927 */ 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 @928 int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 929 { 8c7829b04c523c Johannes Weiner 2019-05-13 930 long allowed; 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 931 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 932 vm_acct_memory(pages); 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 933 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 934 /* 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 935 * Sometimes we want to use more memory than we have 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 936 */ 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 937 if (sysctl_overcommit_memory == OVERCOMMIT_ALWAYS) 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 938 return 0; 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 939 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 940 if (sysctl_overcommit_memory == OVERCOMMIT_GUESS) { 8c7829b04c523c Johannes Weiner 2019-05-13 941 if (pages > totalram_pages() + total_swap_pages) 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 942 goto error; 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 943 return 0; 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 944 } 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 945 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 946 allowed = vm_commit_limit(); 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 947 /* 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 948 * Reserve some for root 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 949 */ 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 950 if (!cap_sys_admin) 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 951 allowed -= sysctl_admin_reserve_kbytes >> (PAGE_SHIFT - 10); 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 952 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 953 /* 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 954 * Don't let a single process grow so big a user can't recover 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 955 */ 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 956 if (mm) { 8c7829b04c523c Johannes Weiner 2019-05-13 957 long reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); 8c7829b04c523c Johannes Weiner 2019-05-13 958 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 959 allowed -= min_t(long, mm->total_vm / 32, reserve); 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 960 } 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 961 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 962 if (percpu_counter_read_positive(&vm_committed_as) < allowed) 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 963 return 0; 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 964 error: 6bdfc60cf0f977 Jakub Wilk 2023-02-10 965 pr_warn_ratelimited("%s: pid: %d, comm: %s, not enough memory for the allocation\n", 44b414c8715c5d Kefeng Wang 2022-07-26 966 __func__, current->pid, current->comm); 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 967 vm_unacct_memory(pages); 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 968 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 969 return -ENOMEM; 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 970 } 39a1aa8e194ab6 Andrey Ryabinin 2016-03-17 971 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki