 9429ec96c2
			
		
	
	
	9429ec96c2
	
	
	
		
			
			The userspace part of UML uses the asm-offsets.h generator mechanism to
create definitions for UM_KERN_<LEVEL> that match the in-kernel
KERN_<LEVEL> constant definitions.
As of commit 04d2c8c83d ("printk: convert
the format for KERN_<LEVEL> to a 2 byte pattern"), KERN_<LEVEL> is no
longer expanded to the literal '"<LEVEL>"', but to '"\001" "LEVEL"', i.e.
it contains two parts.
However, the combo of DEFINE_STR() in
arch/x86/um/shared/sysdep/kernel-offsets.h and sed-y in Kbuild doesn't
support string literals consisting of multiple parts. Hence for all
UM_KERN_<LEVEL> definitions, only the SOH character is retained in the actual
definition, while the remainder ends up in the comment. E.g. in
include/generated/asm-offsets.h we get
    #define UM_KERN_INFO "\001" /* "6" KERN_INFO */
instead of
    #define UM_KERN_INFO "\001" "6" /* KERN_INFO */
This causes spurious '^A' output in some kernel messages:
    Calibrating delay loop... 4640.76 BogoMIPS (lpj=23203840)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 256
    ^AChecking that host ptys support output SIGIO...Yes
    ^AChecking that host ptys support SIGIO on close...No, enabling workaround
    ^AUsing 2.6 host AIO
    NET: Registered protocol family 16
    bio: create slab <bio-0> at 0
    Switching to clocksource itimer
To fix this:
  - Move the mapping from UM_KERN_<LEVEL> to KERN_<LEVEL> from
    arch/um/include/shared/common-offsets.h to
    arch/um/include/shared/user.h, which is preincluded for all userspace
    parts,
  - Preinclude include/linux/kern_levels.h for all userspace parts, to
    obtain the in-kernel KERN_<LEVEL> constant definitions. This doesn't
    violate the kernel/userspace separation, as include/linux/kern_levels.h
    is self-contained and doesn't expose any other kernel internals.
  - Remove the now unused STR() and DEFINE_STR() macros.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
		
	
			
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			1,011 B
			
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1,011 B
			
		
	
	
	
		
			C
		
	
	
	
	
	
| /* for use by sys-$SUBARCH/kernel-offsets.c */
 | |
| 
 | |
| DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
 | |
| 
 | |
| DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
 | |
| DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK);
 | |
| DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT);
 | |
| DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
 | |
| 
 | |
| DEFINE(UM_ELF_CLASS, ELF_CLASS);
 | |
| DEFINE(UM_ELFCLASS32, ELFCLASS32);
 | |
| DEFINE(UM_ELFCLASS64, ELFCLASS64);
 | |
| 
 | |
| DEFINE(UM_NR_CPUS, NR_CPUS);
 | |
| 
 | |
| DEFINE(UM_GFP_KERNEL, GFP_KERNEL);
 | |
| DEFINE(UM_GFP_ATOMIC, GFP_ATOMIC);
 | |
| 
 | |
| /* For crypto assembler code. */
 | |
| DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
 | |
| 
 | |
| DEFINE(UM_THREAD_SIZE, THREAD_SIZE);
 | |
| 
 | |
| DEFINE(UM_HZ, HZ);
 | |
| 
 | |
| DEFINE(UM_USEC_PER_SEC, USEC_PER_SEC);
 | |
| DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
 | |
| DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC);
 | |
| 
 | |
| #ifdef CONFIG_PRINTK
 | |
| DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK);
 | |
| #endif
 | |
| #ifdef CONFIG_NO_HZ
 | |
| DEFINE(UML_CONFIG_NO_HZ, CONFIG_NO_HZ);
 | |
| #endif
 | |
| #ifdef CONFIG_UML_X86
 | |
| DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86);
 | |
| #endif
 | |
| #ifdef CONFIG_64BIT
 | |
| DEFINE(UML_CONFIG_64BIT, CONFIG_64BIT);
 | |
| #endif
 |