use proc_dointvec_minmax to check boundaries while needed
PATCH 1/5 use proc_dointvec_minmax to check boundaries while needed
proc_dointvec doesn't check extra minmax params, use proc_dointvec_minmax instead of proc_dointvec for cases need boundaries check.
--- kernel/sysctl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/sysctl.c +6 -6
@@ -374,7 +374,7 @@ static struct ctl_table kern_table[] = { .data = &sysctl_sched_autogroup_enabled, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, .extra2 = &one, },
@@ -1204,7 +1204,7 @@ static struct ctl_table vm_table[] = { .data = &block_dump, .maxlen = sizeof(block_dump), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, {
@@ -1212,7 +1212,7 @@ static struct ctl_table vm_table[] = { .data = &sysctl_vfs_cache_pressure, .maxlen = sizeof(sysctl_vfs_cache_pressure), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, },#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
@@ -1221,7 +1221,7 @@ static struct ctl_table vm_table[] = { .data = &sysctl_legacy_va_layout, .maxlen = sizeof(sysctl_legacy_va_layout), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, },#endif
@@ -1231,7 +1231,7 @@ static struct ctl_table vm_table[] = { .data = &zone_reclaim_mode, .maxlen = sizeof(zone_reclaim_mode), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, {
@@ -1287,7 +1287,7 @@ static struct ctl_table vm_table[] = { .data = &vdso_enabled, .maxlen = sizeof(vdso_enabled), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, },#endif
Quoted 2 lines · Dave Young
proc_dointvecdoesn't check extra minmax params, useproc_dointvec_minmaxinstead ofproc_dointvecfor cases need boundaries check.
Is this patch needed, if you are basically changing it again in patches 3 and 5?
Cheers,
Don
Quoted 62 lines
Signed-off-by Dave Young <[email protected]>--- kernel/sysctl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)kernel/sysctl.c +6
-6@@ -374,7 +374,7 @@ static struct ctl_table kern_table[] = { .data = &sysctl_sched_autogroup_enabled, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, .extra2 = &one, },@@ -1204,7 +1204,7 @@ static struct ctl_table vm_table[] = { .data = &block_dump, .maxlen = sizeof(block_dump), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, {@@ -1212,7 +1212,7 @@ static struct ctl_table vm_table[] = { .data = &sysctl_vfs_cache_pressure, .maxlen = sizeof(sysctl_vfs_cache_pressure), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, },#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT @@ -1221,7 +1221,7 @@ static struct ctl_table vm_table[] = { .data = &sysctl_legacy_va_layout, .maxlen = sizeof(sysctl_legacy_va_layout), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, },#endif @@ -1231,7 +1231,7 @@ static struct ctl_table vm_table[] = { .data = &zone_reclaim_mode, .maxlen = sizeof(zone_reclaim_mode), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, {@@ -1287,7 +1287,7 @@ static struct ctl_table vm_table[] = { .data = &vdso_enabled, .maxlen = sizeof(vdso_enabled), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, },#endif
Quoted 6 lines · Don Zickus
Quoted 2 lines · Dave Young
proc_dointvecdoesn't check extra minmax params, useproc_dointvec_minmaxinstead ofproc_dointvecfor cases need boundaries check.Is this patch needed, if you are basically changing it again in patches 3 and 5?
Sure if 3 and 5 is acked, if someone object them then this is good?
Quoted 67 lines
Cheers,
DonQuoted 62 lines
Signed-off-by Dave Young <[email protected]>---
kernel/sysctl.c | 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)kernel/sysctl.c 2011-03-03 11:02:43.736663258 +0800 renamed from kernel/sysctl.c 2011-03-03 10:44:53.000000000 +0800 +6
-6@@ -374,7 +374,7 @@ static struct ctl_table kern_table[] = { .data = &sysctl_sched_autogroup_enabled, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, .extra2 = &one, },@@ -1204,7 +1204,7 @@ static struct ctl_table vm_table[] = { .data = &block_dump, .maxlen = sizeof(block_dump), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, {@@ -1212,7 +1212,7 @@ static struct ctl_table vm_table[] = { .data = &sysctl_vfs_cache_pressure, .maxlen = sizeof(sysctl_vfs_cache_pressure), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT@@ -1221,7 +1221,7 @@ static struct ctl_table vm_table[] = { .data = &sysctl_legacy_va_layout, .maxlen = sizeof(sysctl_legacy_va_layout), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, #endif@@ -1231,7 +1231,7 @@ static struct ctl_table vm_table[] = { .data = &zone_reclaim_mode, .maxlen = sizeof(zone_reclaim_mode), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, {@@ -1287,7 +1287,7 @@ static struct ctl_table vm_table[] = { .data = &vdso_enabled, .maxlen = sizeof(vdso_enabled), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, #endif
Signature · 3 lines
Regards
dave
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�Quoted 9 lines · Dave Young
Quoted 6 lines · Don Zickus
Quoted 2 lines · Dave Young
proc_dointvecdoesn't check extra minmax params, useproc_dointvec_minmaxinstead ofproc_dointvecfor cases need boundaries check.Is this patch needed, if you are basically changing it again in patches 3 and 5?
Sure if 3 and 5 is acked, if someone object them then this is good?
Ok. I guess I would have posted patches 2-4 first to get everyone's opinion. Then if the reaction was negative, try with patch 1.
Personally I don't see any problems with patches 2-4. Then again I don't deal with sysctl that much, so I don't what rules there are in that area of code.
Cheers,
Don
Quoted 9 lines · Don Zickus
Quoted 8 lines · Dave Young
Quoted 6 lines · Don Zickus
Quoted 2 lines · Dave Young
proc_dointvecdoesn't check extra minmax params, useproc_dointvec_minmaxinstead ofproc_dointvecfor cases need boundaries check.Is this patch needed, if you are basically changing it again in patches 3 and 5?
Quoted 8 lines
Quoted 1 line
Sure if 3 and 5 is acked, if someone object them then this is good?
Ok. I guess I would have posted patches 2-4 first to get everyone's opinion. Then if the reaction was negative, try with patch 1.
Personally I don't see any problems with patches 2-4. Then again I don't deal with sysctl that much, so I don't what rules there are in that area of code.
No problem, I will try resend 2-4 with first one merged, Thanks.
Signature · 2 lines
Regards dave