Skip to content
Snippets Groups Projects
  1. Oct 17, 2005
  2. Oct 14, 2005
  3. Oct 10, 2005
    • Harald Welte's avatar
      [PATCH] Fix signal sending in usbdevio on async URB completion · 46113830
      Harald Welte authored
      
      If a process issues an URB from userspace and (starts to) terminate
      before the URB comes back, we run into the issue described above.  This
      is because the urb saves a pointer to "current" when it is posted to the
      device, but there's no guarantee that this pointer is still valid
      afterwards.
      
      In fact, there are three separate issues:
      
      1) the pointer to "current" can become invalid, since the task could be
         completely gone when the URB completion comes back from the device.
      
      2) Even if the saved task pointer is still pointing to a valid task_struct,
         task_struct->sighand could have gone meanwhile.
      
      3) Even if the process is perfectly fine, permissions may have changed,
         and we can no longer send it a signal.
      
      So what we do instead, is to save the PID and uid's of the process, and
      introduce a new kill_proc_info_as_uid() function.
      
      Signed-off-by: default avatarHarald Welte <laforge@gnumonks.org>
      [ Fixed up types and added symbol exports ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      46113830
    • Rafael J. Wysocki's avatar
      [PATCH] x86_64: Set up safe page tables during resume · 3dd08325
      Rafael J. Wysocki authored
      
      The following patch makes swsusp avoid the possible temporary corruption
      of page translation tables during resume on x86-64.  This is achieved by
      creating a copy of the relevant page tables that will not be modified by
      swsusp and can be safely used by it on resume.
      
      The problem is that during resume on x86-64 swsusp may temporarily
      corrupt the page tables used for the direct mapping of RAM.  If that
      happens, a page fault occurs and cannot be handled properly, which leads
      to the solid hang of the affected system.  This leads to the loss of the
      system's state from before suspend and may result in the loss of data or
      the corruption of filesystems, so it is a serious issue.  Also, it
      appears to happen quite often (for me, as often as 50% of the time).
      
      The problem is related to the fact that (at least) one of the PMD
      entries used in the direct memory mapping (starting at PAGE_OFFSET)
      points to a page table the physical address of which is much greater
      than the physical address of the PMD entry itself.  Moreover,
      unfortunately, the physical address of the page table before suspend
      (i.e.  the one stored in the suspend image) happens to be different to
      the physical address of the corresponding page table used during resume
      (i.e.  the one that is valid right before swsusp_arch_resume() in
      arch/x86_64/kernel/suspend_asm.S is executed).  Thus while the image is
      restored, the "offending" PMD entry gets overwritten, so it does not
      point to the right physical address any more (i.e.  there's no page
      table at the address pointed to by it, because it points to the address
      the page table has been at during suspend).  Consequently, if the PMD
      entry is used later on, and it _is_ used in the process of copying the
      image pages, a page fault occurs, but it cannot be handled in the normal
      way and the system hangs.
      
      In principle we can call create_resume_mapping() from
      swsusp_arch_resume() (ie.  from suspend_asm.S), but then the memory
      allocations in create_resume_mapping(), resume_pud_mapping(), and
      resume_pmd_mapping() must be made carefully so that we use _only_
      NosaveFree pages in them (the other pages are overwritten by the loop in
      swsusp_arch_resume()).  Additionally, we are in atomic context at that
      time, so we cannot use GFP_KERNEL.  Moreover, if one of the allocations
      fails, we should free all of the allocated pages, so we need to trace
      them somehow.
      
      All of this is done in the appended patch, except that the functions
      populating the page tables are located in arch/x86_64/kernel/suspend.c
      rather than in init.c.  It may be done in a more elegan way in the
      future, with the help of some swsusp patches that are in the works now.
      
      [AK: move some externs into headers, renamed a function]
      
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarAndi Kleen <ak@suse.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      3dd08325
  4. Oct 08, 2005
    • Al Viro's avatar
      [PATCH] gfp flags annotations - part 1 · dd0fc66f
      Al Viro authored
      
       - added typedef unsigned int __nocast gfp_t;
      
       - replaced __nocast uses for gfp flags with gfp_t - it gives exactly
         the same warnings as far as sparse is concerned, doesn't change
         generated code (from gcc point of view we replaced unsigned int with
         typedef) and documents what's going on far better.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      dd0fc66f
    • 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
  5. Oct 01, 2005
    • Linus Torvalds's avatar
      Fix inequality comparison against "task->state" · 14bf01bb
      Linus Torvalds authored
      
      We should always use bitmask ops, rather than depend on some ordering of
      the different states.  With the TASK_NONINTERACTIVE flag, the inequality
      doesn't really work.
      
      Oleg Nesterov argues (likely correctly) that this test is unnecessary in
      the first place.  However, the minimal fix for now is to at least make
      it work in the presense of TASK_NONINTERACTIVE.  Waiting for consensus
      from Roland & co on potential bigger cleanups.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      14bf01bb
  6. Sep 30, 2005
  7. Sep 29, 2005
  8. Sep 28, 2005
  9. Sep 23, 2005
    • 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
  10. Sep 22, 2005
  11. Sep 21, 2005
    • Andrew Morton's avatar
      [PATCH] Add printk_clock() · 31f6d9d6
      Andrew Morton authored
      
      ia64's sched_clock() accesses per-cpu data which isn't set up at boot time.
      Hence ia64 cannot use printk timestamping, because printk() will crash in
      sched_clock().
      
      So make printk() use printk_clock(), defaulting to sched_clock(), overrideable
      by the architecture via attribute(weak).
      
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      31f6d9d6
  12. Sep 17, 2005
  13. Sep 13, 2005
  14. Sep 12, 2005
  15. Sep 11, 2005
  16. Sep 10, 2005
Loading