Commit graph

33039 commits

Author SHA1 Message Date
Stuart Hayes 609948c704 udev: net_id: Improve predictable names for SR-IOV virtual devices
With PCI SR-IOV, a number of virtual network devices can be enabled,
all of which share the same physical network device.  Currently,
udev generates names for SR-IOV virtual functions as if they were
independent network devices.

With this change, the predictable network device naming code will
check if a network device is an SR-IOV virtual device, and will
generate a name based on the physical PCI device plus a "v%u"
suffix.  This should improve readability and predictability of
device names.

Here is an example of how this change would affect naming:

before patch  |  after patch
-----------------------------
eno1          |  eno1          onboard NIC, physical function
enp101s0f0    |  eno1v0        onboard NIC, SR-IOV virtual func 0
enp101s0f1    |  eno1v1        onboard NIC, SR-IOV virtual func 1
2018-03-26 14:00:43 -04:00
Stuart Hayes 9009d3b5c3 udev: net_id: search parent devices for PCI slot number
To generate predictable network device names, the code in
udev-builting-net_id.c tries to match the PCI device address
of the network device to the entries in /sys/bus/pci/slots.
However, sometimes the slot number is not associated the
network controller PCI device itself, but rather with one of
its parents.

This change will try to find a match in /sys/bus/pci/slots for
the parents of the PCI network device, if it doesn't find a
match for the device itself.
2018-03-26 13:57:12 -04:00
Zbigniew Jędrzejewski-Szmek ffb3c2bd70
Merge pull request #8554 from poettering/chase-trail-slash
fs-util: add new CHASE_TRAIL_SLASH flag for chase_symlinks()
2018-03-26 18:00:08 +02:00
mourikwa de7df3fe97 Fix for alphabetical ordering (#8581)
I read the addition of the purism laptop keyboard and noticed
that the 60-keyboard.hwdb file could/should have an alphabetical ordering.
I scratched that itch with this commit.
2018-03-26 17:50:35 +02:00
Michael Olbrich 227b8a762f core: don't include libmount.h in a header file (#8580)
linux/fs.h sys/mount.h, libmount.h and missing.h all include MS_*
definitions.

To avoid problems, only one of linux/fs.h, sys/mount.h and libmount.h
should be included. And missing.h must be included last.

Without this, building systemd may fail with:

In file included from [...]/libmount/libmount.h:31:0,
                 from ../systemd-238/src/core/manager.h:23,
                 from ../systemd-238/src/core/emergency-action.h:37,
                 from ../systemd-238/src/core/unit.h:34,
                 from ../systemd-238/src/core/dbus-timer.h:25,
                 from ../systemd-238/src/core/timer.c:26:
[...]/sys/mount.h:57:2: error: expected identifier before numeric constant
2018-03-26 17:34:53 +02:00
Lennart Poettering 12b6b3b7a4
Merge pull request #8562 from keszybz/docs
Man page and log message fixes
2018-03-26 15:34:39 +02:00
Zbigniew Jędrzejewski-Szmek 94ac201ac2 README: mention systemd-stable
Fixes #8564.

https://www.freedesktop.org/wiki/Software/systemd/Backports/ has already been
adjusted.
2018-03-26 15:28:03 +02:00
Zbigniew Jędrzejewski-Szmek 435ce146ac basic/strbuf: include empty strings in count
Not that it matters much, but it seems cleaner to also count those
inputs, even if they do not consume extra storage space.

The test is extended to include an empty input and counts in the test are
adjusted to include it.
2018-03-26 15:28:03 +02:00
Zbigniew Jędrzejewski-Szmek 2fb076ad43 basic/strbuf: use structured initalizers to shorten code 2018-03-26 15:28:03 +02:00
Zbigniew Jędrzejewski-Szmek 2e38df5349 journal: use structured initalizer 2018-03-26 15:28:03 +02:00
Zbigniew Jędrzejewski-Szmek d6c5d19b66 tree-wide: add bsearch_safe and use where appropriate
Should fix #8557.
2018-03-26 15:28:03 +02:00
Zbigniew Jędrzejewski-Szmek 989290dbf1 fuzz-unit-file: add __has_feature(memory_sanitizer) when skipping ListenNetlink=
https://clang.llvm.org/docs/MemorySanitizer.html#id5 documents this
check as the way to detect MemorySanitizer at compilation time. We
only need to skip the test if MemorySanitizer is used.

Also, use this condition in cg_slice_to_path(). There, the code that is
conditionalized is not harmful in any way (it's just unnecessary), so remove
the FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION condition.

Fixes #8482.
2018-03-26 15:28:03 +02:00
Zbigniew Jędrzejewski-Szmek ea7a9e9e2a
Merge pull request #8578 from yuwata/resolve-tool-cleanup
resolve-tool: small cleanups
2018-03-26 14:54:30 +02:00
Zbigniew Jędrzejewski-Szmek 483ed8a6a0 fuzz-unit-file: adjust check for ListenNetlink yet again
The test for ListenNetlink would abort the loop if a line longer then LINE_MAX
was encountered (read_line() returns -ENOBUFS in that case). Let's use the
the line length limit that the unit file parses uses.

https://oss-fuzz.com/v2/issue/5546208027213824/7094.
2018-03-26 10:42:19 +02:00
Yu Watanabe 79b20ad8e2 resolve: always shows global settings 2018-03-25 18:57:19 +09:00
Zbigniew Jędrzejewski-Szmek 5ce6e7f525 core/service: rework the hold-off time over message
"hold-off" is apparently confusing, because we also have HoldoffTimeoutSec=.
Let's use RestartSec= directly in the message.

Fixes #5472.
2018-03-24 14:22:42 +01:00
Zbigniew Jędrzejewski-Szmek b3e4e23e83 man: add an additional note about journalctl -u
Fixes #5387.

I kept the _SYSTEMD_UNIT= example because it is easy to understand and
not very verbose. _SYSTEMD_CGROUP has much longer entries which do not
fit well in the narrow man page. Instead, I added an explanation of what
-u is translated into.
2018-03-24 14:22:42 +01:00
Zbigniew Jędrzejewski-Szmek 752ce3967e man: mention that oldest journal files are removed
Fixes #7225.
2018-03-24 14:19:03 +01:00
Zbigniew Jędrzejewski-Szmek 4bb890bc04 man: add a note about "archived" journal files and when files can be copied
Issue #6673 requests advice on backup strategy. But the right backup strategy
depends on many factors, too many to describe in a man page. So let's just
provide some general information which files are mutable and that it is always
safe to use/copy files.

Closes #6673.
2018-03-24 14:18:08 +01:00
Zbigniew Jędrzejewski-Szmek 2230a2908b man: add a note about $XDG_SEAT and $XDG_VTNR to pam_systemd(8)
Issue #6499 requests that a mention that those varibles can be set in the
environment is added. But the man page already says that. There isn't much
detail, but a man page does not need to and in this case should not include
all the details. Instead a note is added that those vars can be derived from
$DISPLAY.

Closes #6499.
2018-03-24 14:16:31 +01:00
Zbigniew Jędrzejewski-Szmek 8d5a4f27f5 man: add link and list of known attrs to systemd-gpt-auto-generator(8)
Fixes #7859.
2018-03-24 14:16:27 +01:00
Zbigniew Jędrzejewski-Szmek 0760dfc62f man: add missing headers to glib-event-glue.c 2018-03-24 14:15:48 +01:00
Zbigniew Jędrzejewski-Szmek 1027e0dc4d man: fix compilation of journal-iterate-poll.c
Our examples should compile...
2018-03-24 14:15:48 +01:00
Zbigniew Jędrzejewski-Szmek c0be035da7 man: drop license header in glib-event-glue.c
We're moving towards just SPDX license identifiers, and the boilerplate
is especially annoying in a man page. Also adjust to the smaller indentation
to make the code fit better on a page.
2018-03-24 14:15:48 +01:00
Zbigniew Jędrzejewski-Szmek 929f52632b man: move examples out of sd_journal_get_fd into separate files
man/.dir-locals is to keep indentation under control.

This makes it much easier to compile and run those examples, c.f. #7578.

v2:
- copy more of .dir-locals.el from the root to man/.dir-locals.el
  (I though emacs would inherit from the one in the parent dir, but
   it seems it just uses its own broken defaults, including
   indent-tabs-mode by default.)
2018-03-24 14:14:12 +01:00
Yu Watanabe 2892077c93 resolve: actually shows information about all specified interfaces 2018-03-24 17:53:16 +09:00
Zbigniew Jędrzejewski-Szmek 1238250f1d
Merge pull request #8565 from poettering/cocci-again
run all coccinelle again
2018-03-23 19:22:24 +01:00
Zbigniew Jędrzejewski-Szmek 1b25e0351a
Merge pull request #8559 from poettering/integration-test-fixes
make integration tests pass again
2018-03-23 19:21:25 +01:00
Lennart Poettering be6bca47ec coccinelle: run no-if-assignments.cocci again 2018-03-23 16:33:38 +01:00
Lennart Poettering f5c4b520ba coccinelle: run safe_fclose.cocci again 2018-03-23 16:32:48 +01:00
Lennart Poettering d2f646828e coccinelle: run while-true.cocci again 2018-03-23 16:32:26 +01:00
James Cowgill 303d6b4ca6 Partially revert "seccomp: add mmap and address family restrictions for MIPS" (#8563)
This reverts the mmap parts of f5aeac1439,
but keeps the part which restricts address families which works
correctly.

Unfortunately the MIPS toolchains still do not implement PT_GNU_STACK.
This means that while the commit to restrict mmap on MIPS was "correct",
it had the side effect of causing pthread_create to fail because glibc tries
to allocate an executable stack for new threads in the absense of
PT_GNU_STACK. We should wait until PT_GNU_STACK is implemented in all
the relevant parts of the toolchain (at least gcc and glibc) before
enabling this again.
2018-03-23 16:04:16 +01:00
Lennart Poettering 849b610489 run-coccinelle.sh: use set -x for showing command line of "spatch"
Let's make sure run-coccinelle.sh generates similar output as
run-integration-tests.sh, hence use the same "set -x" logic.
2018-03-23 15:46:12 +01:00
Lennart Poettering 34d267776a coccinelle: run const-strlen.cocci again 2018-03-23 15:46:12 +01:00
Lennart Poettering 967bae687c run-integration-tests: show number of tests run 2018-03-23 15:46:11 +01:00
Lennart Poettering ce6b7858ca run-integration-tests: show make command line executed
That makes it much easier to figure out what to type to just run one
specific test for debugging.
2018-03-23 15:45:47 +01:00
Lennart Poettering 67321fdf3e test: bypass selinux integration test if selinux policy devel package is not installed
With this "sudo ./run-integration-tests.sh" should work fully without
exception, even on systems lacking SELinux (in which case that test will
just be skipped)
2018-03-23 15:29:35 +01:00
Lennart Poettering 29f74559d4 stat-util: fix fd_is_network_ns()
This was broken in 77f9fa3b8e. My fault.

Fixes: #8543
2018-03-23 15:29:35 +01:00
Michal Sekletar 19496554e2 core: delay adding target dependencies until all units are loaded and aliases resolved (#8381)
Currently we add target dependencies while we are loading units. This
can create ordering loops even if configuration doesn't contain any
loop. Take for example following configuration,

$ systemctl get-default
multi-user.target

$ cat /etc/systemd/system/test.service
[Unit]
After=default.target

[Service]
ExecStart=/bin/true

[Install]
WantedBy=multi-user.target

If we encounter such unit file early during manager start-up (e.g. load
queue is dispatched while enumerating devices due to SYSTEMD_WANTS in
udev rules) we would add stub unit default.target and we order it Before
test.service. At the same time we add implicit Before to
multi-user.target. Later we merge two units and we create ordering cycle
in the process.

To fix the issue we will now never add any target dependencies until we
loaded all the unit files and resolved all the aliases.
2018-03-23 15:28:06 +01:00
Lennart Poettering 959071cac2
Merge pull request #8552 from keszybz/test-improvements
Test and diagnostics improvements
2018-03-23 15:26:54 +01:00
Lennart Poettering 2f5fa62bf7 tree-wide: tabs suck (#8527) 2018-03-23 15:21:35 +01:00
Lennart Poettering 3e44d24d3b backlight: minor modernizations (#8528)
Use strjoina() and STR_IN_SET()
2018-03-23 15:20:34 +01:00
Zbigniew Jędrzejewski-Szmek 4ddc526ce8
Merge pull request #8529 from poettering/logind-fixlets
three trivial logind improvements
2018-03-23 15:19:32 +01:00
Peter Hutterer 0cd6767cf0 udev: don't label high-button mice as joysticks (#8493)
If a device exposes more than 16 mouse buttons, we run into the BTN_JOYSTICK
range, also labelling it as joystick. And since 774ff9b this results in only
ID_INPUT_JOYSTICK but no ID_INPUT_MOUSE.

Fixes #8460
2018-03-23 15:15:41 +01:00
Zbigniew Jędrzejewski-Szmek fbbffb8c09
Merge pull request #8530 from poettering/include-is-obsolete
actively say that .include is obsolete
2018-03-23 15:13:02 +01:00
Zbigniew Jędrzejewski-Szmek f01eca96d0
Merge pull request #8533 from poettering/bootup-shutdown-phase2
extend docs on second phase of shutdown and watchdog handling
2018-03-23 15:11:46 +01:00
Zbigniew Jędrzejewski-Szmek ee5a59d144
Merge pull request #8534 from poettering/safe-atoi-full
some improvements to safe_atou() to allow specification of arbitrary bases
2018-03-23 12:30:12 +01:00
Zbigniew Jędrzejewski-Szmek 37c1d5e97d tree-wide: warn when a directory path already exists but has bad mode/owner/type
When we are attempting to create directory somewhere in the bowels of /var/lib
and get an error that it already exists, it can be quite hard to diagnose what
is wrong (especially for a user who is not aware that the directory must have
the specified owner, and permissions not looser than what was requested). Let's
print a warning in most cases. A warning is appropriate, because such state is
usually a sign of borked installation and needs to be resolved by the adminstrator.

$ build/test-fs-util

Path "/tmp/test-readlink_and_make_absolute" already exists and is not a directory, refusing.
   (or)
Directory "/tmp/test-readlink_and_make_absolute" already exists, but has mode 0775 that is too permissive (0755 was requested), refusing.
   (or)
Directory "/tmp/test-readlink_and_make_absolute" already exists, but is owned by 1001:1000 (1000:1000 was requested), refusing.

Assertion 'mkdir_safe(tempdir, 0755, getuid(), getgid(), MKDIR_WARN_MODE) >= 0' failed at ../src/test/test-fs-util.c:320, function test_readlink_and_make_absolute(). Aborting.

No functional change except for the new log lines.
2018-03-23 10:26:38 +01:00
Alan Jenkins 97a33b126c
Merge pull request #8553 from poettering/take-take
introduce TAKE_FD() and TAKE_PTR() macros
2018-03-22 22:33:38 +00:00
Lennart Poettering c5beecca19 units: document why systemd-time-wait-sync.service conditions on CAP_SYS_TIME (#8555)
As requested by @evverx in https://github.com/systemd/systemd/pull/8537#issuecomment-375122615
2018-03-22 23:41:54 +03:00