From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 704FA219FC for ; Fri, 12 Jun 2026 00:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781222910; cv=none; b=MAzuWdVM4YZJGxNB86cNhGyt/2u3snQAjVThaYlxs3Pk8pOZSrVfDmcr5MZ05JyIwsi3S3RpRkJAw0EpUf3FY4EUB0cXIRmAlB1jal58V5ZrwytGCscJa1sThcIyANH6vvdUk90ymcVdfz5H9droebrv7Nopvyw65qKVfmFJ/L8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781222910; c=relaxed/simple; bh=CdX8Qwb4P1o/hcHptjiAg9CZgwE1KcXgvFcvzc961dA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gtp0/g5oq8EYbzVTMDssL2CH0IzfjFPLkGCynUv1FLLFQTunbPK7QCPWTxzyTePgiUqbUuALtd4xzmwrya4vdTp8cwYGpITE9I5OphNxPfmg+Zh6ZGDSGmii4x1UV05nC21q/sen3PyFpuW0olP/cvVPElcbrwqAv8FZnaUYX6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IQYdYFyl; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IQYdYFyl" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-51761d27612so3839701cf.3 for ; Thu, 11 Jun 2026 17:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781222908; x=1781827708; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yKG4KW6S/RXhkFtQLuUCBdwnT8PSZQpyI8y4jFz+S04=; b=IQYdYFyl5haIjJPowgCvMDhVmGhtOlKqPrIZwLERV+tl6jHyj6ISRn57hCkZTTpLzs JzLps3HqWFoOAr2raldq8vDOgdAE5Kq5VvjYqsmNKJV6OPfYgQ781t7tclzV4LB6gCQW kLPlEaMUon4Mmg7AlbmECD2tvq51cCpQtznOYNnmD70zH4AxA1JYDfQk3JNYPmX4q1SE P6ADQudmVeMRITf+sSgHlbBnfjyyiwyfvbicNFD9ak16OjZxTxZ3cJbxVcG/iPRWwexU 7lDd4el6GkSzywOJSC76M7VGV5bNSNOy5EtwErIPUDDwZdYOkQq3NOvguXeI/ouSB7FF vC5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781222908; x=1781827708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yKG4KW6S/RXhkFtQLuUCBdwnT8PSZQpyI8y4jFz+S04=; b=Zo8dcZV1EzHGqB57rkUwd70K2yKNDDxm1hIB/5e2+Cz1SGTWIYyH3X70VxApSAKjlm D9A6ViKiBgmaMKZ8j92spp3kmC/mOn5f6P20bLNMn8J7pIqwTEyWXIRUFZdxQ7glzZ+r oxH21Qu/R7Ug+l7wIgxaAPQoy0yY2icW5MkjBF54MaDmYMjBdwbfMVJ5IWj1zUFEFxMy gxfFgIDN/bGvUT26jHd8PvBA4rlttZLcylFYNxwnk2gZ0JCeGXlUHzWZQeIYfuaO26B8 vL5+0IC/Z9rnP2G86Foah+iQ08zYlzj0pBLjCmRvm8ORYw4HyGipoKKHyoEFIUGRUHP+ P3Mw== X-Gm-Message-State: AOJu0YyOA8u08xYeKkzjfpqbDy5TsBhwUS9xY+6XmDFxG0njKbkQbPws WvepLARtlTEuRLXju2QFzhBHGollLbLqFkHO3U07kSV2fmNv/2uVGfTB X-Gm-Gg: Acq92OFQsFuxDhytQEcVMA0yZGZuDRtZxCZZm40q0V/MPTm41Dv83P+T2qui5JEoFek cDtTN2cP9boUqPZxDZz730f6qqh0M38XPB9lVzIVyZx53F/PxZ6o8Lc8VLRGBhkoXqGUG5q0hu2 1bnraa2HAiTsyJtYiwYNgdfyOLESDzyZ8rdcTle2/fom6xsmBIf/pOlwqzxPfP9qaRswGutDXN2 A2iBxBRfvJh0nfqTF+0UdgURIwYG44kX9PV8kbMsk4eJcI8bcKli9aKNP7kDB5MuCHDDFt8G2q4 v54v975G+laxuc0Uz6iKpK8q0lekmQ8fPzIjguHoOnS/2C7tCgMAsMvjYZYANdxcuwC+rUF1WFT FpuQaA0Sz+OXdLPydNMnuflT5vLzwPh7a1HItEYTjXqk4dcEWrmHW6I7ZePfBVI9nU7tCymFOm4 zli6rzsnWlgssyqUvFbWRp6E3TLCvXN1wFfAuRpNo56WwHv+pVDblYFdi0faEtfJ4ElrtvDwCvQ uUxOuapYb2Vmgu5fnln06Wqsg== X-Received: by 2002:a05:622a:8c1b:b0:517:c65c:3dba with SMTP id d75a77b69052e-517fe5edd81mr5583751cf.38.1781222908419; Thu, 11 Jun 2026 17:08:28 -0700 (PDT) Received: from battery.lan (pool-138-88-31-60.washdc.fios.verizon.net. [138.88.31.60]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-517fb79df4dsm6590911cf.15.2026.06.11.17.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 17:08:27 -0700 (PDT) From: David Windsor To: alex.roberts109@outlook.com, Kees Cook , Paul Moore , James Morris , "Serge E . Hallyn" Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, Alexei Starovoitov , KP Singh , David Windsor Subject: Re: [PATCH] Add LoadPin support for eBPF program loading Date: Thu, 11 Jun 2026 20:08:25 -0400 Message-ID: <20260612000825.105100-1-dwindsor@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260611-b4-rfc-loadpin-ebpf-v1-1-11a6c8e6170d@outlook.com> References: <20260611-b4-rfc-loadpin-ebpf-v1-1-11a6c8e6170d@outlook.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Thu, Jun 11, 2026 at 01:59:10PM -0500, Alex Roberts wrote: > +static int loadpin_bpf_prog_load(struct bpf_prog *prog, union bpf_attr *attr, > + struct bpf_token *token, bool is_kernel) > +{ > + int res = 0; > + struct file *exe_file = NULL; > + struct mm_struct *mm = current->mm; > + > + if (is_kernel || !mm) > + return 0; > + > + exe_file = get_mm_exe_file(mm); > + if (!exe_file) > + return 0; > + > + res = loadpin_check(exe_file, READING_EBPF); Why are we checking current here? IIUC this will be whoever calls bpf(2), which would be the loader, which would then be able to load bpf programs from an untrusted source. In the kmod case loadpin_check() sees the .ko itself.