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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E34EDC433F5 for ; Fri, 8 Oct 2021 01:23:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 84F1361248 for ; Fri, 8 Oct 2021 01:23:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 84F1361248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id ED0776B0072; Thu, 7 Oct 2021 21:23:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E58AF6B0073; Thu, 7 Oct 2021 21:23:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D20926B0074; Thu, 7 Oct 2021 21:23:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id C22636B0072 for ; Thu, 7 Oct 2021 21:23:05 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 64B9F183E603E for ; Fri, 8 Oct 2021 01:23:05 +0000 (UTC) X-FDA: 78671521530.15.9EE37A8 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf19.hostedemail.com (Postfix) with ESMTP id E144AB001CE4 for ; Fri, 8 Oct 2021 01:23:03 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="226698057" X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="226698057" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 18:22:58 -0700 X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="489253856" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.159.119]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 18:22:56 -0700 From: "Huang, Ying" To: Eric Dumazet Cc: Andrew Morton , linux-kernel , linux-mm , Eric Dumazet , syzbot , Mel Gorman Subject: Re: [PATCH v2] mm/mempolicy: do not allow illegal MPOL_F_NUMA_BALANCING | MPOL_LOCAL in mbind() References: <20211001215630.810592-1-eric.dumazet@gmail.com> Date: Fri, 08 Oct 2021 09:22:54 +0800 In-Reply-To: <20211001215630.810592-1-eric.dumazet@gmail.com> (Eric Dumazet's message of "Fri, 1 Oct 2021 14:56:30 -0700") Message-ID: <87pmsgqpht.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E144AB001CE4 X-Stat-Signature: dng3bk4qtjdtiy8wajk4x1pz8nkypzcj Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf19.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=ying.huang@intel.com X-HE-Tag: 1633656183-247291 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, Eric, Eric Dumazet writes: > From: Eric Dumazet > > syzbot reported access to unitialized memory in mbind() [1] > > Issue came with commit bda420b98505 ("numa balancing: migrate on > fault among multiple bound nodes") > > This commit added a new bit in MPOL_MODE_FLAGS, but only checked > valid combination (MPOL_F_NUMA_BALANCING can only be used with MPOL_BIND) > in do_set_mempolicy() > > This patch moves the check in sanitize_mpol_flags() so that it > is also used by mbind() Good catch! Thanks! When MPOL_F_NUMA_BALANCING is introduced, it is intended to be used with set_memopolicy() syscall only, it is not allowed to be used with mbind() syscall at least for now. But I misunderstood the original code apparently. So I think it may be better to return EINVAL for mbind() + MPOL_F_NUMA_BALANCING? Best Regards, Huang, Ying