Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp948315lqb; Wed, 17 Apr 2024 16:13:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXm10v8GOm/aJkIMGzynAgWCIaky60rpxLm1sLuzB+pZseDLW855bt0GvVoOalSuFU0ZQxNahg6HSkpC9EEB8TsUJH6tktg4U8eJklF9g== X-Google-Smtp-Source: AGHT+IEqOdcluMTpiS25WgdY6ziXMVLTuY8PZ73ocHedBgy83WLi8a9IYKMPxJGBU/9Xdj6LEBc7 X-Received: by 2002:a50:8715:0:b0:56f:e4f7:fbd9 with SMTP id i21-20020a508715000000b0056fe4f7fbd9mr618831edb.20.1713395605950; Wed, 17 Apr 2024 16:13:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713395605; cv=pass; d=google.com; s=arc-20160816; b=Q5FeA/95hOJXG6lBOAfkM9kudvkDPkQMdlFgjI1qCZNVVn8oaZyzI74IlRRf9MKD0P qWH7wWToDU7g6xh4F8X03wLGDvL9Z64cIarIkBCRnsSJ73ORCBZBb+0L249IFK8bc2ZA BHO308J8RUAgZctkjzsiGew07judmi8EQkTZmJNq6SXn096dG/pYNwX82Ni5p2iKluXA 6ku1H32/QN9JcFGhxwJH6ighawuZ0aywYvqIjNecMbBS51M5N8/TKzRI164Y5friTNlK zTEvy3Mktlooy5WxWxyFQTuGBug6F0TkYFFAqo7Y1i53O5DsGWg/dkyBU57/Ua8D0pyN 8Jyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=+QhxIz3Rg6BhMsij7L8y/qv9fwU5h3aZc1aXZkoJEhg=; fh=i21m3qZnFFh/EPczrCdyJ0BcBwGOdLJXRhsteb8fQms=; b=h/mzAdEitus9gkBh3Tbs7kg+t/Bg33scz7tXRmCb0OQvFS73zZcYGvOdeEqlHMlnca bGTxJh9EFB/5L5VtK2ejWqlauCN+jL+yfoOqmnDiEfw45Zk0yAT8kzEgPQ5ByW6CEDd9 jvPrAdVbeScQSkIM2oGRMpZvvS03f/RNwlv/OPj/rpJVYFk0+T/y8PyjX1eLSQXckPhT ddH52ZRbVkpR0L5eihVZBicI+ElzWMhatGX0WIfBiz+u0yNsM11r5zKXXgg1lLqHX5os TtvvdIViNoCM+s0Zbz7wSfMJQvCBID2Q/rX9qIKmktOpoaLzHKYdyCq9uwLN8T48jbIe aHig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-149305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149305-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bo26-20020a0564020b3a00b0057016297069si129994edb.42.2024.04.17.16.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 16:13:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-149305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149305-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A7FF51F21B1B for ; Wed, 17 Apr 2024 23:13:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5D2A8563E; Wed, 17 Apr 2024 23:13:19 +0000 (UTC) Received: from mail114-241.sinamail.sina.com.cn (mail114-241.sinamail.sina.com.cn [218.30.114.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F4097464 for ; Wed, 17 Apr 2024 23:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.114.241 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713395599; cv=none; b=Zpqh2lIQA3rGwdAkMnsT5LMF+AqN3EHIOCShh3CfiOCEwCKPqNo0ewt1sTkZJ8kT8sAZ8qv7DiVlEU3gxB7zh+0OKWItgK+w99YWk8sJSVw/DtB0tx+uTdYelNqEdKtiI2obrBwJeFohHdZ7K59ihACCvi04V0k6buT4sq6wahM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713395599; c=relaxed/simple; bh=U/9iJ+V98Z0cSijfyCqxAG8uxrReMVpqrA7X/2zQ044=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J3oLccQSuK8YTSlp5A7dJk4VoTJot3aZyry1pOaelKHI1+Lo27bYcuNTrEBd6zS56RMPIyJgGik61FsSj6Y2pYf+UrEtllx3/DDAjM4n24hi8eysDjQ86vA7jjX5rs+sUoY3hOuaWAkVKBsDHJcjh7B8W0+C1UrPD/hXicXqALA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.114.241 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.88.50.128]) by sina.com (172.16.235.24) with ESMTP id 6620577D00007871; Wed, 18 Apr 2024 07:13:04 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 41170245089450 X-SMAIL-UIID: 2A50340C585F4132AF716A5FD76BA72E-20240418-071304-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in hugetlb_fault Date: Thu, 18 Apr 2024 07:13:00 +0800 Message-Id: <20240417231300.2556-1-hdanton@sina.com> In-Reply-To: <000000000000b3c7fa061652665f@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Wed, 17 Apr 2024 15:30:26 -0700 > syzbot found the following issue on: > > HEAD commit: 9ed46da14b9b Add linux-next specific files for 20240412 > git tree: linux-next > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16f89857180000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 9ed46da14b9b --- x/mm/hugetlb.c +++ y/mm/hugetlb.c @@ -6251,6 +6251,12 @@ static vm_fault_t hugetlb_no_page(struct VM_UFFD_MISSING); } + if (!(vma->vm_flags & VM_MAYSHARE)) { + ret = vmf_anon_prepare(vmf); + if (unlikely(ret)) + goto out; + } + folio = alloc_hugetlb_folio(vma, vmf->address, 0); if (IS_ERR(folio)) { /* @@ -6290,15 +6296,12 @@ static vm_fault_t hugetlb_no_page(struct restore_reserve_on_error(h, vma, vmf->address, folio); folio_put(folio); + ret = VM_FAULT_SIGBUS; goto out; } new_pagecache_folio = true; } else { folio_lock(folio); - - ret = vmf_anon_prepare(vmf); - if (unlikely(ret)) - goto backout_unlocked; anon_rmap = 1; } } else { --