svn commit: r277197 - user/dchagin/lemul/sys/compat/linux
Dmitry Chagin
dchagin at FreeBSD.org
Wed Jan 14 22:05:29 UTC 2015
Author: dchagin
Date: Wed Jan 14 22:05:28 2015
New Revision: 277197
URL: https://svnweb.freebsd.org/changeset/base/277197
Log:
In the case of an "that ugly way" when we try to find Linux thread by
pfind() check that the returned process is a Linux process. Otherwise,
below we dereference em pointer expecting it points to a Linux thread.
Reported by: trinity
Modified:
user/dchagin/lemul/sys/compat/linux/linux_misc.c
Modified: user/dchagin/lemul/sys/compat/linux/linux_misc.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_misc.c Wed Jan 14 21:39:31 2015 (r277196)
+++ user/dchagin/lemul/sys/compat/linux/linux_misc.c Wed Jan 14 22:05:28 2015 (r277197)
@@ -2004,6 +2004,7 @@ linux_sched_rr_get_interval(struct threa
struct thread *
linux_tdfind(struct thread *td, lwpid_t tid, pid_t pid)
{
+ struct linux_pemuldata *pem;
struct linux_emuldata *em;
struct thread *tdt;
struct proc *p;
@@ -2020,6 +2021,14 @@ linux_tdfind(struct thread *td, lwpid_t
*/
p = pfind(tid);
if (p) {
+ pem = pem_find(p);
+ if (pem == NULL) {
+ /*
+ * p is not a Linuxulator process.
+ */
+ PROC_UNLOCK(p);
+ return (NULL);
+ }
FOREACH_THREAD_IN_PROC(p, tdt) {
em = em_find(tdt);
if (tid == em->em_tid)
More information about the svn-src-user
mailing list