Ejemplo n.º 1
0
asmlinkage int sys_modify_ldt(int func, void __user *ptr,
			      unsigned long bytecount)
{
	int ret = -ENOSYS;

	if (!sysctl_modify_ldt) {
		printk_ratelimited(KERN_INFO
			"Denied a call to modify_ldt() from %s[%d] (uid: %d)."
			" Adjust sysctl if this was not an exploit attempt.\n",
			current->comm, task_pid_nr(current),
			from_kuid_munged(current_user_ns(), current_uid()));
		return ret;
	}

	switch (func) {
	case 0:
		ret = read_ldt(ptr, bytecount);
		break;
	case 1:
		ret = write_ldt(ptr, bytecount, 1);
		break;
	case 2:
		ret = read_default_ldt(ptr, bytecount);
		break;
	case 0x11:
		ret = write_ldt(ptr, bytecount, 0);
		break;
	}
	return ret;
}
Ejemplo n.º 2
0
asmlinkage int
sys32_modify_ldt (int func, unsigned int ptr, unsigned int bytecount)
{
	int ret = -ENOSYS;

	switch (func) {
	      case 0:
		ret = read_ldt(P(ptr), bytecount);
		break;
	      case 1:
		ret = write_ldt(P(ptr), bytecount, 1);
		break;
	      case 2:
		ret = read_default_ldt(P(ptr), bytecount);
		break;
	      case 0x11:
		ret = write_ldt(P(ptr), bytecount, 0);
		break;
	}
	return ret;
}
Ejemplo n.º 3
0
asmlinkage int sys_modify_ldt(int func, void __user *ptr,
			      unsigned long bytecount)
{
	int ret = -ENOSYS;

	switch (func) {
	case 0:
		ret = read_ldt(ptr, bytecount);
		break;
	case 1:
		ret = write_ldt(ptr, bytecount, 1);
		break;
	case 2:
		ret = read_default_ldt(ptr, bytecount);
		break;
	case 0x11:
		ret = write_ldt(ptr, bytecount, 0);
		break;
	}
	return ret;
}