From patchwork Thu Mar 21 16:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 13599068 X-Patchwork-Delegate: bpf@iogearbox.net Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D61E12BF1C; Thu, 21 Mar 2024 16:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711036922; cv=none; b=T2L4+JV9863mdriwJX4D/o5AW8ocOciqnbEZvWTcIz5RDsf7/F5XISuUPp/XifLoJcLxLQugpCdYnzPLkNnl0DLNUSr4er8Xk6Xl7S8dZr4l8m0Bv8GcONmIJqzELSk6WQQwr8mCsyY6KbghKszImkr1knaLtiWh+HNfnNS5tz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711036922; c=relaxed/simple; bh=zw11YjpMl3FoiTr/2sFaVVMvcMLI7sst8F38+AzzMmg=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=LTeX1UJ3J3VWC+SPLjEVz/2fMh8zs4Y/QPd0L4bFjhWKYTt8ZxQvecoMoBxCrr2UL+C3kSPXTjQPI78LJO/wyTK+zxYPcYItQ+TEoEiLSbIGA6fWcZJzEuwXH6U3zf1HENlK2hqpINiQYHWS4ztzgYGK+zziUdryBGUwZNzaugU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z5KcVdIb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z5KcVdIb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85CDAC433C7; Thu, 21 Mar 2024 16:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711036922; bh=zw11YjpMl3FoiTr/2sFaVVMvcMLI7sst8F38+AzzMmg=; h=Date:From:To:Cc:Subject:From; b=Z5KcVdIb2aD4AR5R8XnG1HAFcm60tL4tdGJz7G0+V7OlqX8VdLVpnJMKkg8Qz5Sp5 agbUUp5mZfM/ngmwEIQY0/SqjeuVmtoT7hX9SqlygYgNTYRtwU9xRKLsQx6CNcFyOX r5djo+RCIO02U70rI4B2ILVI/n2TGUublGv2Eilm1D64aiOkOXfpNvS8EZmteKyuVA wI6RN8v61GWE3e59yk2VjOhDvfL+S8vPl5T0k7gR+8gCcWlHDJCydGn3NxhF9tsR/f Gx4C7KYyUC6AFE2dzdaWtAz5hb+LYnC9lX/MaujNVtIP56dVu1M+r4v5LSNiId2biC v10cXgp4svtZw== Date: Thu, 21 Mar 2024 13:01:58 -0300 From: Arnaldo Carvalho de Melo To: Andrii Nakryiko , Daniel Borkmann Cc: bpf@vger.kernel.org, Linux Kernel Mailing List , linux-perf-users@vger.kernel.org Subject: [PATCH 1/1] libbpf: Define MFD_CLOEXEC if not available Message-ID: Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Patchwork-Delegate: bpf@iogearbox.net Since its going directly to the syscall to avoid not having memfd_create() available in some systems, do the same for its MFD_CLOEXEC flags, defining it if not available. This fixes the build in those systems, noticed while building perf on a set of build containers. Fixes: 9fa5e1a180aa639f ("libbpf: Call memfd_create() syscall directly") Cc: Andrii Nakryiko Cc: Daniel Borkmann Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/bpf/libbpf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index efab29b8935bd9f7..635a38c6f947a34d 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1650,6 +1650,10 @@ static int sys_memfd_create(const char *name, unsigned flags) return syscall(__NR_memfd_create, name, flags); } +#ifndef MFD_CLOEXEC +#define MFD_CLOEXEC 0x0001U +#endif + static int create_placeholder_fd(void) { int fd;