Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp428986iob; Wed, 18 May 2022 05:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAmPClTiD9oAfVAcDlsQg4QlqeplIEBLmsJjfrpmMuNx42mJXnoaYC2ULKtkM8NFBiQ4BT X-Received: by 2002:a17:90a:4a03:b0:1df:4583:cb26 with SMTP id e3-20020a17090a4a0300b001df4583cb26mr17836145pjh.173.1652876757431; Wed, 18 May 2022 05:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652876757; cv=none; d=google.com; s=arc-20160816; b=dhyLoQlOfURhgeGt/9bRBE9JgUqtaS243YxZVxHSrzGW0DQoxHC5cG1HqXJFOHl3NQ MSbwdmmwRh8ar7rfLTFaCjrYNxr9x/5dNV5QoBvX7WtFGEaU2lEvzmkTdew+GRwcobGL OIZuBdeY1JmTrDnhgX9+mivFJNWGwp+sjW3EYjtJtFs+5G3524Zml0ld+ycgQJRb5EFi hC/6wQnTU5JccewV/Poil6b0ltOv4dsHV6ANTHgBFEidScRVbbHYnKI/LNC8Bx8UweD/ 1qlbAsrVs7/eKQJT/C8zPjaGdmjTWW9jGTXA9ZRtEmc4IpIqczWpujy5WnxyGzwBVQce hcBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MlM2AUQc/4YaS8YQ+3153zXGMb60UOH0oHzcHsTkB/k=; b=GzvUen4rm2VdynEFsluv/W3j4sg825NOO5pNAXRjZhjGNvfkQbAMtgYnTfWcIw2xGT 6JqTpWNzz/53dRwXu7o+maDrwuO34Ru8jcO//17ua7aViJEh3iyNQHppIOBZjpqKdSDi aTQOppceGZ1x9rYmPWHK3fn4DAaNOtudcz13IyTW23CibbHmBIm0adZFsfiPe4yFxgm1 xG8cHS0EwaPwGdRcDeyKj6xqcqn9IA+M+V/WB0nR8f9OScn0TfYSoz5kjUqgclI19ydn tryUek+OJg0AySgE//SBDqAPi3tnamYrSjRPG8OncVCH33pzIQy3ltiVW0GFGqZdkYiX cPbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QqJStpI4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c3-20020a170903234300b0015d391dab50si3025156plh.153.2022.05.18.05.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 05:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QqJStpI4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 37C6A169E32; Wed, 18 May 2022 05:22:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236505AbiERMWp (ORCPT + 99 others); Wed, 18 May 2022 08:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236475AbiERMWn (ORCPT ); Wed, 18 May 2022 08:22:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 36C691207CE for ; Wed, 18 May 2022 05:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652876561; 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=MlM2AUQc/4YaS8YQ+3153zXGMb60UOH0oHzcHsTkB/k=; b=QqJStpI4kMr2yObFurxqvdUw/hBas3uCRxtAc9cwoXqPxyKoB/A5YhzE/C3SlecVptR0Pu g3O4cE7lUK+r39t1Y9dXbb5gHjywGHMapBgiyIp+9XVrwjbhWyso56jnSbgAAKKrUQ8rKS N1oG3jRJtQiJd5QKXJAr/maYUb+C0Kk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-73-rBBidYBlPCKRs_9PNwSsAw-1; Wed, 18 May 2022 08:22:38 -0400 X-MC-Unique: rBBidYBlPCKRs_9PNwSsAw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C6271C01B24; Wed, 18 May 2022 12:22:37 +0000 (UTC) Received: from asgard.redhat.com (unknown [10.36.110.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3AC8F2166B40; Wed, 18 May 2022 12:22:34 +0000 (UTC) Date: Wed, 18 May 2022 14:22:31 +0200 From: Eugene Syromiatnikov To: Jiri Olsa , Masami Hiramatsu , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann Cc: Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf v3 2/2] bpf_trace: bail out from bpf_kprobe_multi_link_attach when in compat Message-ID: <47cbdb76178a112763a3766a03d8cc51842fcab0.1652876188.git.esyr@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since bpf_kprobe_multi_link_attach doesn't support 32-bit kernels for whatever reason, 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. 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 212faa4..2f83489 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2412,7 +2412,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