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:	Fri, 9 Sep 2011 16:41:30 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Arjan van de Ven <arjan@...radead.org>
Cc:	Vladimir Zapolskiy <vz@...ia.com>, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] sched: share task comm length value to userspace

On Mon, 5 Sep 2011 13:39:03 -0700
Arjan van de Ven <arjan@...radead.org> wrote:

> On Mon, 05 Sep 2011 23:17:05 +0300
> Vladimir Zapolskiy <vz@...ia.com> wrote:
> 
> > but eventually having that value in
> > userspace is really desirable. However in assumption that this value
> > is preserved fixed and won't be changed in reasonable perspective,
> > the presented approach becomes the most evident and simple.
> 
> yeah if it would never change, your change would be the most simple.
> but I really don't want to pin that thing down....
> 
> > 
> > >
> > > If we need to export this, we should export it in /proc or /sys
> > > somewhere as a dynamic value.....
> > >
> > Let's do it in a proper way. What's the common practice to export
> > such limit values? I suppose via /proc/sys/kernel, please correct me,
> > if I'm wrong.
> 
> that or /sys/kernel
> 
> personally I like /proc/sys/kernel for this kind of thing more, but...
> ... others might disagree.
> 

Run this:

#include <sys/prctl.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

main()
{
	char comm[512];
	int len;

	memset(comm, 0, sizeof(comm));
	for (len = 1; len < sizeof(comm) - 1; len++) {
		char comm2[512];
	
		comm[len - 1] = 'a';
		if (prctl(PR_SET_NAME, (unsigned long)comm, 0, 0, 0) < 0) {
			fprintf(stderr, "PR_SET_NAME failed with: %s\n",
					strerror(errno));
			exit(1);
		}
		if (prctl(PR_GET_NAME, (unsigned long)comm2, 0, 0, 0) < 0) {
			fprintf(stderr, "PR_SET_NAME failed with: %s\n",
					strerror(errno));
			exit(1);
		}
		if (strlen(comm2) != len) {
			printf("%d\n", len);
			break;
		}
	}
	exit(0);
}
			

once per boot, echoing the result into /etc/sizeof-comm.  Sell resulting
package to all vendors ;)


--
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