* Re: [PATCH] proc/sysctl: add shared variables for range check
@ 2019-07-02 17:12 Alexey Dobriyan
2019-07-02 17:21 ` Matteo Croce
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2019-07-02 17:12 UTC (permalink / raw)
To: mcroce; +Cc: linux-kernel, keescook, atomlin, akpm
> -static long zero;
> static long long_max = LONG_MAX;
>
> struct ctl_table epoll_table[] = {
> @@ -301,7 +300,7 @@ struct ctl_table epoll_table[] = {
> .maxlen = sizeof(max_user_watches),
> .mode = 0644,
> .proc_handler = proc_doulongvec_minmax,
> - .extra1 = &zero,
> + .extra1 = SYSCTL_ZERO,
> .extra2 = &long_max,
This looks wrong: proc_doulongvec_minmax() expects "long"s.
The whole patch needs rechecking.
> +/* shared constants to be used in various sysctls */
> +const =======>int<========== sysctl_vals[] = { 0, 1, INT_MAX };
> +EXPORT_SYMBOL(sysctl_vals);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] proc/sysctl: add shared variables for range check
2019-07-02 17:12 [PATCH] proc/sysctl: add shared variables for range check Alexey Dobriyan
@ 2019-07-02 17:21 ` Matteo Croce
2019-07-02 20:13 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Matteo Croce @ 2019-07-02 17:21 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: LKML, Kees Cook, Aaron Tomlin, Andrew Morton
On Tue, Jul 2, 2019 at 7:13 PM Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> > -static long zero;
> > static long long_max = LONG_MAX;
> >
> > struct ctl_table epoll_table[] = {
> > @@ -301,7 +300,7 @@ struct ctl_table epoll_table[] = {
> > .maxlen = sizeof(max_user_watches),
> > .mode = 0644,
> > .proc_handler = proc_doulongvec_minmax,
> > - .extra1 = &zero,
> > + .extra1 = SYSCTL_ZERO,
> > .extra2 = &long_max,
>
> This looks wrong: proc_doulongvec_minmax() expects "long"s.
> The whole patch needs rechecking.
>
> > +/* shared constants to be used in various sysctls */
> > +const =======>int<========== sysctl_vals[] = { 0, 1, INT_MAX };
> > +EXPORT_SYMBOL(sysctl_vals);
Yes, you're right, that chunk must be dropped.
Anyway I've checked the patch, this was the only long field touched.
Regards,
--
Matteo Croce
per aspera ad upstream
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] proc/sysctl: add shared variables for range check
2019-07-02 17:21 ` Matteo Croce
@ 2019-07-02 20:13 ` Andrew Morton
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2019-07-02 20:13 UTC (permalink / raw)
To: Matteo Croce; +Cc: Alexey Dobriyan, LKML, Kees Cook, Aaron Tomlin
On Tue, 2 Jul 2019 19:21:33 +0200 Matteo Croce <mcroce@redhat.com> wrote:
> On Tue, Jul 2, 2019 at 7:13 PM Alexey Dobriyan <adobriyan@gmail.com> wrote:
> >
> > > -static long zero;
> > > static long long_max = LONG_MAX;
> > >
> > > struct ctl_table epoll_table[] = {
> > > @@ -301,7 +300,7 @@ struct ctl_table epoll_table[] = {
> > > .maxlen = sizeof(max_user_watches),
> > > .mode = 0644,
> > > .proc_handler = proc_doulongvec_minmax,
> > > - .extra1 = &zero,
> > > + .extra1 = SYSCTL_ZERO,
> > > .extra2 = &long_max,
> >
> > This looks wrong: proc_doulongvec_minmax() expects "long"s.
> > The whole patch needs rechecking.
> >
> > > +/* shared constants to be used in various sysctls */
> > > +const =======>int<========== sysctl_vals[] = { 0, 1, INT_MAX };
> > > +EXPORT_SYMBOL(sysctl_vals);
>
> Yes, you're right, that chunk must be dropped.
> Anyway I've checked the patch, this was the only long field touched.
Yup.
akpm3:/usr/src/25> find . -name "*.c" | xargs grep -C4 SYSCTL_ZERO|grep long
./fs/eventpoll.c- .proc_handler = proc_doulongvec_minmax,
./fs/eventpoll.c- .extra2 = &long_max,
I did this:
--- a/fs/eventpoll.c~proc-sysctl-add-shared-variables-for-range-check-fix-4
+++ a/fs/eventpoll.c
@@ -291,6 +291,7 @@ static LIST_HEAD(tfile_check_list);
#include <linux/sysctl.h>
+static long long_zero;
static long long_max = LONG_MAX;
struct ctl_table epoll_table[] = {
@@ -300,7 +301,7 @@ struct ctl_table epoll_table[] = {
.maxlen = sizeof(max_user_watches),
.mode = 0644,
.proc_handler = proc_doulongvec_minmax,
- .extra1 = SYSCTL_ZERO,
+ .extra1 = &long_zero,
.extra2 = &long_max,
},
{ }
I renamed it to avoid using "&zero," in this situation.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-03 1:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 17:12 [PATCH] proc/sysctl: add shared variables for range check Alexey Dobriyan
2019-07-02 17:21 ` Matteo Croce
2019-07-02 20:13 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).