Received: by 2002:a19:ef0c:0:0:0:0:0 with SMTP id n12csp952917lfh; Tue, 1 Feb 2022 12:58:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJC03AC8Jrw0br8/uLTtu2IBaqnOzBMYunoNfP3D1mGx3k8ZRSF0TqI4Sfn0L5W/ppyNmy X-Received: by 2002:a17:902:f68e:: with SMTP id l14mr27045304plg.165.1643749085838; Tue, 01 Feb 2022 12:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643749085; cv=none; d=google.com; s=arc-20160816; b=G7MhMTp8gsxmOFpknuVSmj69wBdjl9pj0We1y7oHyQLe+LglnFhyUqSOpoD/23h2hR 4BVPg9WI+ZYswVHhBsMWawvGHeMLSE3ePSz0dYsDKyENJGa2hJiDep3zQSWUUr3nqLac xTNNj9VxBFu/ZWglJ/4CLwmkJzEg/AYypLXkHVylyhMe5Bk5qE7vOoybc8UhT04myDgz TLrY4QfiG5TnkZJfQnP1I8nkM4bULIA2O7lmLARnfOwpGPUywly3jdf8P1mxNtKhTxle q9CcVLefLX794wQJ2jjKdkicFJy3NHScZQL4BYcpA1hWl4d6vkyE2Qntx/sjxW25X+em ZoJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FeDXSVjRSR6dKMC+7ZH3ru5FJDnaIKr02Jz/vlqtNQk=; b=iTLcOuM9Dh3/pd+4oJbeFSg+R0bDtx/ZUViE+TRkOW/XgdQPOvXIKHSBPrxQ7QJSzG 5wjlyHV/jZDUYLwrmhMF4NUU/K6QYZfsoY+wmNVt6DLPIcA6Lxc4cKEZG7F+wss2dzRp vvjiYeBJjMIJ692ms4qFdMJqD/KoVwufxZb9xWVq8V2LWirtULawr9xg8TIJHub2GPgx 4y6iCWNWTkm+kITy4y06e/lSzGsfTWZvDvyrnL5Kcj9PCpcULYR7HRXWUieS+PIpYRvc p1HArnWJqZHUkHK905/RiNnIiSe5NyRgXAmPSV//KRqRBInN/JvrTemV3XPugv5f5cgI FY4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XXTWk9PV; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bg10si16161988plb.504.2022.02.01.12.57.54; Tue, 01 Feb 2022 12:58:05 -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=@kernel.org header.s=k20201202 header.b=XXTWk9PV; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231128AbiBAAfh (ORCPT + 99 others); Mon, 31 Jan 2022 19:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbiBAAfg (ORCPT ); Mon, 31 Jan 2022 19:35:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2DB0C061714; Mon, 31 Jan 2022 16:35:35 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 4149C6116E; Tue, 1 Feb 2022 00:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A50C4C340EC; Tue, 1 Feb 2022 00:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643675734; bh=cSEHOgu6WdxyN/x8mmLI9PyPNmHpQ766gw4vAOVF/p8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XXTWk9PVuTOJT0muRWwvhXefkHnxJ+UDo6fOO/2kjArsnsn2jmOVz5GQlOVshTQ5f 93qOfEgqfD+HzV2GOkGdHZrBNfBKq2If526D/wz7eiwVL6+CknTjEOwucDi085vhPC BGv4i5YVqkHJ7M7he2VL0yY9J95cXN/RHrsaJDGIWWVHzYrq3vyMOD9c8GMuIQPbQx m/G5sqWoWgj++kCHWQrd6TsweiFQqXXQZcK8AYkIddIbOfv4JDGT6A0X5lJgQQu2Jw QSHG0qpMJvokPfkT08QdMsKDqGJRVTR5hQSgGgztzN5xL1wMMfkhOcAqSCcycDyrEH bm8Uyhhfh3Aww== Received: by mail-yb1-f181.google.com with SMTP id w81so23588810ybg.12; Mon, 31 Jan 2022 16:35:34 -0800 (PST) X-Gm-Message-State: AOAM532Cto8FlaBV0o9b4ye68/SyK4MOXDCGjzGRYCEPX2Cg3PXr7Zxj /3Ruw6zb0fpPlz3N28u9NUw/1flf7Ka96ppIVoQ= X-Received: by 2002:a25:8543:: with SMTP id f3mr15414165ybn.47.1643675733838; Mon, 31 Jan 2022 16:35:33 -0800 (PST) MIME-Version: 1.0 References: <20220128234517.3503701-1-song@kernel.org> <20220128234517.3503701-9-song@kernel.org> In-Reply-To: From: Song Liu Date: Mon, 31 Jan 2022 16:35:23 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 bpf-next 8/9] bpf: introduce bpf_jit_binary_pack_[alloc|finalize|free] To: Daniel Borkmann Cc: bpf , Networking , open list , Alexei Starovoitov , Andrii Nakryiko , Kernel Team , Peter Zijlstra , X86 ML , Ilya Leoshkevich , Song Liu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 31, 2022 at 4:21 PM Daniel Borkmann wrote: > > On 1/29/22 12:45 AM, Song Liu wrote: > [...] [...] > > +} > > + > > +/* Copy JITed text from rw_header to its final location, the ro_header. */ > > +int bpf_jit_binary_pack_finalize(struct bpf_prog *prog, > > + struct bpf_binary_header *ro_header, > > + struct bpf_binary_header *rw_header) > > +{ > > + void *ptr; > > + > > + ptr = bpf_arch_text_copy(ro_header, rw_header, rw_header->size); > > Does this need to be wrapped with a text_mutex lock/unlock pair given > text_poke_copy() internally relies on __text_poke() ? Yes... Good catch. I guess we may do the lock in text_poke_copy(). Thanks, Song