linux-next: manual merge of the printk tree with Linus' tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Petr,

Today's linux-next merge of the printk tree got a conflict in:

  lib/vsprintf.c

between commit:

  85f4f12d51397f164 ("vsprintf: Replace memory barrier with static_key for random_ptr_key update")

from Linus' tree and commits:

  558594f3c2a5cd65f ("lib/vsprintf: Move pointer_string() upper)"
  496a9a5f3806d58b1 ("lib/vsprintf: Deduplicate pointer_string()")

from the printk tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc lib/vsprintf.c
index 23920c5ff728,7649ef4ed7d0..000000000000
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@@ -1655,36 -1644,19 +1654,22 @@@ char *device_node_string(char *buf, cha
  	return widen_string(buf, buf - buf_start, end, spec);
  }
  
- static noinline_for_stack
- char *pointer_string(char *buf, char *end, const void *ptr,
- 		     struct printf_spec spec)
- {
- 	spec.base = 16;
- 	spec.flags |= SMALL;
- 	if (spec.field_width == -1) {
- 		spec.field_width = 2 * sizeof(ptr);
- 		spec.flags |= ZEROPAD;
- 	}
- 
- 	return number(buf, end, (unsigned long int)ptr, spec);
- }
- 
 -static bool have_filled_random_ptr_key __read_mostly;
 +static DEFINE_STATIC_KEY_TRUE(not_filled_random_ptr_key);
  static siphash_key_t ptr_key __read_mostly;
  
 -static void fill_random_ptr_key(struct random_ready_callback *unused)
 +static void enable_ptr_key_workfn(struct work_struct *work)
  {
  	get_random_bytes(&ptr_key, sizeof(ptr_key));
 -	/*
 -	 * have_filled_random_ptr_key==true is dependent on get_random_bytes().
 -	 * ptr_to_id() needs to see have_filled_random_ptr_key==true
 -	 * after get_random_bytes() returns.
 -	 */
 -	smp_mb();
 -	WRITE_ONCE(have_filled_random_ptr_key, true);
 +	/* Needs to run from preemptible context */
 +	static_branch_disable(&not_filled_random_ptr_key);
 +}
 +
 +static DECLARE_WORK(enable_ptr_key_work, enable_ptr_key_workfn);
 +
 +static void fill_random_ptr_key(struct random_ready_callback *unused)
 +{
 +	/* This may be in an interrupt handler. */
 +	queue_work(system_unbound_wq, &enable_ptr_key_work);
  }
  
  static struct random_ready_callback random_ready = {
@@@ -1710,13 -1681,13 +1695,13 @@@ early_initcall(initialize_ptr_random)
  /* Maps a pointer to a 32 bit unique identifier. */
  static char *ptr_to_id(char *buf, char *end, void *ptr, struct printf_spec spec)
  {
+ 	const char *str = sizeof(ptr) == 8 ? "(____ptrval____)" : "(ptrval)";
  	unsigned long hashval;
- 	const int default_width = 2 * sizeof(ptr);
  
 -	if (unlikely(!have_filled_random_ptr_key)) {
 +	if (static_branch_unlikely(&not_filled_random_ptr_key)) {
- 		spec.field_width = default_width;
+ 		spec.field_width = 2 * sizeof(ptr);
  		/* string length must be less than default_width */
- 		return string(buf, end, "(ptrval)", spec);
+ 		return string(buf, end, str, spec);
  	}
  
  #ifdef CONFIG_64BIT

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux