lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181206124719.1fa76d92@vmware.local.home>
Date:   Thu, 6 Dec 2018 12:47:19 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Ravi Bangoria <ravi.bangoria@...ux.ibm.com>,
        Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
        Oleg Nesterov <oleg@...hat.com>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: [GIT PULL] Uprobes: Fix kernel oops with delayed_uprobe_remove()


Linus,

This is a single commit that fixes a bug in uprobes SDT code
due to a missing mutex protection.


Please pull the latest trace-v4.20-rc5 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v4.20-rc5

Tag SHA1: a5405a88026387f237d97b607234db71d91c13e2
Head SHA1: 1aed58e67a6ec1e7a18bfabe8ba6ec2d27c15636


Ravi Bangoria (1):
      Uprobes: Fix kernel oops with delayed_uprobe_remove()

----
 kernel/events/uprobes.c | 2 ++
 1 file changed, 2 insertions(+)
---------------------------
commit 1aed58e67a6ec1e7a18bfabe8ba6ec2d27c15636
Author: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Date:   Wed Dec 5 09:04:23 2018 +0530

    Uprobes: Fix kernel oops with delayed_uprobe_remove()
    
    There could be a race between task exit and probe unregister:
    
      exit_mm()
      mmput()
      __mmput()                     uprobe_unregister()
      uprobe_clear_state()          put_uprobe()
      delayed_uprobe_remove()       delayed_uprobe_remove()
    
    put_uprobe() is calling delayed_uprobe_remove() without taking
    delayed_uprobe_lock and thus the race sometimes results in a
    kernel crash. Fix this by taking delayed_uprobe_lock before
    calling delayed_uprobe_remove() from put_uprobe().
    
    Detailed crash log can be found at:
      Link: http://lkml.kernel.org/r/000000000000140c370577db5ece@google.com
    
    Link: http://lkml.kernel.org/r/20181205033423.26242-1-ravi.bangoria@linux.ibm.com
    
    Acked-by: Oleg Nesterov <oleg@...hat.com>
    Reviewed-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
    Reported-by: syzbot+cb1fb754b771caca0a88@...kaller.appspotmail.com
    Fixes: 1cc33161a83d ("uprobes: Support SDT markers having reference count (semaphore)")
    Signed-off-by: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 96d4bee83489..98b9312ce6b2 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -572,7 +572,9 @@ static void put_uprobe(struct uprobe *uprobe)
 		 * gets called, we don't get a chance to remove uprobe from
 		 * delayed_uprobe_list from remove_breakpoint(). Do it here.
 		 */
+		mutex_lock(&delayed_uprobe_lock);
 		delayed_uprobe_remove(uprobe, NULL);
+		mutex_unlock(&delayed_uprobe_lock);
 		kfree(uprobe);
 	}
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ