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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201804072131.AEF86988.OFOQLJMVFFtOSH@I-love.SAKURA.ne.jp>
Date:   Sat, 7 Apr 2018 21:31:19 +0900
From:   Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To:     peterz@...radead.org, mingo@...nel.org
Cc:     akpm@...ux-foundation.org, dvyukov@...gle.com,
        paulmck@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
        torvalds@...ux-foundation.org, msb@...omium.org,
        tglx@...utronix.de, vegard.nossum@...cle.com
Subject: Re: [PATCH v2] locking/hung_task: Show all hung tasks before panic

Hello.

Can we add lockdep functions which print trace of threads with locks held?

For example,

void debug_show_map_users(struct lockdep_map *map)
{
	struct task_struct *g, *p;
	struct held_lock *hlock;
	int i, depth;

	rcu_read_lock();
	for_each_process_thread(g, p) {
		depth = p->lockdep_depth;
		hlock = p->held_locks;
		for (i = 0; i < depth; i++)
			if (map == hlock[i]->instance) {
				touch_nmi_watchdog();
				touch_all_softlockup_watchdogs();
				sched_show_task(p);
				lockdep_print_held_locks(p);
				break;
			}
	}
	rcu_read_unlock();
}

is for replacing debug_show_all_locks() in oom_reap_task() because
we are interested in only threads holding specific mm->mmap_sem.

For example

void debug_show_relevant_tasks(struct task_struct *origin)
{
	struct task_struct *g, *p;
	struct held_lock *i_hlock, *j_hlock;
	int i, j, i_depth, j_depth;

	rcu_read_lock();
	i_depth = origin->lockdep_depth;
	i_hlock = origin->held_locks;
	for_each_process_thread(g, p) {
		j_depth = p->lockdep_depth;
		j_hlock = p->held_locks;
		for (i = 0; i < i_depth; i++)
			for (j = 0; j < j_depth; j++)
				if (i_hlock[i]->instance == j_hlock[j]->instance)
					goto hit;
		continue;
hit:
		touch_nmi_watchdog();
		touch_all_softlockup_watchdogs();
		sched_show_task(p);
		lockdep_print_held_locks(p);
	}
	rcu_read_unlock();
}

or

void debug_show_all_locked_tasks(void)
{
	struct task_struct *g, *p;

	rcu_read_lock();
	for_each_process_thread(g, p) {
		if (p->lockdep_depth == 0)
			continue;
		touch_nmi_watchdog();
		touch_all_softlockup_watchdogs();
		sched_show_task(p);
		lockdep_print_held_locks(p);
	}
	rcu_read_unlock();
}

are for replacing debug_show_all_locks() in check_hung_task() for cases like
https://syzkaller.appspot.com/bug?id=26aa22915f5e3b7ca2cfca76a939f12c25d624db
because we are interested in only threads holding locks.

SysRq-t is too much but SysRq-w is useless for killable/interruptible threads...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ