Date: Wed, 14 Jan 2015 22:05:29 +0000 (UTC) From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r277197 - user/dchagin/lemul/sys/compat/linux Message-ID: <201501142205.t0EM5Tem041216@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501142205.t0EM5Tem041216>