From: Rafael Aquini <aquini@redhat.com> To: Luis Chamberlain <mcgrof@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, dyoung@redhat.com, bhe@redhat.com, corbet@lwn.net, keescook@chromium.org, akpm@linux-foundation.org, cai@lca.pw, rdunlap@infradead.org Subject: Re: [PATCH v2] kernel: add panic_on_taint Date: Thu, 7 May 2020 14:43:07 -0400 [thread overview] Message-ID: <20200507184307.GF205881@optiplex-lnx> (raw) In-Reply-To: <20200507182257.GX11244@42.do-not-panic.com> On Thu, May 07, 2020 at 06:22:57PM +0000, Luis Chamberlain wrote: > On Thu, May 07, 2020 at 02:06:31PM -0400, Rafael Aquini wrote: > > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > > index 8a176d8727a3..b80ab660d727 100644 > > --- a/kernel/sysctl.c > > +++ b/kernel/sysctl.c > > @@ -1217,6 +1217,13 @@ static struct ctl_table kern_table[] = { > > .extra1 = SYSCTL_ZERO, > > .extra2 = SYSCTL_ONE, > > }, > > + { > > + .procname = "panic_on_taint", > > + .data = &panic_on_taint, > > + .maxlen = sizeof(unsigned long), > > + .mode = 0644, > > + .proc_handler = proc_doulongvec_minmax, > > + }, > > You sent this out before I could reply to the other thread on v1. > My thoughts on the min / max values, or lack here: > > Valid range doesn't mean "currently allowed defined" masks. > > For example, if you expect to panic due to a taint, but a new taint type > you want was not added on an older kernel you would be under a very > *false* sense of security that your kernel may not have hit such a > taint, but the reality of the situation was that the kernel didn't > support that taint flag only added in future kernels. > > You may need to define a new flag (MAX_TAINT) which should be the last > value + 1, the allowed max values would be > > (2^MAX_TAINT)-1 > > or > > (1<<MAX_TAINT)-1 > > Since this is to *PANIC* I think we do want to test ranges and ensure > only valid ones are allowed. > Ok. I'm thinking in: diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8a176d8727a3..ee492431e7b0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1217,6 +1217,15 @@ static struct ctl_table kern_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, + { + .procname = "panic_on_taint", + .data = &panic_on_taint, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = proc_doulongvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = (1 << TAINT_FLAGS_COUNT << 1) - 1, + }, Would that address your concerns wrt this one? Cheers! -- Rafael
WARNING: multiple messages have this Message-ID (diff)
From: Rafael Aquini <aquini@redhat.com> To: Luis Chamberlain <mcgrof@kernel.org> Cc: rdunlap@infradead.org, keescook@chromium.org, bhe@redhat.com, linux-doc@vger.kernel.org, corbet@lwn.net, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, cai@lca.pw, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, dyoung@redhat.com Subject: Re: [PATCH v2] kernel: add panic_on_taint Date: Thu, 7 May 2020 14:43:07 -0400 [thread overview] Message-ID: <20200507184307.GF205881@optiplex-lnx> (raw) In-Reply-To: <20200507182257.GX11244@42.do-not-panic.com> On Thu, May 07, 2020 at 06:22:57PM +0000, Luis Chamberlain wrote: > On Thu, May 07, 2020 at 02:06:31PM -0400, Rafael Aquini wrote: > > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > > index 8a176d8727a3..b80ab660d727 100644 > > --- a/kernel/sysctl.c > > +++ b/kernel/sysctl.c > > @@ -1217,6 +1217,13 @@ static struct ctl_table kern_table[] = { > > .extra1 = SYSCTL_ZERO, > > .extra2 = SYSCTL_ONE, > > }, > > + { > > + .procname = "panic_on_taint", > > + .data = &panic_on_taint, > > + .maxlen = sizeof(unsigned long), > > + .mode = 0644, > > + .proc_handler = proc_doulongvec_minmax, > > + }, > > You sent this out before I could reply to the other thread on v1. > My thoughts on the min / max values, or lack here: > > Valid range doesn't mean "currently allowed defined" masks. > > For example, if you expect to panic due to a taint, but a new taint type > you want was not added on an older kernel you would be under a very > *false* sense of security that your kernel may not have hit such a > taint, but the reality of the situation was that the kernel didn't > support that taint flag only added in future kernels. > > You may need to define a new flag (MAX_TAINT) which should be the last > value + 1, the allowed max values would be > > (2^MAX_TAINT)-1 > > or > > (1<<MAX_TAINT)-1 > > Since this is to *PANIC* I think we do want to test ranges and ensure > only valid ones are allowed. > Ok. I'm thinking in: diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8a176d8727a3..ee492431e7b0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1217,6 +1217,15 @@ static struct ctl_table kern_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, + { + .procname = "panic_on_taint", + .data = &panic_on_taint, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = proc_doulongvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = (1 << TAINT_FLAGS_COUNT << 1) - 1, + }, Would that address your concerns wrt this one? Cheers! -- Rafael _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2020-05-07 18:43 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-07 18:06 [PATCH v2] kernel: add panic_on_taint Rafael Aquini 2020-05-07 18:06 ` Rafael Aquini 2020-05-07 18:22 ` Luis Chamberlain 2020-05-07 18:22 ` Luis Chamberlain 2020-05-07 18:43 ` Rafael Aquini [this message] 2020-05-07 18:43 ` Rafael Aquini 2020-05-07 18:47 ` Rafael Aquini 2020-05-07 18:47 ` Rafael Aquini 2020-05-07 20:33 ` Luis Chamberlain 2020-05-07 20:33 ` Luis Chamberlain 2020-05-07 22:06 ` Rafael Aquini 2020-05-07 22:06 ` Rafael Aquini 2020-05-07 22:25 ` Luis Chamberlain 2020-05-07 22:25 ` Luis Chamberlain 2020-05-08 12:47 ` Rafael Aquini 2020-05-08 12:47 ` Rafael Aquini 2020-05-09 3:48 ` Luis Chamberlain 2020-05-09 3:48 ` Luis Chamberlain 2020-05-09 14:56 ` Rafael Aquini 2020-05-09 14:56 ` Rafael Aquini 2020-05-07 18:50 ` Luis Chamberlain 2020-05-07 18:50 ` Luis Chamberlain 2020-05-07 18:53 ` Rafael Aquini 2020-05-07 18:53 ` Rafael Aquini
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200507184307.GF205881@optiplex-lnx \ --to=aquini@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=bhe@redhat.com \ --cc=cai@lca.pw \ --cc=corbet@lwn.net \ --cc=dyoung@redhat.com \ --cc=keescook@chromium.org \ --cc=kexec@lists.infradead.org \ --cc=linux-doc@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mcgrof@kernel.org \ --cc=rdunlap@infradead.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.