Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1749645pxb; Mon, 22 Feb 2021 09:54:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJywVN6RdwjzO6d5cD/pmAUYiTA/4hmCAAGicuELHaaBnEB+cdK+o6PkgAb7XczT0TZKDWk4 X-Received: by 2002:a17:906:1613:: with SMTP id m19mr22180407ejd.344.1614016475181; Mon, 22 Feb 2021 09:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614016475; cv=none; d=google.com; s=arc-20160816; b=ECfwcwPBiQqJdrilzMdoEUpLftO2R9mK8pE2eXtApiCntZ3+ShrvfuPIyJIEN6xpAV KxEddQjx/bumxyjxOnFI7KI60bhPLlgFgmvsMs9Qv5SrgstGaowWQ5SVDldfAHQFrTe+ qMzvwlsRsCAjpmv/eY+CLh3BJ6cIqzW6hCKJMomdfuvx9rLuAxAQgU49rwOJWNd4w1Sl kJjLCnUbOCXLIlC86t3jrdk+N3j+qkhYswRZOoYw8roxhsVHHwVK62Dp397xCx3rTrcx sIBwu8KAPlXMT8VwWH0Pty4dD9xWFNkURu6Z/POY+nGrgOlB9tWD+GLYUFgg0kxUeZbS tuEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q/184qGC08c/X9yZo4h4BJEplxwrcfp8FbIowMgcbh8=; b=fvWahim9zSfF5e23YKxCUe97mCk1p6aRFTNretPDevgGbQAokQRu6/34j9IHoZh3dD /mso+4VYzJhe5Wkd/F0p0ZMGszOMpVeN0xO9QyV+9Lcj1sJdQlQJRNdKwsmx/76UZ5SV tMfLTmaWMhhdSIvT7+AIe60TgHNT3hadlU1gPJGXWR2vDKBC57OAq2hhgmnS0mX4vGHw ASkeh6Q3jnvkdSWrDxFdjpifQgw5GwS250TmSpRh1aY8f18bj/4VrLpkZuULz/MxkzPd UNnK5/ItTm6GC3OjUnqMAnnZVCM5kmX1HQTiWRdLi6vNO7GmpGCEhRHZW2dpvhR1fRzH eTGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CnwgPTea; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv7si9093121ejb.31.2021.02.22.09.54.11; Mon, 22 Feb 2021 09:54:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CnwgPTea; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231424AbhBVRx0 (ORCPT + 99 others); Mon, 22 Feb 2021 12:53:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33430 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230398AbhBVRxZ (ORCPT ); Mon, 22 Feb 2021 12:53:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614016319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q/184qGC08c/X9yZo4h4BJEplxwrcfp8FbIowMgcbh8=; b=CnwgPTeae531K9EcluBxigJVwc6Bh4g1zgWM9qnQ5J4ViL5Ik63QITWjzM/fIfgA5M0hV4 DGZdLhI9fPEzVBpRKmCwGs7gvqjNXOmwuFAfnHPyUyeYIH1lQOdDNBnhAubCdFfOvLz45q 4+XxW76r4lmBnD43M5eZ4OAtFQaMRB8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-RChLU-ryP-K3uWCL8GQBYQ-1; Mon, 22 Feb 2021 12:51:55 -0500 X-MC-Unique: RChLU-ryP-K3uWCL8GQBYQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACBA3100961C; Mon, 22 Feb 2021 17:51:53 +0000 (UTC) Received: from treble (ovpn-118-117.rdu2.redhat.com [10.10.118.117]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD5435D6B1; Mon, 22 Feb 2021 17:51:52 +0000 (UTC) Date: Mon, 22 Feb 2021 11:51:50 -0600 From: Josh Poimboeuf To: Masami Hiramatsu Cc: Evgenii Shatokhin , Arnaldo Carvalho de Melo , Kristen Carlson Accardi , live-patching@vger.kernel.org, Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Konstantin Khorenko Subject: Re: 'perf probe' and symbols from .text. Message-ID: <20210222175150.yxgw3sxxaqjqgq56@treble> References: <09257fb8-3ded-07b0-b3cc-55d5431698d8@virtuozzo.com> <20210223000508.cab3cddaa3a3790525f49247@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210223000508.cab3cddaa3a3790525f49247@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 12:05:08AM +0900, Masami Hiramatsu wrote: > > Of course, one could place probes using absolute addresses of the > > functions but that would be less convenient. > > > > This also affects many livepatch modules where the kernel code can be > > compiled with -ffunction-sections and each function may end up in a > > separate section .text.. 'perf probe' cannot be used > > there, except with the absolute addresses. > > > > Moreover, if FGKASLR patches are merged > > (https://lwn.net/Articles/832434/) and the kernel is built with FGKASLR > > enabled, -ffunction-sections will be used too. 'perf probe' will be > > unable to see the kernel functions then. > > Hmm, if the FGKASLAR really randomizes the symbol address, perf-probe > should give up "_text-relative" probe for that kernel, and must fallback > to the "symbol-based" probe. (Are there any way to check the FGKASLR is on?) > The problem of "symbol-based" probe is that local (static) symbols > may share a same name sometimes. In that case, it can not find correct > symbol. (Maybe I can find a candidate from its size.) > Anyway, sometimes the security and usability are trade-off. We had a similar issue with FGKASLR and live patching. The proposed solution is a new linker flag which eliminates duplicates: -z unique-symbol. https://sourceware.org/bugzilla/show_bug.cgi?id=26391 -- Josh