Skip to content

Fixes for common mistakes w/ for_each_process and task->mm

Anton Vorontsov linux-arm-kernel linux-mm linux-sh linux-um linuxppc-dev lkml 3 versions – In review

Get series with b4
b4 am 20120423070641.GA27702@lizard

Versions newest first · linked by author and title

  1. v3 Latest9 patches 6 repliesIn review
  2. v210 patches 15 repliesSuperseded
  3. v18 patches 9 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9cpu: Introduce clear_tasks_mm_cpumask() helperinclude/linux/cpu.h kernel/cpu.c+27 -04 replies
2/9arm: Use clear_tasks_mm_cpumask()arch/arm/kernel/smp.c+1 -70 replies
3/9powerpc: Use clear_tasks_mm_cpumask()arch/powerpc/mm/mmu_context_nohash.c+2 -90 replies
4/9sh: Use clear_tasks_mm_cpumask()arch/sh/kernel/smp.c+1 -60 replies
5/9blackfin: A couple of task->mm handling fixesarch/blackfin/kernel/trace.c+13 -131 reply
6/9blackfin: Fix possible deadlock in decode_address()arch/blackfin/kernel/trace.c+3 -30 replies
7/9um: Should hold tasklist_lock while traversing processesarch/um/kernel/reboot.c+3 -02 replies
8/9um: Fix possible race on task->mmarch/um/kernel/reboot.c+5 -20 replies
9/9um: Properly check all process' threads for a live mmarch/um/kernel/reboot.c+7 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/9] Fixes for common mistakes w/ for_each_process and task->mm

Hi all,

This is another resend of several task->mm fixes, the bugs I found during LMK code audit. Architectures were traverse the tasklist in an unsafe manner, plus there are a few cases of unsafe access to task->mm in general.

There were no objections on the previous resend, and the final words were somewhere along "the patches are fine" line.

In v3:
- Dropped a controversal 'Make find_lock_task_mm() sparse-aware' patch;
- Reword arm and sh commit messages, per Oleg Nesterov's suggestions;
- Added an optimization trick in clear_tasks_mm_cpumask(): take only the rcu read lock, no need for the whole tasklist_lock. Suggested by Peter Zijlstra.

In v2:
- introduced a small helper in cpu.c: most arches duplicate the same [buggy] code snippet, so it's better to fix it and move the logic into a common function.

Thanks,

Signature · 2 lines
Anton Vorontsov
Email: cbouatmailru at gmail.com