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 C6976C43334 for ; Mon, 27 Jun 2022 04:44:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E7126B0071; Mon, 27 Jun 2022 00:44:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 198106B0072; Mon, 27 Jun 2022 00:44:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 037B48E0001; Mon, 27 Jun 2022 00:44:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E94FF6B0071 for ; Mon, 27 Jun 2022 00:44:57 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id BB98980370 for ; Mon, 27 Jun 2022 04:44:57 +0000 (UTC) X-FDA: 79622775834.26.9CEACCF Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf28.hostedemail.com (Postfix) with ESMTP id 45607C002A for ; Mon, 27 Jun 2022 04:44:57 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25R3gNa0014372; Mon, 27 Jun 2022 04:44:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=pp1; bh=w4+Y0pScPP4IDvo444L65Z2gYNeFFZStrTMknOlPyxY=; b=FOPU3TmD+yHht7jCYcl7bo/E7LjxtzYp579FpBi58o1nsbqsgaDdjAWN71+4GK9JYREG i1rtn7q2l9fe6XdRwFQ4rMHBVDQDz5+n8DOksyiHBrSF3dx+oguUyBO3I6beacNYOjAg kPnIi/pjWxQkkfTsneWHwR2NdAv6DSxSNINO3H6HN891nxbVsXULTaTf2vSnnLb9/hXk 7tiG2HdhbuPHJbjUsbneQBsy81SgwajOn9kPLtE3yYAocfIdYL+np8WBzPE76cJ/rRW8 lk5vZ6M3HHgDT/YV5AOYv8w8G9tCVZ51kbZZrT0p44403EUMxfueZm95SO5qKG9fDmCu xw== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gy4vg92w6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Jun 2022 04:44:44 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25R4ZrNH019389; Mon, 27 Jun 2022 04:44:42 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma03wdc.us.ibm.com with ESMTP id 3gwt093kxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Jun 2022 04:44:42 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25R4igpJ32965010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jun 2022 04:44:42 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44351124055; Mon, 27 Jun 2022 04:44:42 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D46C6124054; Mon, 27 Jun 2022 04:44:39 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.43.47.235]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 27 Jun 2022 04:44:39 +0000 (GMT) X-Mailer: emacs 29.0.50 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Michael Ellerman , linuxppc-dev@lists.ozlabs.org Cc: linux-mm@kvack.org, Michal Hocko , Kefeng Wang , Christophe Leroy Subject: Re: [PATCH 3/3] powerpc/mm: Use VMALLOC_START to validate addr In-Reply-To: <87bkui6apn.fsf@mpe.ellerman.id.au> References: <20220623122922.640980-1-aneesh.kumar@linux.ibm.com> <20220623122922.640980-3-aneesh.kumar@linux.ibm.com> <87bkui6apn.fsf@mpe.ellerman.id.au> Date: Mon, 27 Jun 2022 10:14:37 +0530 Message-ID: <877d52zpe2.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -8yoApmwsxdCKOwgYbxZIEtD6o9aJ37M X-Proofpoint-ORIG-GUID: -8yoApmwsxdCKOwgYbxZIEtD6o9aJ37M X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-27_02,2022-06-24_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 adultscore=0 malwarescore=0 mlxlogscore=757 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206270020 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656305097; 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=w4+Y0pScPP4IDvo444L65Z2gYNeFFZStrTMknOlPyxY=; b=LZ7tMek3WKff38rNcUPln7Gb/vCKzoNGMc554Qk5cw081B+i6htUysI03sHpRy6kwXxBRW cPzzNX1jFmsTQvUJy9YfZPM1SVCjbey4Fkg2VHVW7wLtctvuT/ZlA6rqAdUUoGY2ZeYuEc 2EZh11dW35aMHbtp+Zt6/elOx6Ctqwg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=FOPU3TmD; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf28.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656305097; a=rsa-sha256; cv=none; b=CvXakyVj/9IfMRE4IAcVPxqEBqtH6lKuOzyj+8jyhdFrAXklzHfMgXqbSfb7ZEj38U2hJp k++3GWVgrFvQbUsBEPE10riRG2o0YwAuZzHdleRuv69nT/NgsqmXBLig+JjaaTBjXdgKRz E/U0aMMBhp2oh1NS6FpzrM5fbSHA3N8= X-Rspamd-Queue-Id: 45607C002A Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=FOPU3TmD; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf28.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: kw9df1w4xoobp177qzqoixr4quajcb4g X-HE-Tag: 1656305097-380176 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: Michael Ellerman writes: > "Aneesh Kumar K.V" writes: >> Instead of high_memory use VMALLOC_START to validate that the address is >> not in the vmalloc range. >> >> Cc: Kefeng Wang >> Cc: Christophe Leroy >> Signed-off-by: Aneesh Kumar K.V > > Isn't this really the fix for ffa0b64e3be5 ("powerpc: Fix > virt_addr_valid() for 64-bit Book3E & 32-bit") ? If we are looking for a simpler backport yet. But what commit ffa0b64e3be5 does is correct. high_memory is suppose to be the top of direct mapped address range. Hence checking for high_meory will also avoid vmalloc address. If we take patch 1 then patch 3 is not really a fix. I would consider it a cleanup to switch to a more familiar VMALLOC_START variable. > > cheers > >> diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h >> index e5f75c70eda8..256cad69e42e 100644 >> --- a/arch/powerpc/include/asm/page.h >> +++ b/arch/powerpc/include/asm/page.h >> @@ -134,7 +134,7 @@ static inline bool pfn_valid(unsigned long pfn) >> >> #define virt_addr_valid(vaddr) ({ \ >> unsigned long _addr = (unsigned long)vaddr; \ >> - _addr >= PAGE_OFFSET && _addr < (unsigned long)high_memory && \ >> + _addr >= PAGE_OFFSET && _addr < (unsigned long)VMALLOC_START && \ >> pfn_valid(virt_to_pfn(_addr)); \ >> }) >> >> -- >> 2.36.1