Re: [rfc 0/2] Introducing VmFlags field into smaps output

From: Cyrill Gorcunov
Date: Tue Oct 23 2012 - 17:59:03 EST


On Wed, Oct 24, 2012 at 01:46:39AM +0400, Cyrill Gorcunov wrote:
>
> > Also... what happens if there's an unrecognised bit set in `flags'?
> > Memory corruption or code skew could cause this. We emit a couple of
> > NULs into the procfs output, which I guess is an OK response to such a
> > condition.
>
> That's indeed will produce some nil character on the screen. I guess we
> need some designited init here, say
>
> [0 ... (BITS_PER_LONG-1)] = { {'-', '-'} },
> ...
> [ilog2(VM_READ)] = { {'r', 'd'} },
> ...
> and so on, i'll update on top
>

Andrew, could you please fold it on top of your
procfs-add-vmflags-field-in-smaps-output-v3-fix ?

(If this is inconvenient -- just give me a word and I'll
squash everything in one new patch instead).
---
From: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
Subject: procfs-add-vmflags-field-in-smaps-output-v3-fix-on-top

Use designated init to assign "??" mnemonic on unknown flags.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
Cc: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
fs/proc/task_mmu.c | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-2.6.git/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.git.orig/fs/proc/task_mmu.c
+++ linux-2.6.git/fs/proc/task_mmu.c
@@ -488,6 +488,11 @@ static void show_smap_vma_flags(struct s
static const struct {
const char l[2];
} mnemonics[BITS_PER_LONG] = {
+ /*
+ * In case if we meet a flag we don't know about.
+ */
+ [0 ... (BITS_PER_LONG-1)] = { {'?', '?'} },
+
[ilog2(VM_READ)] = { {'r', 'd'} },
[ilog2(VM_WRITE)] = { {'w', 'r'} },
[ilog2(VM_EXEC)] = { {'e', 'x'} },
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/