Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branches 'sched-urgent-for-linus' and 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull stack vmap fixups from Thomas Gleixner:
"Two small patches related to sched_show_task():

- make sure to hold a reference on the task stack while accessing it

- remove the thread_saved_pc printout

.. and add a sanity check into release_task_stack() to catch problems
with task stack references"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/core: Remove pointless printout in sched_show_task()
sched/core: Fix oops in sched_show_task()

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
fork: Add task stack refcounting sanity check and prevent premature task stack freeing

+7 -9
+4
kernel/fork.c
··· 315 315 316 316 static void release_task_stack(struct task_struct *tsk) 317 317 { 318 + if (WARN_ON(tsk->state != TASK_DEAD)) 319 + return; /* Better to leak the stack than to free prematurely */ 320 + 318 321 account_kernel_stack(tsk, -1); 319 322 arch_release_thread_stack(tsk->stack); 320 323 free_thread_stack(tsk); ··· 1865 1862 atomic_dec(&p->cred->user->processes); 1866 1863 exit_creds(p); 1867 1864 bad_fork_free: 1865 + p->state = TASK_DEAD; 1868 1866 put_task_stack(p); 1869 1867 free_task(p); 1870 1868 fork_out:
+3 -9
kernel/sched/core.c
··· 5192 5192 int ppid; 5193 5193 unsigned long state = p->state; 5194 5194 5195 + if (!try_get_task_stack(p)) 5196 + return; 5195 5197 if (state) 5196 5198 state = __ffs(state) + 1; 5197 5199 printk(KERN_INFO "%-15.15s %c", p->comm, 5198 5200 state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?'); 5199 - #if BITS_PER_LONG == 32 5200 - if (state == TASK_RUNNING) 5201 - printk(KERN_CONT " running "); 5202 - else 5203 - printk(KERN_CONT " %08lx ", thread_saved_pc(p)); 5204 - #else 5205 5201 if (state == TASK_RUNNING) 5206 5202 printk(KERN_CONT " running task "); 5207 - else 5208 - printk(KERN_CONT " %016lx ", thread_saved_pc(p)); 5209 - #endif 5210 5203 #ifdef CONFIG_DEBUG_STACK_USAGE 5211 5204 free = stack_not_used(p); 5212 5205 #endif ··· 5214 5221 5215 5222 print_worker_info(KERN_INFO, p); 5216 5223 show_stack(p, NULL); 5224 + put_task_stack(p); 5217 5225 } 5218 5226 5219 5227 void show_state_filter(unsigned long state_filter)