Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bebfa101 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds
Browse files

[PATCH] x86_64: Add compat_printk and sysctl to turn off compat layer warnings



Sometimes e.g. with crashme the compat layer warnings can be noisy.
Add a way to turn them off by gating all output through compat_printk
that checks a global sysctl. The default is not changed.

Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f201611f
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -514,7 +514,7 @@ int sys32_ni_syscall(int call)
	static char lastcomm[sizeof(me->comm)];
	static char lastcomm[sizeof(me->comm)];


	if (strncmp(lastcomm, me->comm, sizeof(lastcomm))) {
	if (strncmp(lastcomm, me->comm, sizeof(lastcomm))) {
		printk(KERN_INFO "IA32 syscall %d from %s not implemented\n",
		compat_printk(KERN_INFO "IA32 syscall %d from %s not implemented\n",
		       call, me->comm);
		       call, me->comm);
		strncpy(lastcomm, me->comm, sizeof(lastcomm));
		strncpy(lastcomm, me->comm, sizeof(lastcomm));
	} 
	} 
@@ -916,7 +916,7 @@ long sys32_vm86_warning(void)
	struct task_struct *me = current;
	struct task_struct *me = current;
	static char lastcomm[sizeof(me->comm)];
	static char lastcomm[sizeof(me->comm)];
	if (strncmp(lastcomm, me->comm, sizeof(lastcomm))) {
	if (strncmp(lastcomm, me->comm, sizeof(lastcomm))) {
		printk(KERN_INFO "%s: vm86 mode not supported on 64 bit kernel\n",
		compat_printk(KERN_INFO "%s: vm86 mode not supported on 64 bit kernel\n",
		       me->comm);
		       me->comm);
		strncpy(lastcomm, me->comm, sizeof(lastcomm));
		strncpy(lastcomm, me->comm, sizeof(lastcomm));
	} 
	} 
+15 −1
Original line number Original line Diff line number Diff line
@@ -55,6 +55,20 @@


extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);


int compat_log = 1;

int compat_printk(const char *fmt, ...)
{
	va_list ap;
	int ret;
	if (!compat_log)
		return 0;
	va_start(ap, fmt);
	ret = vprintk(fmt, ap);
	va_end(ap);
	return ret;
}

/*
/*
 * Not all architectures have sys_utime, so implement this in terms
 * Not all architectures have sys_utime, so implement this in terms
 * of sys_utimes.
 * of sys_utimes.
@@ -359,7 +373,7 @@ static void compat_ioctl_error(struct file *filp, unsigned int fd,
	sprintf(buf,"'%c'", (cmd>>24) & 0x3f);
	sprintf(buf,"'%c'", (cmd>>24) & 0x3f);
	if (!isprint(buf[1]))
	if (!isprint(buf[1]))
		sprintf(buf, "%02x", buf[1]);
		sprintf(buf, "%02x", buf[1]);
	printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
	compat_printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
			"cmd(%08x){%s} arg(%08x) on %s\n",
			"cmd(%08x){%s} arg(%08x) on %s\n",
			current->comm, current->pid,
			current->comm, current->pid,
			(int)fd, (unsigned int)cmd, buf,
			(int)fd, (unsigned int)cmd, buf,
+2 −0
Original line number Original line Diff line number Diff line
@@ -226,5 +226,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,


asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);


extern int compat_printk(const char *fmt, ...);

#endif /* CONFIG_COMPAT */
#endif /* CONFIG_COMPAT */
#endif /* _LINUX_COMPAT_H */
#endif /* _LINUX_COMPAT_H */
+2 −0
Original line number Original line Diff line number Diff line
@@ -148,9 +148,11 @@ enum
	KERN_SPIN_RETRY=70,	/* int: number of spinlock retries */
	KERN_SPIN_RETRY=70,	/* int: number of spinlock retries */
	KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
	KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
	KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
	KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
	KERN_COMPAT_LOG=73,	/* int: print compat layer  messages */
};
};





/* CTL_VM names: */
/* CTL_VM names: */
enum
enum
{
{
+11 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,7 @@ extern int printk_ratelimit_burst;
extern int pid_max_min, pid_max_max;
extern int pid_max_min, pid_max_max;
extern int sysctl_drop_caches;
extern int sysctl_drop_caches;
extern int percpu_pagelist_fraction;
extern int percpu_pagelist_fraction;
extern int compat_log;


#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
int unknown_nmi_panic;
int unknown_nmi_panic;
@@ -676,6 +677,16 @@ static ctl_table kern_table[] = {
	 	.mode		= 0644,
	 	.mode		= 0644,
		.proc_handler	= &proc_dointvec,
		.proc_handler	= &proc_dointvec,
	},
	},
#endif
#ifdef CONFIG_COMPAT
	{
		.ctl_name	= KERN_COMPAT_LOG,
		.procname	= "compat-log",
		.data		= &compat_log,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
		.proc_handler	= &proc_dointvec,
	},
#endif
#endif
	{ .ctl_name = 0 }
	{ .ctl_name = 0 }
};
};