From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751691AbbH1GHH (ORCPT ); Fri, 28 Aug 2015 02:07:07 -0400 Received: from mga01.intel.com ([192.55.52.88]:30905 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751526AbbH1GHF (ORCPT ); Fri, 28 Aug 2015 02:07:05 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,424,1437462000"; d="scan'208";a="777278034" From: Alexander Shishkin To: Ingo Molnar Cc: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo Subject: Re: [PATCH 1/2] perf/x86/intel/ds: Work around BTS leaking kernel addresses In-Reply-To: <20150828053037.GB26741@gmail.com> References: <1440688422-27954-1-git-send-email-alexander.shishkin@linux.intel.com> <1440688422-27954-2-git-send-email-alexander.shishkin@linux.intel.com> <20150828053037.GB26741@gmail.com> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 28 Aug 2015 09:06:32 +0300 Message-ID: <87y4gw54lz.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ingo Molnar writes: > * Alexander Shishkin wrote: > >> + for (at = base; at < top; at++) { >> + /* >> + * Note that right now *this* BTS code only works if >> + * attr::exclude_kernel is set, but let's keep this extra >> + * check here in case that changes. >> + */ >> + if (event->attr.exclude_kernel && >> + (at->from >= PAGE_OFFSET || at->to >= PAGE_OFFSET)) >> + skip++; > > Yeah, so that only works on 32-bit kernels, on 64-bit kernels the check for kernel > addresses is to see whether it's a negative address. PAGE_OFFSET points to above > any hypervisor's address, so even with your fix we could still leak hypervisor > addresses. > > I.e. use the kernel_ip() primitive instead. That's what I've been looking for, thanks! Regards, -- Alex