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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72D2BC433FE for ; Tue, 10 May 2022 18:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344053AbiEJSmQ (ORCPT ); Tue, 10 May 2022 14:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243004AbiEJSmK (ORCPT ); Tue, 10 May 2022 14:42:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B591512F1FB for ; Tue, 10 May 2022 11:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652208127; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=My8Rl7ea47B+HwUMWyal7bJCbA6soPVSA7SmTGeFXV4=; b=BLQlSYKEfb8pTb/64h83W6XmNaiHpJnclP9gwKSHReYMXBdvtfr47N+k3XIDHtbbb9FBRc dvBB0p6me7yVIjFfkhFBwkbtjP7NDIECfDXTlQt4BNsqsStGMeB8Fri+K4hdoOjB7SDRDa ez/aOfAlI1f+Dy/x3Dq9UBU3qxBSbUg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-62-gTJ2yLWsM_Ot9w76UMdo3Q-1; Tue, 10 May 2022 14:42:02 -0400 X-MC-Unique: gTJ2yLWsM_Ot9w76UMdo3Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96F7A185A7BA; Tue, 10 May 2022 18:42:01 +0000 (UTC) Received: from asgard.redhat.com (unknown [10.36.110.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2036515230D2; Tue, 10 May 2022 18:41:57 +0000 (UTC) Date: Tue, 10 May 2022 20:41:55 +0200 From: Eugene Syromiatnikov To: Alexei Starovoitov Cc: Jiri Olsa , Masami Hiramatsu , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Network Development , bpf , LKML Subject: Re: [PATCH bpf] bpf_trace: bail out from bpf_kprobe_multi_link_attach when in compat Message-ID: <20220510184155.GA8295@asgard.redhat.com> References: <20220506142148.GA24802@asgard.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, May 10, 2022 at 11:10:35AM -0700, Alexei Starovoitov wrote: > On Fri, May 6, 2022 at 7:22 AM Eugene Syromiatnikov wrote: > > > > Since bpf_kprobe_multi_link_attach doesn't support 32-bit kernels > > for whatever reason, > > Jiri, > why did you add this restriction? > > > having it enabled for compat processes on 64-bit > > kernels makes even less sense due to discrepances in the type sizes > > that it does not handle. > > I don't follow this logic. > bpf progs are always 64-bit. Even when user space is 32-bit. > Jiri's check is for the kernel. The interface as defined (and implemented in libbpf) expects arrays of userspace pointers to be passed (for example, syms points to an array of userspace pointers—character strings; same goes for addrs, but with generic userspace pointers) without regard to possible difference in the pointer size in case of compat userspace. > > Fixes: 0dcac272540613d4 ("bpf: Add multi kprobe link") > > Signed-off-by: Eugene Syromiatnikov > > --- > > kernel/trace/bpf_trace.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > > index d8553f4..9560af6 100644 > > --- a/kernel/trace/bpf_trace.c > > +++ b/kernel/trace/bpf_trace.c > > @@ -2410,7 +2410,7 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr > > int err; > > > > /* no support for 32bit archs yet */ > > - if (sizeof(u64) != sizeof(void *)) > > + if (sizeof(u64) != sizeof(void *) || in_compat_syscall()) > > return -EOPNOTSUPP; > > > > if (prog->expected_attach_type != BPF_TRACE_KPROBE_MULTI) > > -- > > 2.1.4 > > >