Submit #2607

[PATCH] Add proper const keywords to sysctl(3) parameters.

Added by kAworu 10 months ago. Updated 10 months ago.

Status:ClosedStart date:11/22/2013
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

This patch import several patches from FreeBSD, namely:
- r204170 which make use of const keywords where appropriate
- r240176 which avoid a segfault when the `name' argument is invalid
- r204172 & r244153 are cosmetics changes.

I did a build of world+kernel and install and it has running fine for several hours.
More tests and code reviews are welcome. In particular I am unsure of r240176 (how is `name' tested for "validity"?).

0001-Add-proper-const-keywords-to-sysctl-3-parameters.patch Magnifier (6.98 KB) kAworu, 11/22/2013 11:06 AM

History

#1 Updated by kAworu 10 months ago

kAworu wrote:
> [...]
> In particular I am unsure of r240176 (how is `name' tested for "validity"?).

OK I think I got it: that's because sys___sysctl() begin by copyin(9) `name' which will return EFAULT if a bad address is encoutered.

#2 Updated by kAworu 10 months ago

As additional tests I've run `sysctl -a' and `sysctl -ad' with and without the patch. As expected, The `sysctl -ad' output was the same and `sysctl -a' revealed expected diff for some values (load average, vm stats vfs cache etc.).

#3 Updated by eadler 10 months ago

These patches look reasonable to me.

#4 Updated by swildner 10 months ago

  • Status changed from New to Closed

Pushed (00f0918d338a0f863b786ed4565f12971eaecdc8).

Thanks!

Also available in: Atom PDF