1. 08 Oct, 2005 1 commit
    • Oleg Nesterov's avatar
      [PATCH] fix do_coredump() vs SIGSTOP race · 788e05a6
      Oleg Nesterov authored
      
      Let's suppose we have 2 threads in thread group:
      	A - does coredump
      	B - has pending SIGSTOP
      
      thread A						thread B
      
      do_coredump:						get_signal_to_deliver:
      
        lock(->sighand)
        ->signal->flags = SIGNAL_GROUP_EXIT
        unlock(->sighand)
      
      							lock(->sighand)
      							signr = dequeue_signal()
      								->signal->flags |= SIGNAL_STOP_DEQUEUED
      								return SIGSTOP;
      
      							do_signal_stop:
      							    unlock(->sighand)
      
        coredump_wait:
      
            zap_threads:
                lock(tasklist_lock)
                send SIGKILL to B
                    // signal_wake_up() does nothing
                unlock(tasklist_lock)
      
      							    lock(tasklist_lock)
      							    lock(->sighand)
      							    re-check sig->flags & SIGNAL_STOP_DEQUEUED, yes
      							    set_current_state(TASK_STOPPED);
      							    finish_stop:
      							        schedule();
      							            // ->state == TASK_STOPPED
      
            wait_for_completion(&startup_done)
               // waits for complete() from B,
               // ->state == TASK_UNINTERRUPTIBLE
      
      We can't wake up 'B' in any way:
      
      	SIGCONT will be ignored because handle_stop_signal() sees
      	->signal->flags & SIGNAL_GROUP_EXIT.
      
      	sys_kill(SIGKILL)->__group_complete_signal() will choose
      	uninterruptible 'A', so it can't help.
      
      	sys_tkill(B, SIGKILL) will be ignored by specific_send_sig_info()
      	because B already has pending SIGKILL.
      
      This scenario is not possbile if 'A' does do_group_exit(), because
      it sets sig->flags = SIGNAL_GROUP_EXIT and delivers SIGKILL to
      subthreads atomically, holding both tasklist_lock and sighand->lock.
      That means that do_signal_stop() will notice !SIGNAL_STOP_DEQUEUED
      after re-locking ->sighand. And it is not possible to any other
      thread to re-add SIGNAL_STOP_DEQUEUED later, because dequeue_signal()
      can only return SIGKILL.
      
      I think it is better to change do_coredump() to do sigaddset(SIGKILL)
      and signal_wake_up() under sighand->lock, but this patch is much
      simpler.
      Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      788e05a6
  2. 29 Sep, 2005 1 commit
  3. 23 Sep, 2005 1 commit
    • Linus Torvalds's avatar
      Make sure SIGKILL gets proper respect · 188a1eaf
      Linus Torvalds authored
      
      Bhavesh P. Davda <bhavesh@avaya.com> noticed that SIGKILL wouldn't
      properly kill a process under just the right cicumstances: a stopped
      task that already had another signal queued would get the SIGKILL
      queued onto the shared queue, and there it would remain until SIGCONT.
      
      This simplifies the signal acceptance logic, and fixes the bug in the
      process.
      
      Losely based on an earlier patch by Bhavesh.
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      188a1eaf
  4. 10 Sep, 2005 1 commit
  5. 07 Sep, 2005 2 commits
  6. 17 Aug, 2005 1 commit
    • Bhavesh P. Davda's avatar
      [PATCH] NPTL signal delivery deadlock fix · dd12f48d
      Bhavesh P. Davda authored
      
      This bug is quite subtle and only happens in a very interesting
      situation where a real-time threaded process is in the middle of a
      coredump when someone whacks it with a SIGKILL.  However, this deadlock
      leaves the system pretty hosed and you have to reboot to recover.
      
      Not good for real-time priority-preemption applications like our
      telephony application, with 90+ real-time (SCHED_FIFO and SCHED_RR)
      processes, many of them multi-threaded, interacting with each other for
      high volume call processing.
      Acked-by: default avatarRoland McGrath <roland@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      dd12f48d
  7. 25 Jun, 2005 1 commit
    • Christoph Lameter's avatar
      [PATCH] Cleanup patch for process freezing · 3e1d1d28
      Christoph Lameter authored
      
      1. Establish a simple API for process freezing defined in linux/include/sched.h:
      
         frozen(process)		Check for frozen process
         freezing(process)		Check if a process is being frozen
         freeze(process)		Tell a process to freeze (go to refrigerator)
         thaw_process(process)	Restart process
         frozen_process(process)	Process is frozen now
      
      2. Remove all references to PF_FREEZE and PF_FROZEN from all
         kernel sources except sched.h
      
      3. Fix numerous locations where try_to_freeze is manually done by a driver
      
      4. Remove the argument that is no longer necessary from two function calls.
      
      5. Some whitespace cleanup
      
      6. Clear potential race in refrigerator (provides an open window of PF_FREEZE
         cleared before setting PF_FROZEN, recalc_sigpending does not check
         PF_FROZEN).
      
      This patch does not address the problem of freeze_processes() violating the rule
      that a task may only modify its own flags by setting PF_FREEZE. This is not clean
      in an SMP environment. freeze(process) is therefore not SMP safe!
      Signed-off-by: default avatarChristoph Lameter <christoph@lameter.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      3e1d1d28
  8. 23 Jun, 2005 1 commit
  9. 24 May, 2005 1 commit
  10. 06 May, 2005 1 commit
    • Steve Grubb's avatar
      The attached patch addresses the problem with getting the audit daemon · c2f0c7c3
      Steve Grubb authored
      shutdown credential information. It creates a new message type 
      AUDIT_TERM_INFO, which is used by the audit daemon to query who issued the 
      shutdown. 
      
      It requires the placement of a hook function that gathers the information. The 
      hook is after the DAC & MAC checks and before the function returns. Racing 
      threads could overwrite the uid & pid - but they would have to be root and 
      have policy that allows signalling the audit daemon. That should be a 
      manageable risk.
      
      The userspace component will be released later in audit 0.7.2. When it 
      receives the TERM signal, it queries the kernel for shutdown information. 
      When it receives it, it writes the message and exits. The message looks 
      like this:
      
      type=DAEMON msg=auditd(1114551182.000) auditd normal halt, sending pid=2650 
      uid=525, auditd pid=1685
      Signed-off-by: default avatarSteve Grubb <sgrubb@redhat.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      c2f0c7c3
  11. 01 May, 2005 1 commit
  12. 16 Apr, 2005 2 commits