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:	Wed, 23 Feb 2011 11:08:04 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Jason Baron <jbaron@...hat.com>
Cc:	hpa@...or.com, mathieu.desnoyers@...ymtl.ca, rostedt@...dmis.org,
	mingo@...e.hu, tglx@...utronix.de, andi@...stfloor.org,
	roland@...hat.com, rth@...hat.com, masami.hiramatsu.pt@...achi.com,
	fweisbec@...il.com, avi@...hat.com, davem@...emloft.net,
	sam@...nborg.org, ddaney@...iumnetworks.com,
	michael@...erman.id.au, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] jump label: introduce static_branch() interface

On Tue, 2011-02-22 at 17:28 -0500, Jason Baron wrote:
> 
> Define:
> 
>         struct jump_label_key jump_key;
> 
> Can be used as:
> 
>         if (static_branch(&jump_key))
>                 do unlikely code
> 
> enable/disale via:
> 
>         jump_label_enable(&jump_key);
>         jump_label_disable(&jump_key);
> 
> that's it! 

I think you'll find jump_label_{inc,dec}() works better ;-)

Also the below cleans up a comment, flips a conditional so that we dno't
evaluate kernel_text_address() for entries we already know are dead and
uses notifier_from_errno() so as not to confuse the notifier code.

---
Index: linux-2.6/kernel/jump_label.c
===================================================================
--- linux-2.6.orig/kernel/jump_label.c
+++ linux-2.6/kernel/jump_label.c
@@ -108,10 +108,12 @@ static void __jump_label_update(struct j
 		struct jump_entry *entry, int enable)
 {
 	for (; entry->key == (jump_label_t)(unsigned long)key; entry++) {
-		/* entry->code set to 0 invalidates module init text sections
-		 * kernel_text_address() verifies we are not in core kernel init
-		 * code */
-		if (kernel_text_address(entry->code) && entry->code)
+		/* 
+		 * entry->code set to 0 invalidates module init text sections
+		 * kernel_text_address() verifies we are not in core kernel
+		 * init code, see jump_label_invalidate_module_init().
+		 */
+		if (entry->code && kernel_text_address(entry->code))
 			arch_jump_label_transform(entry, enable);
 	}
 }
@@ -315,7 +317,8 @@ jump_label_module_notify(struct notifier
 		jump_label_unlock();
 		break;
 	}
-	return ret;
+
+	return notifier_from_errno(ret);
 }
 
 struct notifier_block jump_label_module_nb = {

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