Commit Graph

211 Commits

Author SHA1 Message Date
Vladimir Kondratyev
f99e7b1aed evdev: export event device properties through sysctl interface
A big security advantage of Wayland is not allowing applications to read
input devices all the time. Having /dev/input/* accessible to the user
account subverts this advantage.

libudev-devd was opening the evdev devices to detect their types (mouse,
keyboard, touchpad, etc). This don't work if /dev/input/* is inaccessible.
With the kernel exposing this information as sysctls (kern.evdev.input.*),
we can work w/o /dev/input/* access, preserving the Wayland security model.

Submitted by:		Greg V <greg@unrelenting.technology>
Reviewed by:		wulf, imp
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D18694
2019-02-24 18:47:04 +00:00
Guangyuan Yang
c68d0f8b3d Remove -R option which was added to sysctl(8) man page per r244106, but it is not implemented.
MFC after:	3 days
Submitted by:	Alfonso Siciliano <alfix86@gmail.com>
Reviewed by:	0mp, imp
Differential Revision: 	https://reviews.freebsd.org/D19012
2019-02-09 04:36:02 +00:00
Mateusz Piotrowski
8251b8b87e sysctl(8): Add a standard exit status section.
Reviewed by:	bcr
Approved by:	re (gjb), krion (mentor)
Differential Revision:	https://reviews.freebsd.org/D17147
2018-09-24 20:46:45 +00:00
Konstantin Belousov
7404ab5ba9 Improve handling of the EFI map types[] array.
Use nitems(), do not assume EFI_MD_TYPE_ contiguous allocation, in
particular, switch to use designated array initializers.

Reviewed by:	jhb (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Approved by:	re (gjb)
2018-09-08 18:57:05 +00:00
Konstantin Belousov
d4bdf8ed9a Teach sysctl(8) about the Persistent memory type.
Add PersistentMemory to the list of sysctl's known memory types
when decoding an EFI memory map.

Submitted by:	D Scott Phillips <d.scott.phillips@intel.com>
MFC after:	1 week
Approved by:	re (rgrimes)
2018-09-07 15:09:56 +00:00
Konstantin Belousov
e1372c0e6d Trim whitespace.
Approved by:	re (gjb)
2018-09-07 14:37:44 +00:00
Brad Davis
40557b99f5 Move sysctl.conf to sbin/sysctl/ and switch to CONFS.
This helps with pkgbase to tag this config file as a config file.

Approved by:	allanjude (mentor), will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16559
2018-08-11 13:28:03 +00:00
John Baldwin
2365fe5616 Permit sysctl(8) to set an array of numeric values for a single node.
Most sysctl nodes only return a single value, but some nodes return an
array of values (e.g. kern.cp_time).  sysctl(8) understand how to display
the values of a node that returns multiple values (it prints out each
numeric value separated by spaces).  However, until now sysctl(8) has
only been able to set sysctl nodes to a single value.  This change
allows sysctl to accept a new value for a numeric sysctl node that contains
multiple values separated by either spaces or commas.  sysctl(8) parses
this list into an array of values and passes the array as the "new" value
to sysctl(2).

Reviewed by:	rpokala
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D14569
2018-03-09 23:37:19 +00:00
Konstantin Belousov
41c0f8d354 Improve sysctl(8) pretty printing of some structures.
S_vmtotal:
Use unsigned format to print unsigned memory counters from struct
vmtotal.
Remove unneeded cast, style locals declarations.

S_efi_map:
Make printing of the memory regions descriptions less MD by
using uintmax_t formats.

Noted by and discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-11-26 10:02:43 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Allan Jude
ed007b78d7 kern.osreldate is an integer, not a string
PR:		217501
Submitted by:	Yavuz Tanriverdi <stemix@gmail.com>
MFC after:	1 week
2017-09-16 16:23:00 +00:00
Andrew Gallatin
a18f34fe77 Don't request CTLTYPE_OPAQUE if we can't print them.
The intent is to skip expensive opaque sysctls like tcp_pcblist unless
they are explicitly requested. Sysctl nodes like this don't show up in
sysctl -a, but they do generate output that winds up being dropped,
unless the user specifically requested  binary/hex output or opaques.

This reduces the runtime of sysctl in many circumstances on a loaded
system.  It also reduces the likelihood that simply gathering
diagnostics on a sick machine (stuck lock, etc) via sysctl -a might
push it over the edge into a total lockup.

Reviewed by:	jtl
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D11461
2017-07-31 14:56:35 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Andriy Voskoboinyk
3ddb14a5df sysctl(8): fix typename for uint32_t.
MFC after:	5 days.
2016-12-31 12:39:15 +00:00
Konstantin Belousov
944e0bab86 Consolidate four efi_next_descriptor() definitions.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-09-18 17:38:02 +00:00
Alan Somers
4dad99bf48 Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
sbin/sysctl/sysctl.c
	Fix integer overflows in printf format strings

PR:		199673
Submitted by:	Vitaly Magerya
Reviewed by:	cem
Approved by:	re (marius)
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6941
2016-06-24 14:58:37 +00:00
Glen Barber
406d87b1c3 Explicitly add more files to the 'runtime' package.
Sponsored by:	The FreeBSD Foundation
2016-02-09 20:19:31 +00:00
Marcelo Araujo
8020192d7b Add -t option to display field types.
PR:		bin/203918
Submitted by:	ota <ota@j.email.ne.jp>
Reviewed by:	cem
Approved by:	bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D4451
2015-12-10 02:11:42 +00:00
Conrad Meyer
2a71f1ed95 Follow-up to r290475: Add sysctl(8) support for added types
Sponsored by:	EMC / Isilon Storage Division
2015-11-07 01:56:32 +00:00
Conrad Meyer
ec9f6de7d2 sysctl(8): Fix style nits
Suggested by:	bde
Sponsored by:	EMC / Isilon Storage Division
2015-10-23 15:40:44 +00:00
Conrad Meyer
c3220d0b6d Sysctl: Add common support for U8, U16 types
Sponsored by:	EMC / Isilon Storage Division
2015-10-22 23:03:06 +00:00
Baptiste Daroussin
e1619d123e Only print the errno string in case sysctl(3) does not file with ENOENT
This reduces the noise in error reporing from sysctl(8):

Before:
$ sysctl bla=something
sysctl: unknown oid 'bla': No such file or directory

After:
$ sysctl bla=something
sysctl: unknown oid 'bla'

MFC after:	1 week
Sponsored by:	Gandi.net
2015-10-07 09:28:54 +00:00
Baptiste Daroussin
ca587fdaac Trim spaces at the end of the buffer before trying to convert it to an oid
This allows to write entries in sysctl.conf with spaces before the '=' like
kern.ipc.shmmax = 9663676416

MFC after:	1 week
Sponsored by:	Gandi.net
2015-10-07 08:56:01 +00:00
Warner Losh
aa255ef6dd Teach sysctl about the new optional suffix after IK to specify
precision. Update input as well. Add IK to the manual (it was missing
completely).

Differential Revision: https://reviews.freebsd.org/D3181
2015-07-29 02:34:25 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
John-Mark Gurney
7582000531 add support for specifying an initial buffer size when fetching a
sysctl... This is useful for kern.arandom which (without -B) will
happily return 0 bytes, which isn't too useful or random...

fix spelling (thanks igor!) of settable while I'm here...
2015-02-13 01:20:37 +00:00
Xin LI
689c8e8b46 Fix inverted logic introduced in r272154.
Noticed by:	trasz
MFC after:	2 weeks
2014-12-01 20:51:01 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Xin LI
e267e00eef Refactor the code a little bit to reduce duplicated code.
Reviewed by:	mjg
MFC after:	2 weeks
2014-09-26 05:05:34 +00:00
Xin LI
4b8740cd0a Explicitly set errno to 0 before calling strto*.
Suggested by:	mjg
MFC after:	2 weeks
2014-09-25 22:47:19 +00:00
Xin LI
9e4ed37219 The strtol(3) family of functions would set errno when it hits one.
Check errno and handle it as invalid input.

Obtained from:	HardenedBSD
Submitted by:	David CARLIER <devnexen@gmail.com>
MFC after:	2 weeks
2014-09-25 22:37:27 +00:00
Xin LI
c58f8df6e7 Constify a parameter of name2oid. No functional change.
MFC after:	2 months
2014-09-23 22:15:00 +00:00
John Baldwin
7d8312cc92 Add a sysctl to export the EFI memory map along with a handler in the
sysctl(8) binary to format it.

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D771
2014-09-13 03:10:02 +00:00
John Baldwin
59101c5d95 Pass the length of an structure to the pretty-printer backends as a
size_t instead of an int.
2014-09-12 21:01:39 +00:00
John Baldwin
89871cdeb6 - Add a new structure type for the ACPI 3.0 SMAP entry that includes the
optional attributes field.
- Add a 'machdep.smap' sysctl that exports the SMAP table of the running
  system as an array of the ACPI 3.0 structure.  (On older systems, the
  attributes are given a value of zero.)  Note that the sysctl only
  exports the SMAP table if it is available via the metadata passed from
  the loader to the kernel.  If an SMAP is not available, an empty array
  is returned.
- Add a format handler for the ACPI 3.0 SMAP structure to the sysctl(8)
  binary to format the SMAP structures in a readable format similar to
  the format found in boot messages.

MFC after:	2 weeks
2014-08-29 21:25:47 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Hans Petter Selasky
04006eabea Don't hide zero-length strings when doing sysctl listings.
MFC after:	1 week
2014-06-27 15:23:12 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Edward Tomasz Napierala
c6919e7fdc Fix warnings to not append "No error: 0".
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2013-11-26 19:14:18 +00:00
Devin Teske
b85e9d27f6 Fix a typo: s/wriable/writable/ 2013-11-12 17:44:29 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Xin LI
6f36135181 Use the right format string for line buffer.
PR:		bin/174910
Submitted by:	Fabian Keil <fk fabiankeil.de>
2013-01-13 04:28:44 +00:00
Xin LI
da178c777f Teach sysctl(8) about parsing a file (while I'm there also give it
capability of parsing both = and : formats).

Submitted by:	hrs (initial version, bugs are mine)
MFC after:	3 months
2012-12-13 23:32:47 +00:00