From mboxrd@z Thu Jan 1 00:00:00 1970 From: Catalin Marinas Subject: Re: [PATCH 1/4] arm64: compat: Alloc separate pages for vectors and sigpage Date: Tue, 2 Apr 2019 11:06:57 +0100 Message-ID: <20190402100657.tkvdkqtx2xjjixma@mbp> References: <20190401112025.40807-1-vincenzo.frascino@arm.com> <20190401112025.40807-2-vincenzo.frascino@arm.com> <20190401142754.GF14874@arrakis.emea.arm.com> <6c43e9f9-3500-b828-3cf9-1917b9de256a@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <6c43e9f9-3500-b828-3cf9-1917b9de256a@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Vincenzo Frascino Cc: linux-arch@vger.kernel.org, Mark Rutland , Will Deacon , linux-arm-kernel@lists.infradead.org List-Id: linux-arch.vger.kernel.org On Tue, Apr 02, 2019 at 11:01:04AM +0100, Vincenzo Frascino wrote: > On 01/04/2019 15:27, Catalin Marinas wrote: > > On Mon, Apr 01, 2019 at 12:20:22PM +0100, Vincenzo Frascino wrote: > >> +static int aarch32_sigreturn_setup(struct mm_struct *mm) > >> +{ > >> + unsigned long addr; > >> void *ret; > >> > >> - if (down_write_killable(&mm->mmap_sem)) > >> - return -EINTR; > >> - current->mm->context.vdso = (void *)addr; > >> + addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0); > >> + if (IS_ERR_VALUE(addr)) { > >> + ret = ERR_PTR(addr); > >> + goto out; > >> + } > >> > >> - /* Map vectors page at the high address. */ > >> ret = _install_special_mapping(mm, addr, PAGE_SIZE, > >> - VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC, > >> - &spec); > >> + VM_READ | VM_EXEC | VM_MAYREAD | > >> + VM_MAYWRITE | VM_MAYEXEC, > >> + &aarch32_vdso_spec[1]); > > > > Any reason for setting VM_MAYWRITE here? > > VM_MAYWRITE is required to allow gdb to Copy-on-Write and set breakpoints. Thanks. Please add a comment to the code so I don't ask again ;). -- Catalin From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47756 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbfDBKHC (ORCPT ); Tue, 2 Apr 2019 06:07:02 -0400 Date: Tue, 2 Apr 2019 11:06:57 +0100 From: Catalin Marinas Subject: Re: [PATCH 1/4] arm64: compat: Alloc separate pages for vectors and sigpage Message-ID: <20190402100657.tkvdkqtx2xjjixma@mbp> References: <20190401112025.40807-1-vincenzo.frascino@arm.com> <20190401112025.40807-2-vincenzo.frascino@arm.com> <20190401142754.GF14874@arrakis.emea.arm.com> <6c43e9f9-3500-b828-3cf9-1917b9de256a@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c43e9f9-3500-b828-3cf9-1917b9de256a@arm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Vincenzo Frascino Cc: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Will Deacon , Mark Rutland Message-ID: <20190402100657.7t7eQxKcS39wQ9gd5WwUHHA0J2p7p-xeB62mtfPyzfA@z> On Tue, Apr 02, 2019 at 11:01:04AM +0100, Vincenzo Frascino wrote: > On 01/04/2019 15:27, Catalin Marinas wrote: > > On Mon, Apr 01, 2019 at 12:20:22PM +0100, Vincenzo Frascino wrote: > >> +static int aarch32_sigreturn_setup(struct mm_struct *mm) > >> +{ > >> + unsigned long addr; > >> void *ret; > >> > >> - if (down_write_killable(&mm->mmap_sem)) > >> - return -EINTR; > >> - current->mm->context.vdso = (void *)addr; > >> + addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0); > >> + if (IS_ERR_VALUE(addr)) { > >> + ret = ERR_PTR(addr); > >> + goto out; > >> + } > >> > >> - /* Map vectors page at the high address. */ > >> ret = _install_special_mapping(mm, addr, PAGE_SIZE, > >> - VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC, > >> - &spec); > >> + VM_READ | VM_EXEC | VM_MAYREAD | > >> + VM_MAYWRITE | VM_MAYEXEC, > >> + &aarch32_vdso_spec[1]); > > > > Any reason for setting VM_MAYWRITE here? > > VM_MAYWRITE is required to allow gdb to Copy-on-Write and set breakpoints. Thanks. Please add a comment to the code so I don't ask again ;). -- Catalin