Message ID | 80294752-603e-be9a-9faf-5348116d3e09@ipfire.org |
---|---|
State | Superseded |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 49g2kV4NZKz43yv for <patchwork@web04.haj.ipfire.org>; Sun, 7 Jun 2020 17:02:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 49g2kT4y4Nz1WF; Sun, 7 Jun 2020 17:02:41 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 49g2kT3NXbz2ymZ; Sun, 7 Jun 2020 17:02:41 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 49g2kS1kRZz2xJ9 for <development@lists.ipfire.org>; Sun, 7 Jun 2020 17:02:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 49g2kQ5lnzzWr for <development@lists.ipfire.org>; Sun, 7 Jun 2020 17:02:38 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1591549359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TM4rfKwBMrRLnrFgCLXisiZSzyrzEye65emSFXOLoCE=; b=+GPWIjdOGAzjdcHTYwX8RCCuq1aAW2a7XUNxfc7Xpn5YI+Fa+fKP7JCgaxlVfns2mh9aCS aK9MmVxAmjXPjDAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1591549359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TM4rfKwBMrRLnrFgCLXisiZSzyrzEye65emSFXOLoCE=; b=AL1/x+SEjKEdMIZUwocyIfAlct8ywfgh8Q94UbsUhEI/McFiOz8ztai94gABCOQIA//qff XHAxCfom+XwYxKOA18HaM4dLQqdb8wVi4F2sZNzMDeAyVygjhBNLij9Z3s4/yLCFJ2yPS4 2SDUP0JTlfgtkwMtakYTXEWIrWUu6fA+iUPFLS5fYY+uAUMjfrbUM9vRji8W25jQtb/0Vj cTkl7RsSDQ+GunzujYQQK1XgEzc2LQbOxPExLV79WgDN4KssQYrPYyX8CAtQeBZOEQrWDU Q+OlmUZX9VIrWhxJg5lDpVdqGf6GTzANJhl64/1Z+6dB0ra2sl+swbNjrUZCkA== To: development@lists.ipfire.org From: =?utf-8?q?Peter_M=C3=BCller?= <peter.mueller@ipfire.org> Subject: [PATCH] sysctl.conf: Turn on BPF JIT hardening, if the JIT is enabled Message-ID: <80294752-603e-be9a-9faf-5348116d3e09@ipfire.org> Date: Sun, 7 Jun 2020 17:02:33 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=peter.mueller@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Series |
sysctl.conf: Turn on BPF JIT hardening, if the JIT is enabled
|
|
Commit Message
Peter Müller
June 7, 2020, 5:02 p.m. UTC
This is recommended by the Kernel Self Protection Project, and although
we do not take advantage of the BPF JIT at this time, we should set this
nevertheless in order to avoid potential security vulnerabilities.
Fixes: #12384
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
config/etc/sysctl.conf | 3 +++
1 file changed, 3 insertions(+)
Comments
Hi Peter, > On 7 Jun 2020, at 18:02, Peter Müller <peter.mueller@ipfire.org> wrote: > > This is recommended by the Kernel Self Protection Project, and although > we do not take advantage of the BPF JIT at this time, we should set this > nevertheless in order to avoid potential security vulnerabilities. I do not really understand what you are trying to achieve here. Please state more clearly *why* you think this is a useful change for IPFire. As far as I am aware, the kernel internally uses BPF. -Michael P.S. How the f*** is this not already the default in the Linux kernel? Performance only, eh? > > Fixes: #12384 > > Signed-off-by: Peter Müller <peter.mueller@ipfire.org> > --- > config/etc/sysctl.conf | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/config/etc/sysctl.conf b/config/etc/sysctl.conf > index 7e7ebee44..3f4c828f9 100644 > --- a/config/etc/sysctl.conf > +++ b/config/etc/sysctl.conf > @@ -49,6 +49,9 @@ kernel.dmesg_restrict = 1 > fs.protected_symlinks = 1 > fs.protected_hardlinks = 1 > > +# Turn on BPF JIT hardening, if the JIT is enabled. > +net.core.bpf_jit_harden = 2 > + > # Minimal preemption granularity for CPU-bound tasks: > # (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds) > kernel.sched_min_granularity_ns = 10000000 > -- > 2.26.2
Hello Michael, > Hi Peter, > >> On 7 Jun 2020, at 18:02, Peter Müller <peter.mueller@ipfire.org> wrote: >> >> This is recommended by the Kernel Self Protection Project, and although >> we do not take advantage of the BPF JIT at this time, we should set this >> nevertheless in order to avoid potential security vulnerabilities. > > I do not really understand what you are trying to achieve here. I am trying to achieve enabling of BPF JIT hardening. > Please state more clearly *why* you think this is a useful change for IPFire. > > As far as I am aware, the kernel internally uses BPF. Yes, to my knowledge, this is exactly the point. The Kernel is using it, and we should make sure it is properly hardened then. If this sysctl is helping, I do not see a reason why not turning it on. Thanks, and best regards, Peter Müller > -Michael > > P.S. How the f*** is this not already the default in the Linux kernel? Performance only, eh? > >> >> Fixes: #12384 >> >> Signed-off-by: Peter Müller <peter.mueller@ipfire.org> >> --- >> config/etc/sysctl.conf | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/config/etc/sysctl.conf b/config/etc/sysctl.conf >> index 7e7ebee44..3f4c828f9 100644 >> --- a/config/etc/sysctl.conf >> +++ b/config/etc/sysctl.conf >> @@ -49,6 +49,9 @@ kernel.dmesg_restrict = 1 >> fs.protected_symlinks = 1 >> fs.protected_hardlinks = 1 >> >> +# Turn on BPF JIT hardening, if the JIT is enabled. >> +net.core.bpf_jit_harden = 2 >> + >> # Minimal preemption granularity for CPU-bound tasks: >> # (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds) >> kernel.sched_min_granularity_ns = 10000000 >> -- >> 2.26.2 >
Hello Michael, especially after https://lists.ipfire.org/pipermail/development/2021-April/009804.html, I would really like to bring this up once more. From my point of view, it is safe to turn on that sysctl, as no user should ever load anything into BPF directly on an IPFire 2.x machine, especially not if that abuses some JIT oddities. At least on my semi-productive testing machine, this does not break anything I am aware of. Thanks, and best regards, Peter Müller > Hello Michael, > >> Hi Peter, >> >>> On 7 Jun 2020, at 18:02, Peter Müller <peter.mueller@ipfire.org> wrote: >>> >>> This is recommended by the Kernel Self Protection Project, and although >>> we do not take advantage of the BPF JIT at this time, we should set this >>> nevertheless in order to avoid potential security vulnerabilities. >> >> I do not really understand what you are trying to achieve here. > > I am trying to achieve enabling of BPF JIT hardening. > >> Please state more clearly *why* you think this is a useful change for IPFire. >> >> As far as I am aware, the kernel internally uses BPF. > > Yes, to my knowledge, this is exactly the point. The Kernel is using it, and > we should make sure it is properly hardened then. If this sysctl is helping, > I do not see a reason why not turning it on. > > Thanks, and best regards, > Peter Müller > >> -Michael >> >> P.S. How the f*** is this not already the default in the Linux kernel? Performance only, eh? >> >>> >>> Fixes: #12384 >>> >>> Signed-off-by: Peter Müller <peter.mueller@ipfire.org> >>> --- >>> config/etc/sysctl.conf | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/config/etc/sysctl.conf b/config/etc/sysctl.conf >>> index 7e7ebee44..3f4c828f9 100644 >>> --- a/config/etc/sysctl.conf >>> +++ b/config/etc/sysctl.conf >>> @@ -49,6 +49,9 @@ kernel.dmesg_restrict = 1 >>> fs.protected_symlinks = 1 >>> fs.protected_hardlinks = 1 >>> >>> +# Turn on BPF JIT hardening, if the JIT is enabled. >>> +net.core.bpf_jit_harden = 2 >>> + >>> # Minimal preemption granularity for CPU-bound tasks: >>> # (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds) >>> kernel.sched_min_granularity_ns = 10000000 >>> -- >>> 2.26.2 >>
Hello, I agree merging this, but we can only enable this on x86_64, aarch64 and armv5tel. i586 does not support BPF_JIT and does not know this sysctl option. Could you please submit an updated patch? -Michael > On 2 Apr 2021, at 20:37, Peter Müller <peter.mueller@ipfire.org> wrote: > > Hello Michael, > > especially after https://lists.ipfire.org/pipermail/development/2021-April/009804.html, > I would really like to bring this up once more. > > From my point of view, it is safe to turn on that sysctl, as no user should ever load > anything into BPF directly on an IPFire 2.x machine, especially not if that abuses some > JIT oddities. > > At least on my semi-productive testing machine, this does not break anything I am aware of. > > Thanks, and best regards, > Peter Müller > > >> Hello Michael, >> >>> Hi Peter, >>> >>>> On 7 Jun 2020, at 18:02, Peter Müller <peter.mueller@ipfire.org> wrote: >>>> >>>> This is recommended by the Kernel Self Protection Project, and although >>>> we do not take advantage of the BPF JIT at this time, we should set this >>>> nevertheless in order to avoid potential security vulnerabilities. >>> >>> I do not really understand what you are trying to achieve here. >> >> I am trying to achieve enabling of BPF JIT hardening. >> >>> Please state more clearly *why* you think this is a useful change for IPFire. >>> >>> As far as I am aware, the kernel internally uses BPF. >> >> Yes, to my knowledge, this is exactly the point. The Kernel is using it, and >> we should make sure it is properly hardened then. If this sysctl is helping, >> I do not see a reason why not turning it on. >> >> Thanks, and best regards, >> Peter Müller >> >>> -Michael >>> >>> P.S. How the f*** is this not already the default in the Linux kernel? Performance only, eh? >>> >>>> >>>> Fixes: #12384 >>>> >>>> Signed-off-by: Peter Müller <peter.mueller@ipfire.org> >>>> --- >>>> config/etc/sysctl.conf | 3 +++ >>>> 1 file changed, 3 insertions(+) >>>> >>>> diff --git a/config/etc/sysctl.conf b/config/etc/sysctl.conf >>>> index 7e7ebee44..3f4c828f9 100644 >>>> --- a/config/etc/sysctl.conf >>>> +++ b/config/etc/sysctl.conf >>>> @@ -49,6 +49,9 @@ kernel.dmesg_restrict = 1 >>>> fs.protected_symlinks = 1 >>>> fs.protected_hardlinks = 1 >>>> >>>> +# Turn on BPF JIT hardening, if the JIT is enabled. >>>> +net.core.bpf_jit_harden = 2 >>>> + >>>> # Minimal preemption granularity for CPU-bound tasks: >>>> # (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds) >>>> kernel.sched_min_granularity_ns = 10000000 >>>> -- >>>> 2.26.2 >>>
diff --git a/config/etc/sysctl.conf b/config/etc/sysctl.conf index 7e7ebee44..3f4c828f9 100644 --- a/config/etc/sysctl.conf +++ b/config/etc/sysctl.conf @@ -49,6 +49,9 @@ kernel.dmesg_restrict = 1 fs.protected_symlinks = 1 fs.protected_hardlinks = 1 +# Turn on BPF JIT hardening, if the JIT is enabled. +net.core.bpf_jit_harden = 2 + # Minimal preemption granularity for CPU-bound tasks: # (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds) kernel.sched_min_granularity_ns = 10000000