···1772177217731773config SECCOMP17741774 bool "Enable seccomp to safely compute untrusted bytecode"17751775- depends on PROC_FS && BROKEN17751775+ depends on PROC_FS17761776 default y17771777 help17781778 This kernel feature is useful for number crunching applications
···5050 cpumask_t effective_mask;5151 int retval;5252 struct task_struct *p;5353+ struct thread_info *ti;53545455 if (len < sizeof(new_mask))5556 return -EINVAL;···9493 read_unlock(&tasklist_lock);95949695 /* Compute new global allowed CPU set if necessary */9797- if ((p->thread.mflags & MF_FPUBOUND)9898- && cpus_intersects(new_mask, mt_fpu_cpumask)) {9696+ ti = task_thread_info(p);9797+ if (test_ti_thread_flag(ti, TIF_FPUBOUND) &&9898+ cpus_intersects(new_mask, mt_fpu_cpumask)) {9999 cpus_and(effective_mask, new_mask, mt_fpu_cpumask);100100 retval = set_cpus_allowed(p, effective_mask);101101 } else {102102- p->thread.mflags &= ~MF_FPUBOUND;102102+ clear_ti_thread_flag(ti, TIF_FPUBOUND);103103 retval = set_cpus_allowed(p, new_mask);104104 }105105-106105107106out_unlock:108107 put_task_struct(p);
+1-1
arch/mips/kernel/process.c
···7777 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|KU_MASK);7878#ifdef CONFIG_64BIT7979 status &= ~ST0_FR;8080- status |= (current->thread.mflags & MF_32BIT_REGS) ? 0 : ST0_FR;8080+ status |= test_thread_flag(TIF_32BIT_REGS) ? 0 : ST0_FR;8181#endif8282 status |= KU_USER;8383 regs->cp0_status = status;
+10-4
arch/mips/kernel/ptrace.c
···2020#include <linux/mm.h>2121#include <linux/errno.h>2222#include <linux/ptrace.h>2323-#include <linux/audit.h>2423#include <linux/smp.h>2524#include <linux/user.h>2625#include <linux/security.h>2727-#include <linux/signal.h>2626+#include <linux/audit.h>2727+#include <linux/seccomp.h>28282929#include <asm/byteorder.h>3030#include <asm/cpu.h>···470470 */471471asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)472472{473473+ /* do the secure computing check first */474474+ if (!entryexit)475475+ secure_computing(regs->regs[0]);476476+473477 if (unlikely(current->audit_context) && entryexit)474478 audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]),475479 regs->regs[2]);476480477481 if (!(current->ptrace & PT_PTRACED))478482 goto out;483483+479484 if (!test_thread_flag(TIF_SYSCALL_TRACE))480485 goto out;481486···498493 send_sig(current->exit_code, current, 1);499494 current->exit_code = 0;500495 }501501- out:496496+497497+out:502498 if (unlikely(current->audit_context) && !entryexit)503503- audit_syscall_entry(audit_arch(), regs->regs[2],499499+ audit_syscall_entry(audit_arch(), regs->regs[0],504500 regs->regs[4], regs->regs[5],505501 regs->regs[6], regs->regs[7]);506502}
+13-5
arch/mips/kernel/syscall.c
···281281282282asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)283283{284284- int tmp;285285-286286- switch(cmd) {284284+ switch (cmd) {287285 case MIPS_ATOMIC_SET:288286 printk(KERN_CRIT "How did I get here?\n");289287 return -EINVAL;290288291289 case MIPS_FIXADE:292292- tmp = current->thread.mflags & ~3;293293- current->thread.mflags = tmp | (arg1 & 3);290290+ if (arg1 & ~3)291291+ return -EINVAL;292292+293293+ if (arg1 & 1)294294+ set_thread_flag(TIF_FIXADE);295295+ else296296+ clear_thread_flag(TIF_FIXADE);297297+ if (arg1 & 2)298298+ set_thread_flag(TIF_LOGADE);299299+ else300300+ clear_thread_flag(TIF_FIXADE);301301+294302 return 0;295303296304 case FLUSH_CACHE: