From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423395AbcFMUw1 (ORCPT ); Mon, 13 Jun 2016 16:52:27 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36316 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751150AbcFMUwZ (ORCPT ); Mon, 13 Jun 2016 16:52:25 -0400 Subject: Re: [RFC 18/18] proc: present VM_LOCKED memory in /proc/self/maps To: Kees Cook References: <1465847065-3577-1-git-send-email-toiwoton@gmail.com> <1465847065-3577-19-git-send-email-toiwoton@gmail.com> <20160613204312.GP3346@outflux.net> Cc: linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko , Konstantin Khlebnikov , Vlastimil Babka , "Kirill A. Shutemov" , Jerome Marchand , Laurent Dufour , Naoya Horiguchi , Gerald Schaefer , Johannes Weiner From: Topi Miettinen Openpgp: id=A0F2EB0D8452DA908BEC8E911CF9ADDBD610E936 Message-ID: <7fc74c08-0a9c-86ee-a7e2-df5a1416ede3@gmail.com> Date: Mon, 13 Jun 2016 20:52:22 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160613204312.GP3346@outflux.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/13/16 20:43, Kees Cook wrote: > On Mon, Jun 13, 2016 at 10:44:25PM +0300, Topi Miettinen wrote: >> Add a flag to /proc/self/maps to show that the memory area is locked. >> >> Signed-off-by: Topi Miettinen >> --- >> fs/proc/task_mmu.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c >> index 4648c7f..8229509 100644 >> --- a/fs/proc/task_mmu.c >> +++ b/fs/proc/task_mmu.c > > If you change the maps format, you'll need to update task_nommu.c too. > >> @@ -313,13 +313,14 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) >> end -= PAGE_SIZE; >> >> seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); > > I think the width needs to be adjusted for the new character. > >> - seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ", >> + seq_printf(m, "%08lx-%08lx %c%c%c%c%c %08llx %02x:%02x %lu ", > > Have you checked that no userspace tools that parse "maps" will break with > this flag addition? > >> start, >> end, >> flags & VM_READ ? 'r' : '-', >> flags & VM_WRITE ? 'w' : '-', >> flags & VM_EXEC ? 'x' : '-', >> flags & VM_MAYSHARE ? 's' : 'p', >> + flags & VM_LOCKED ? 'l' : '-', > > IIUC, the smaps file already includes the locked information in VmFlags as > "lo" (see show_smap_vma_flags), so I think you probably don't want this > patch at all. Yes. the amount of locked memory is also shown: Locked: 8 kB VmFlags: rd wr mr mw me lo ac sd Sorry, I didn't notice that. I'll drop the patch. -Topi > > -Kees > >> pgoff, >> MAJOR(dev), MINOR(dev), ino); >> >> -- >> 2.8.1 >