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:	Tue, 30 Oct 2007 10:40:46 -0700
From:	Joe Perches <joe@...ches.com>
To:	Jeff Dike <jdike@...toit.com>
Cc:	Andrew Morton <akpm@...l.org>, LKML <linux-kernel@...r.kernel.org>,
	uml-devel <user-mode-linux-devel@...ts.sourceforge.net>
Subject: Re: [PATCH 3/4] UML - Implement get_wchan

On Tue, 2007-10-30 at 13:28 -0400, Jeff Dike wrote:
> +unsigned long get_wchan(struct task_struct *p)
> +{
> +	unsigned long stack_page, sp, ip, count = 0;

Perhaps instead of unsigned long?

bool skipped_ip;	//delayed initialization

> +
> +	if ((p == NULL) || (p == current) || (p->state == TASK_RUNNING))
> +		return 0;
> +
> +	stack_page = (unsigned long) task_stack_page(p);
> +	/* Bail if the process has no kernel stack for some reason */
> +	if (stack_page == 0)
> +		return 0;
> +
> +	sp = p->thread.switch_buf->JB_SP;
> +	/*
> +	 * Bail if the stack pointer is below the bottom of the kernel
> +	 * stack for some reason
> +	 */
> +	if (sp < stack_page)
> +		return 0;
> +

	skipped_ip = false;

> +	while (sp < stack_page + THREAD_SIZE) {
> +		ip = *((unsigned long *) sp);
> +		if (kernel_text_address(ip) && !in_sched_functions(ip)) {
> +			/*
> +			 * Skip one valid IP, which will be the low-level UML
> +			 * context switcher.
> +			 */
> +			if (count++ == 1)
> +				return ip;

			if (skipped_ip)
				return ip;
			skipped_ip = true;
> 
> +		}
> +
> +		sp += sizeof(unsigned long);
> +	}


-
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