Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754577AbbKMIg2 (ORCPT ); Fri, 13 Nov 2015 03:36:28 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:18550 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753904AbbKMIg1 (ORCPT ); Fri, 13 Nov 2015 03:36:27 -0500 Message-ID: <5645A00D.6020005@huawei.com> Date: Fri, 13 Nov 2015 16:32:13 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Laura Abbott CC: Catalin Marinas , Will Deacon , Ard Biesheuvel , "Zhong Jiang" , , , Kees Cook , "Mark Rutland" Subject: Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of modules References: <1447207057-11323-1-git-send-email-labbott@fedoraproject.org> <1447207057-11323-3-git-send-email-labbott@fedoraproject.org> <56459EED.4030109@huawei.com> In-Reply-To: <56459EED.4030109@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.5645A102.0021,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: cb40b39eb4f36bd7bc3c10d78a1f8882 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1232 Lines: 49 >> +static int update_pmd_range(struct mm_struct *mm, pud_t *pud, >> + unsigned long addr, unsigned long end, >> + pgprot_t clear, pgprot_t set) >> +{ >> + pmd_t *pmd; >> + unsigned long next; >> + int err = 0; >> + >> + if (pud_sect(*pud)) { >> + if (!IS_ENABLED(CONFIG_DEBUG_CHANGE_PAGEATTR)) { >> + err = -EINVAL; >> + goto out; >> + } >> + pmd = pmd_alloc_one(&init_mm, addr); >> + if (!pmd) { >> + err = -ENOMEM; >> + goto out; >> + } >> + split_pud(pud, pmd); >> + pud_populate(&init_mm, pud, pmd); >> + } >> + >> >> - pte = clear_pte_bit(pte, cdata->clear_mask); >> - pte = set_pte_bit(pte, cdata->set_mask); >> + pmd = pmd_offset(pud, addr); >> + if (pmd_none(*pmd)) { >> + err = -EFAULT; >> + goto out; >> + } >> + >> + do { >> + next = pmd_addr_end(addr, end); >> + if (((addr | end) & ~SECTION_MASK) == 0) { > > Hi Laura, > > Why not like this? > if (pmd_sect(*pmd) && ((addr | nest) & ~SECTION_MASK) == 0) { Sorry, typo error, nest -> next -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/