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]
Date:	Tue, 10 Apr 2012 09:10:33 +0530
From:	Nikunj A Dadhania <nikunj@...ux.vnet.ibm.com>
To:	David Ahern <dsahern@...il.com>
Cc:	mingo@...hat.com, acme@...stprotocols.net, a.p.zijlstra@...llo.nl,
	paulus@...ba.org, fweisbec@...il.com, eranian@...gle.com,
	linux-kernel@...r.kernel.org
Subject: Re: [BUG PATCH] perf: kvm - finding struct machine fails for PERF_RECORD_MMAP

On Mon, 09 Apr 2012 16:59:50 -0600, David Ahern <dsahern@...il.com> wrote:
> On 4/9/12 2:22 AM, Nikunj A. Dadhania wrote:
> > From: Nikunj A. Dadhania<nikunj@...ux.vnet.ibm.com>
> >
> > Running 'perf kvm --host --guest --guestmount /tmp/guestmount record -a -g -- sleep 2'
> >
> > Was resulting in a segfault. For event type PERF_RECORD_MMAP,
> > event->ip.pid is being used in perf_session__find_machine_for_cpumode,
> > which is not correct.
> >
> > event->ip.pid happens to be 0 in this case and results in returning a
> > NULL machine object. Finally, access to self->pid in
> > machine__mmap_name, results in a segfault later.
> 
> I have tried unsuccessfully to recreate the segfault. All of the samples 
> I get are of type PERF_RECORD_SAMPLE. I do not see how an MMAP event can 
> be generated in a guest context.
> 
I can think of two places where it can happen:

1) perf_event__synthesize_kernel_mmap

        [...]
 	mmap_name = machine__mmap_name(machine, name_buff, sizeof(name_buff));
	if (machine__is_host(machine)) {
           ...
	} else {
		event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
		if (machine__is_default_guest(machine))
			filename = (char *) symbol_conf.default_guest_kallsyms;
		else {
			sprintf(path, "%s/proc/kallsyms", machine->root_dir);
			filename = path;
		}
	}
        [...]
	event->mmap.header.type = PERF_RECORD_MMAP;
        [...]
        event->mmap.pid   = machine->pid;        

2) perf_event__synthesize_modules

        [...]
	if (machine__is_host(machine))
		event->header.misc = PERF_RECORD_MISC_KERNEL;
	else
		event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
        [...]             
	event->mmap.header.type = PERF_RECORD_MMAP;
        [...]
        event->mmap.pid   = machine->pid;

BTW, i am testing this on latest -tip(498c911).

In my case, I am able to recreate this everytime. And have verified that
the event->header.type that I hit here is of type PERF_RECORD_MMAP.

Let me know if you want me to test out some debug patches.

Regards,
Nikunj

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ