Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5593203rwb; Tue, 9 Aug 2022 00:05:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR7lR7+h4eKQPq1RWKFmkeb56hPuWQgeN9lGxnXQ5U6b0mA9BwaUfEpb/dxkoihVqboH7nLA X-Received: by 2002:a05:6402:2b88:b0:43a:6c58:6c64 with SMTP id fj8-20020a0564022b8800b0043a6c586c64mr21120707edb.348.1660028745052; Tue, 09 Aug 2022 00:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660028745; cv=none; d=google.com; s=arc-20160816; b=hc1+LqYfhCKY6cakprFOfZbRP5DV9iQ9psSWwoN4B77h0tqbmcJVR31E0s3J4qqGmY ANhzN6NvJr7oQ0Dx3+CsP0CCpi3sr7U8xZcCAWErRPTcRyi3cyOZ/gDVImujjw2Y36TQ DKunqfJxGc8p+xBcuzYNwxG768YFEmAO0Wsm4cMHSpExMv37OLR6pJ6y3fhtmMdA0hdi RgsXv3NrcLUTRsbkzikRX6dNfZo8zkpESkUlLIqb/LzLL40Aid/ex9acCztx8qy1GNBF oI6OYKOvE2elGVc9oJMRzROBTSVkEHjZULEheXhxiHsYMakyglGtsBwnQNVC/movY0IU KEbg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=98vjUYq5tB5TzcPQz4segw1MRQNtlyfoQ1bnFbhTIRE=; b=LVhD7G71xmdyaFW8+WpvV8wbzmWRwwil3KZb3Z2W5xbRITM82OOOJxf2/zz/NNXFCf 6J/LpAxS0OHscPGwKClE5y/PnZn/7f0UKGgp/X69plRdxT7yCVutekStyi4yY8nkwLpD vkuS1OpsDMa4cgvl62LMjvCNM7v4xYD50ugapskQC/vmFbDxoU8GQndLhDDvQ80wR1e2 KxtqlYGqDZa2BCnqTEa1zDUzbSouSQj08Jnu7pVpvPZ0su0uiDkIydDvtXxFZJFC+nGn E4A4o4M6iO+kGuC+i3DhOm7zhwUNgC5zrkAPUL8x4ELLnLLP/B68BwRLnQJ48si2TE2d 3Bmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QzdOYdAM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a170906131500b00730d207a05esi1281151ejb.32.2022.08.09.00.05.19; Tue, 09 Aug 2022 00:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QzdOYdAM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234409AbiHIGut (ORCPT + 99 others); Tue, 9 Aug 2022 02:50:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbiHIGup (ORCPT ); Tue, 9 Aug 2022 02:50:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544E9C1E; Mon, 8 Aug 2022 23:50:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1E49B811B1; Tue, 9 Aug 2022 06:50:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D44DC433D6; Tue, 9 Aug 2022 06:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660027842; bh=4XRLYBkHIeanHtUx9JVZ94kPXzXpTAAOY2sRWbNULrk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QzdOYdAMDF/AQjiflW2UwPuPZqVu1Dgu1O4LLZxKUD1focGf0nQsrWClKfvzSOxvd RkkhTQ1q56hslpBnFppSsSTmYCZaI6ZCiPN1NBUUG9WUbwsHb32L+2VrDj+rFpRdQb LX3lZ/t+zvQ53haySi69n7ykmZIsdhXmtlcxNOCwRwplZ9CQQI68so3WytzM1Yx1oN G4i2YRPWHY0T6JrfHfJo6WII3vG8KnkJK42o3t9BygFuYbV7FC/cjaizp9ptccsi5n cjUMqcVDOp1BOY0rOO8UbGlJxgD+jhKa3FJl1GFv0rtTv8rrWEypDvcpI7T2E5Oo3u FheD1yfF9/E6w== Date: Tue, 9 Aug 2022 07:50:35 +0100 From: Lee Jones To: Jiri Olsa Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , bpf@vger.kernel.org Subject: Re: [PATCH v2 1/1] bpf: Drop unprotected find_vpid() in favour of find_get_pid() Message-ID: References: <20220803134821.425334-1-lee@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Wed, 03 Aug 2022, Jiri Olsa wrote: > On Wed, Aug 03, 2022 at 02:48:21PM +0100, Lee Jones wrote: > > The documentation for find_pid() clearly states: > > nit: typo find_vpid Sorry missed this. Will fix. > > "Must be called with the tasklist_lock or rcu_read_lock() held." > > > > Presently we do neither. > > > > Let's use find_get_pid() which searches for the vpid, then takes a > > reference to it preventing early free, all within the safety of > > rcu_read_lock(). Once we have our reference we can safely make use of > > it up until the point it is put. > > > > Cc: Alexei Starovoitov > > Cc: Daniel Borkmann > > Cc: John Fastabend > > Cc: Andrii Nakryiko > > Cc: Martin KaFai Lau > > Cc: Song Liu > > Cc: Yonghong Song > > Cc: KP Singh > > Cc: Stanislav Fomichev > > Cc: Hao Luo > > Cc: Jiri Olsa > > Cc: bpf@vger.kernel.org > > Fixes: 41bdc4b40ed6f ("bpf: introduce bpf subcommand BPF_TASK_FD_QUERY") > > Signed-off-by: Lee Jones > > Acked-by: Jiri Olsa Thanks. -- Lee Jones [李琼斯]