From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECA0AC433E2 for ; Fri, 11 Sep 2020 14:13:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C4E82226B for ; Fri, 11 Sep 2020 14:13:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VhjCyK7G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726299AbgIKOMx (ORCPT ); Fri, 11 Sep 2020 10:12:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37538 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgIKNQs (ORCPT ); Fri, 11 Sep 2020 09:16:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599830167; 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=rkS7T2t+cwHMdDgfJc0SznulsmzvAzCieOLQud/9Bcc=; b=VhjCyK7GWBBZNNNjiofs6YSUME5SFqilJkOS9H7VyZO6PrW5ZJGtxPwyCKZbepNjBSu58k 1betRcWmTvOwrqMitw63kFiYNgv4DrnqF44+UBV5pTKs57m9adE4DqbwJMp7Ee7tQOIwBp 9gbJmTIE7tQ6qRCdmifz67HpjyWzBCg= 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-126-c1THySt4MBOTG0_EC_WAnA-1; Fri, 11 Sep 2020 09:16:03 -0400 X-MC-Unique: c1THySt4MBOTG0_EC_WAnA-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 1DD7981F00F; Fri, 11 Sep 2020 13:16:02 +0000 (UTC) Received: from krava (unknown [10.40.192.120]) by smtp.corp.redhat.com (Postfix) with SMTP id 54B7875136; Fri, 11 Sep 2020 13:15:59 +0000 (UTC) Date: Fri, 11 Sep 2020 15:15:58 +0200 From: Jiri Olsa To: Alexei Starovoitov Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Network Development , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Subject: Re: [PATCH bpf-next] selftests/bpf: Check trampoline execution in d_path test Message-ID: <20200911131558.GD1714160@krava> References: <20200910122224.1683258-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Thu, Sep 10, 2020 at 05:46:21PM -0700, Alexei Starovoitov wrote: > On Thu, Sep 10, 2020 at 5:22 AM Jiri Olsa wrote: > > > > Some kernels builds might inline vfs_getattr call within > > fstat syscall code path, so fentry/vfs_getattr trampoline > > is not called. > > > > I'm not sure how to handle this in some generic way other > > than use some other function, but that might get inlined at > > some point as well. > > It's great that we had the test and it failed. > Doing the test skipping will only hide the problem. > Please don't do it here and in the future. > Instead let's figure out the real solution. > Assuming that vfs_getattr was added to btf_allowlist_d_path > for a reason we have to make this introspection place > reliable regardless of compiler inlining decisions. > We can mark it as 'noinline', but that's undesirable. > I suggest we remove it from the allowlist and replace it with > security_inode_getattr. > I think that is a better long term fix. in my case vfs_getattr got inlined in vfs_statx_fd and both of them are defined in fs/stat.c so the idea is that inlining will not happen if the function is defined in another object? or less likely..? we should be safe when it's called from module > While at it I would apply the same critical thinking to other > functions in the allowlist. They might suffer the same issue. > So s/vfs_truncate/security_path_truncate/ and so on? > Things won't work when CONFIG_SECURITY is off, but that is a rare kernel config? > Or add both security_* and vfs_* variants and switch tests to use security_* ? > but it feels fragile to allow inline-able funcs in allowlist. hm, what's the difference between vfs_getattr and security_inode_getattr in this regard? I'd expect compiler could inline it same way as for vfs_getattr jirka