lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 22 Oct 2012 14:51:58 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Cyrill Gorcunov <gorcunov@...nvz.org>
Cc:	Pavel Emelyanov <xemul@...allels.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [rfc 0/2] Introducing VmFlags field into smaps output

On Tue, 23 Oct 2012 01:34:49 +0400
Cyrill Gorcunov <gorcunov@...nvz.org> wrote:

>
> ...
>
> +VmFlags: rd ex mr mw me de

ho hum OK, let's do that.
  
> +static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
> +{
> +	/*
> +	 * Don't forget to update Documentation/ on changes.
> +	 */
> +
> +#define __seq_show_vmflag(_f, _s)		\
> +	do {					\
> +		if (vma->vm_flags & (_f))	\
> +			seq_puts(m, _s);	\
> +	} while (0)
> +
> +	seq_puts(m, "VmFlags: ");
> +
> +	__seq_show_vmflag(VM_READ,	"rd ");
> +	__seq_show_vmflag(VM_WRITE,	"wr ");
> +	__seq_show_vmflag(VM_EXEC,	"ex ");
> +	__seq_show_vmflag(VM_SHARED,	"sh ");
> +	__seq_show_vmflag(VM_MAYREAD,	"mr ");
> +	__seq_show_vmflag(VM_MAYWRITE,	"mw ");
> +	__seq_show_vmflag(VM_MAYEXEC,	"me ");
> +	__seq_show_vmflag(VM_MAYSHARE,	"ms ");
> +	__seq_show_vmflag(VM_GROWSDOWN,	"gd ");
> +	__seq_show_vmflag(VM_PFNMAP,	"pf ");
> +	__seq_show_vmflag(VM_DENYWRITE,	"dw ");
> +	__seq_show_vmflag(VM_LOCKED,	"lo ");
> +	__seq_show_vmflag(VM_IO,	"io ");
> +	__seq_show_vmflag(VM_SEQ_READ,	"sr ");
> +	__seq_show_vmflag(VM_RAND_READ,	"rr ");
> +	__seq_show_vmflag(VM_DONTCOPY,	"dc ");
> +	__seq_show_vmflag(VM_DONTEXPAND,"de ");
> +	__seq_show_vmflag(VM_ACCOUNT,	"ac ");
> +	__seq_show_vmflag(VM_NORESERVE,	"nr ");
> +	__seq_show_vmflag(VM_HUGETLB,	"ht ");
> +	__seq_show_vmflag(VM_NONLINEAR,	"nl ");
> +	__seq_show_vmflag(VM_ARCH_1,	"ar ");
> +	__seq_show_vmflag(VM_DONTDUMP,	"dd ");
> +	__seq_show_vmflag(VM_MIXEDMAP,	"mm ");
> +	__seq_show_vmflag(VM_HUGEPAGE,	"hg ");
> +	__seq_show_vmflag(VM_NOHUGEPAGE,"nh ");
> +	__seq_show_vmflag(VM_MERGEABLE,	"mg ");
> +
> +	seq_putc(m, '\n');
> +
> +#undef __seq_show_vmflag
> +}

This code would be much denser if we did the old

	static const char foo[] = "rdwrexshmrmw...";
	unsigned i;

	for (i = 0; i < BITS_PER_LONG; i++) {
		if (flags & (1 << i))
			seq_printf("%c%c ", foo[i * 2], foo[i * 2 + 1]);
	}

trick.  But then we'd have to remember to fix foo[] each time we
alter the flags, so maybe let's not do that.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ