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]
Message-ID: <20160406163356.hba6jzkloaukknn4@treble.redhat.com>
Date:	Wed, 6 Apr 2016 11:33:56 -0500
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Petr Mladek <pmladek@...e.com>
Cc:	Jiri Kosina <jikos@...nel.org>, Jessica Yu <jeyu@...hat.com>,
	Miroslav Benes <mbenes@...e.cz>, linux-kernel@...r.kernel.org,
	live-patching@...r.kernel.org, Vojtech Pavlik <vojtech@...e.com>
Subject: Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a
 task has been preempted

On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote:
> On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote:
> > This is a horrible way to detect whether a task has been preempted.
> > Come up with something better: task flag?  or is there already an
> > existing mechanism?
> 
> What about using kallsyms_lookup_size_offset() to check the address.
> It is more heavyweight but less hacky. The following code seems
> to work for me:
> 
> bool in_preempt_schedule_irq(unsigned long addr)
> {
> 	static unsigned long size;
> 
> 	if (unlikely(!size)) {
> 		int ret;
> 
> 		ret = kallsyms_lookup_size_offset(
> 				(unsigned long)preempt_schedule_irq,
> 				size, NULL);
> 
> 		/*
> 		 * Warn when the function is used without kallsyms or
> 		 * when it is unable to locate preempt_schedule_irq().
> 		 * Be conservative and always return true in this case.
> 		 */
> 		if (WARN_ON(!ret))
> 			size = -1L;
> 	}
> 
> 	return (addr - (unsigned long)preempt_schedule_irq <= size);
> }

Yeah, that would definitely be better.  Though still somewhat hacky.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ