Re: [PATCH] ipc: Limit sysctl value to IPCMNI

From: Waiman Long
Date: Mon Jun 11 2018 - 17:27:15 EST


On 06/08/2018 05:16 PM, Andrew Morton wrote:
> On Fri, 8 Jun 2018 15:49:49 +0200 Takashi Iwai <tiwai@xxxxxxx> wrote:
>
>> Currently shmmni proc entry accepts all entered integer values, but
>> the practical limit is IPCMNI (32768). This confuses user as if a
>> bigger value were accepted but not applied correctly.
>>
>> This patch changes the proc entry to use *_minmax variant to limit the
>> accepted values accordingly.
> Waiman Long was working on a (vastly more complicated) patchset to
> address this.
>
>> --- a/ipc/ipc_sysctl.c
>> +++ b/ipc/ipc_sysctl.c
>> @@ -99,6 +99,7 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,
>> static int zero;
>> static int one = 1;
>> static int int_max = INT_MAX;
>> +static int ipcmni = IPCMNI;
>>
>> static struct ctl_table ipc_kern_table[] = {
>> {
>> @@ -120,7 +121,9 @@ static struct ctl_table ipc_kern_table[] = {
>> .data = &init_ipc_ns.shm_ctlmni,
>> .maxlen = sizeof(init_ipc_ns.shm_ctlmni),
>> .mode = 0644,
>> - .proc_handler = proc_ipc_dointvec,
>> + .proc_handler = proc_ipc_dointvec_minmax,
>> + .extra1 = &zero,
>> + .extra2 = &ipcmni,
>> },
>> {
>> .procname = "shm_rmid_forced",
> What is the back-compatibility situation here?
>
>
Sorry for the late reply. I am planning to send out an updated patch
once the merge window is closed. The latest patch can be found in

https://lkml.org/lkml/2018/5/7/666

Luis has some concern about the use of __read_mostly tag which I am
going to remove in the next version.

-Longman