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

Commit dd198ce7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull namespace updates from Eric Biederman:
 "Life has been busy and I have not gotten half as much done this round
  as I would have liked. I delayed it so that a minor conflict
  resolution with the mips tree could spend a little time in linux-next
  before I sent this pull request.

  This includes two long delayed user namespace changes from Kirill
  Tkhai. It also includes a very useful change from Serge Hallyn that
  allows the security capability attribute to be used inside of user
  namespaces. The practical effect of this is people can now untar
  tarballs and install rpms in user namespaces. It had been suggested to
  generalize this and encode some of the namespace information
  information in the xattr name. Upon close inspection that makes the
  things that should be hard easy and the things that should be easy
  more expensive.

  Then there is my bugfix/cleanup for signal injection that removes the
  magic encoding of the siginfo union member from the kernel internal
  si_code. The mips folks reported the case where I had used FPE_FIXME
  me is impossible so I have remove FPE_FIXME from mips, while at the
  same time including a return statement in that case to keep gcc from
  complaining about unitialized variables.

  I almost finished the work to get make copy_siginfo_to_user a trivial
  copy to user. The code is available at:

     git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git neuter-copy_siginfo_to_user-v3

  But I did not have time/energy to get the code posted and reviewed
  before the merge window opened.

  I was able to see that the security excuse for just copying fields
  that we know are initialized doesn't work in practice there are buggy
  initializations that don't initialize the proper fields in siginfo. So
  we still sometimes copy unitialized data to userspace"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  Introduce v3 namespaced file capabilities
  mips/signal: In force_fcr31_sig return in the impossible case
  signal: Remove kernel interal si_code magic
  fcntl: Don't use ambiguous SIG_POLL si_codes
  prctl: Allow local CAP_SYS_ADMIN changing exe_file
  security: Use user_namespace::level to avoid redundant iterations in cap_capable()
  userns,pidns: Verify the userns for new pid namespaces
  signal/testing: Don't look for __SI_FAULT in userspace
  signal/mips: Document a conflict with SI_USER with SIGFPE
  signal/sparc: Document a conflict with SI_USER with SIGFPE
  signal/ia64: Document a conflict with SI_USER with SIGFPE
  signal/alpha: Document a conflict with SI_USER for SIGTRAP
parents 89fd915c 076a9bca
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -6,4 +6,18 @@


#include <asm-generic/siginfo.h>
#include <asm-generic/siginfo.h>


/*
 * SIGFPE si_codes
 */
#ifdef __KERNEL__
#define FPE_FIXME	0	/* Broken dup of SI_USER */
#endif /* __KERNEL__ */

/*
 * SIGTRAP si_codes
 */
#ifdef __KERNEL__
#define TRAP_FIXME	0	/* Broken dup of SI_USER */
#endif /* __KERNEL__ */

#endif
#endif
+3 −3
Original line number Original line Diff line number Diff line
@@ -280,7 +280,7 @@ do_entIF(unsigned long type, struct pt_regs *regs)
	      case 1: /* bugcheck */
	      case 1: /* bugcheck */
		info.si_signo = SIGTRAP;
		info.si_signo = SIGTRAP;
		info.si_errno = 0;
		info.si_errno = 0;
		info.si_code = __SI_FAULT;
		info.si_code = TRAP_FIXME;
		info.si_addr = (void __user *) regs->pc;
		info.si_addr = (void __user *) regs->pc;
		info.si_trapno = 0;
		info.si_trapno = 0;
		send_sig_info(SIGTRAP, &info, current);
		send_sig_info(SIGTRAP, &info, current);
@@ -320,7 +320,7 @@ do_entIF(unsigned long type, struct pt_regs *regs)
			break;
			break;
		case GEN_ROPRAND:
		case GEN_ROPRAND:
			signo = SIGFPE;
			signo = SIGFPE;
			code = __SI_FAULT;
			code = FPE_FIXME;
			break;
			break;


		case GEN_DECOVF:
		case GEN_DECOVF:
@@ -342,7 +342,7 @@ do_entIF(unsigned long type, struct pt_regs *regs)
		case GEN_SUBRNG7:
		case GEN_SUBRNG7:
		default:
		default:
			signo = SIGTRAP;
			signo = SIGTRAP;
			code = __SI_FAULT;
			code = TRAP_FIXME;
			break;
			break;
		}
		}


+9 −14
Original line number Original line Diff line number Diff line
@@ -142,25 +142,25 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
	 */
	 */
	err = __put_user(from->si_signo, &to->si_signo);
	err = __put_user(from->si_signo, &to->si_signo);
	err |= __put_user(from->si_errno, &to->si_errno);
	err |= __put_user(from->si_errno, &to->si_errno);
	err |= __put_user((short)from->si_code, &to->si_code);
	err |= __put_user(from->si_code, &to->si_code);
	if (from->si_code < 0)
	if (from->si_code < 0)
		err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad,
		err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad,
				      SI_PAD_SIZE);
				      SI_PAD_SIZE);
	else switch (from->si_code & __SI_MASK) {
	else switch (siginfo_layout(from->si_signo, from->si_code)) {
	case __SI_KILL:
	case SIL_KILL:
		err |= __put_user(from->si_pid, &to->si_pid);
		err |= __put_user(from->si_pid, &to->si_pid);
		err |= __put_user(from->si_uid, &to->si_uid);
		err |= __put_user(from->si_uid, &to->si_uid);
		break;
		break;
	case __SI_TIMER:
	case SIL_TIMER:
		 err |= __put_user(from->si_tid, &to->si_tid);
		 err |= __put_user(from->si_tid, &to->si_tid);
		 err |= __put_user(from->si_overrun, &to->si_overrun);
		 err |= __put_user(from->si_overrun, &to->si_overrun);
		 err |= __put_user(from->si_int, &to->si_int);
		 err |= __put_user(from->si_int, &to->si_int);
		break;
		break;
	case __SI_POLL:
	case SIL_POLL:
		err |= __put_user(from->si_band, &to->si_band);
		err |= __put_user(from->si_band, &to->si_band);
		err |= __put_user(from->si_fd, &to->si_fd);
		err |= __put_user(from->si_fd, &to->si_fd);
		break;
		break;
	case __SI_FAULT:
	case SIL_FAULT:
		err |= __put_user((compat_uptr_t)(unsigned long)from->si_addr,
		err |= __put_user((compat_uptr_t)(unsigned long)from->si_addr,
				  &to->si_addr);
				  &to->si_addr);
#ifdef BUS_MCEERR_AO
#ifdef BUS_MCEERR_AO
@@ -173,29 +173,24 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
			err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
			err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
#endif
#endif
		break;
		break;
	case __SI_CHLD:
	case SIL_CHLD:
		err |= __put_user(from->si_pid, &to->si_pid);
		err |= __put_user(from->si_pid, &to->si_pid);
		err |= __put_user(from->si_uid, &to->si_uid);
		err |= __put_user(from->si_uid, &to->si_uid);
		err |= __put_user(from->si_status, &to->si_status);
		err |= __put_user(from->si_status, &to->si_status);
		err |= __put_user(from->si_utime, &to->si_utime);
		err |= __put_user(from->si_utime, &to->si_utime);
		err |= __put_user(from->si_stime, &to->si_stime);
		err |= __put_user(from->si_stime, &to->si_stime);
		break;
		break;
	case __SI_RT: /* This is not generated by the kernel as of now. */
	case SIL_RT:
	case __SI_MESGQ: /* But this is */
		err |= __put_user(from->si_pid, &to->si_pid);
		err |= __put_user(from->si_pid, &to->si_pid);
		err |= __put_user(from->si_uid, &to->si_uid);
		err |= __put_user(from->si_uid, &to->si_uid);
		err |= __put_user(from->si_int, &to->si_int);
		err |= __put_user(from->si_int, &to->si_int);
		break;
		break;
	case __SI_SYS:
	case SIL_SYS:
		err |= __put_user((compat_uptr_t)(unsigned long)
		err |= __put_user((compat_uptr_t)(unsigned long)
				from->si_call_addr, &to->si_call_addr);
				from->si_call_addr, &to->si_call_addr);
		err |= __put_user(from->si_syscall, &to->si_syscall);
		err |= __put_user(from->si_syscall, &to->si_syscall);
		err |= __put_user(from->si_arch, &to->si_arch);
		err |= __put_user(from->si_arch, &to->si_arch);
		break;
		break;
	default: /* this is just in case for now ... */
		err |= __put_user(from->si_pid, &to->si_pid);
		err |= __put_user(from->si_uid, &to->si_uid);
		break;
	}
	}
	return err;
	return err;
}
}
+19 −11
Original line number Original line Diff line number Diff line
@@ -14,28 +14,36 @@


#define si_uid16	_sifields._kill._uid
#define si_uid16	_sifields._kill._uid


#define ILL_ILLPARAOP	(__SI_FAULT|2)	/* illegal opcode combine ********** */
#define ILL_ILLPARAOP	2	/* illegal opcode combine ********** */
#define ILL_ILLEXCPT	(__SI_FAULT|4)	/* unrecoverable exception ********** */
#define ILL_ILLEXCPT	4	/* unrecoverable exception ********** */
#define ILL_CPLB_VI	(__SI_FAULT|9)	/* D/I CPLB protect violation ******** */
#define ILL_CPLB_VI	9	/* D/I CPLB protect violation ******** */
#define ILL_CPLB_MISS	(__SI_FAULT|10)	/* D/I CPLB miss ******** */
#define ILL_CPLB_MISS	10	/* D/I CPLB miss ******** */
#define ILL_CPLB_MULHIT	(__SI_FAULT|11)	/* D/I CPLB multiple hit ******** */
#define ILL_CPLB_MULHIT	11	/* D/I CPLB multiple hit ******** */
#undef NSIGILL
#define NSIGILL         11


/*
/*
 * SIGBUS si_codes
 * SIGBUS si_codes
 */
 */
#define BUS_OPFETCH	(__SI_FAULT|4)	/* error from instruction fetch ******** */
#define BUS_OPFETCH	4	/* error from instruction fetch ******** */
#undef NSIGBUS
#define NSIGBUS		4


/*
/*
 * SIGTRAP si_codes
 * SIGTRAP si_codes
 */
 */
#define TRAP_STEP	(__SI_FAULT|1)	/* single-step breakpoint************* */
#define TRAP_STEP	1	/* single-step breakpoint************* */
#define TRAP_TRACEFLOW	(__SI_FAULT|2)	/* trace buffer overflow ************* */
#define TRAP_TRACEFLOW	2	/* trace buffer overflow ************* */
#define TRAP_WATCHPT	(__SI_FAULT|3)	/* watchpoint match      ************* */
#define TRAP_WATCHPT	3	/* watchpoint match      ************* */
#define TRAP_ILLTRAP	(__SI_FAULT|4)	/* illegal trap          ************* */
#define TRAP_ILLTRAP	4	/* illegal trap          ************* */
#undef NSIGTRAP
#define NSIGTRAP	4


/*
/*
 * SIGSEGV si_codes
 * SIGSEGV si_codes
 */
 */
#define SEGV_STACKFLOW	(__SI_FAULT|3)	/* stack overflow */
#define SEGV_STACKFLOW	3	/* stack overflow */
#undef NSIGSEGV
#define NSIGSEGV	3


#endif /* _UAPI_BFIN_SIGINFO_H */
#endif /* _UAPI_BFIN_SIGINFO_H */
+1 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <asm-generic/siginfo.h>
#include <asm-generic/siginfo.h>


#define FPE_MDAOVF	(__SI_FAULT|9)	/* media overflow */
#define FPE_MDAOVF	9	/* media overflow */
#undef NSIGFPE
#undef NSIGFPE
#define NSIGFPE		9
#define NSIGFPE		9


Loading