Re: [PATCH] ipc: Limit sysctl value to IPCMNI
From: Andrew Morton
Date: Tue Jun 12 2018 - 19:36:14 EST
On Tue, 12 Jun 2018 08:36:32 +0200 Takashi Iwai <tiwai@xxxxxxx> wrote:
> > Well the present behaviour is to convert higher values downwards, yes?
> >
> > int ipc_addid(struct ipc_ids *ids, struct kern_ipc_perm *new, int limit)
> > {
> > kuid_t euid;
> > kgid_t egid;
> > int id, err;
> >
> > if (limit > IPCMNI)
> > limit = IPCMNI;
> >
> > So if someone out there is presently setting this to 999999 then their
> > kernel will work just fine. After your proposed change, it will no
> > longer do so - the tuning attempt will fail with -EINVAL.
> >
> > It really does us no good to say "you shouldn't have been doing that".
> > The fact that they *are* doing it and that it works OK is the kernel
> > developers' fault for not applying suitable checking on day one. I
> > think we're stuck with continuing to accept such input.
>
> Hm, that's one concern, yes.
>
> OTOH, we do secretly ignore the input value, and this isn't what's
> expected by user, either. Moreover, user-space has no slightest idea
> which value can be accepted and which not.
>
> Actually I posted it just because of requests from customers who
> needed to raise the bar, but didn't notice the effect.
>
> Maybe another possible solution would be to add another proc entry to
> handle this correctly, and make the old one only for compatibility.
Yes, I guess so. Just leave the old tunable alone. Possibly we
could add a printk_once("please switch to the new interface").