Commit graph

17560 commits

Author SHA1 Message Date
Matthijs van Duin cc9daff228 sd-bus: fix c++ compatibility (#5941)
g++ annoyingly requires a non-empty struct-initializer to initialize all
struct members, in order of declaration.

Signed-off-by: Matthijs van Duin <matthijsvanduin@gmail.com>
2017-05-11 18:55:26 -04:00
Zbigniew Jędrzejewski-Szmek fc1b2dc395 Merge pull request #5936 from ssahani/net-route
networkd: route replace parse prefix with generic in_addr_prefix_from_string
2017-05-11 18:53:35 -04:00
Zbigniew Jędrzejewski-Szmek d84ed2bd13 networkd: pretiffy message about invalid prefix
We know how the field we are parsing is called, let's put this information in
the error message:
"Route Source= prefix is invalid, ignoring assignment: ..."
"Route Destination= prefix is invalid, ignoring assignment: ..."
2017-05-11 14:01:14 -04:00
Lennart Poettering 271312e37b Merge pull request #5893 from keszybz/memorydenywriteexecute
Add support for more arches for MemoryDenyWriteExecute
2017-05-11 19:42:42 +02:00
Zbigniew Jędrzejewski-Szmek c826cd3f7c pid1: improve logging when failing to remount / ro (#5940)
https://bugzilla.redhat.com/show_bug.cgi?id=1227736#c49

We counted how many filesystems could not be unmounted, but only for those
filesystems which we tried to unmount. Since we only remount / ro, without
attempting to unmount, we would emit a confusing error message:

Remounting '/' read-only with options 'seclabel,space_cache,subvolid=5,subvol=/'.
Remounting '/' read-only with options 'seclabel,space_cache,subvolid=5,subvol=/'.
Remounting '/' read-only with options 'seclabel,space_cache,subvolid=5,subvol=/'.
All filesystems unmounted.

Warn when remount-ro fails, and for filesystems which we won't try to unmount,
include the failure to remount-ro in n_failed.

A few minor cleanups:
- remove unecessary goto which jumps to the next line anyway
- always calculate n_failed, even if log_error is false. This causes no change
  in behaviour, but I think the code is easier to follow, since the log setting
  cannot influence other logic.
2017-05-11 18:12:41 +02:00
Tom Gundersen f5938e8ff3 busctl: monitor - only start printing messages once we have become a monitor (#5931)
A connection becomes a monitor the moment it loses its unique name, so any
messages received before that should not be dumped to the console.

Currently, we print NameAcquired and NameLost for the unique name of the
peer that becomes the monitor, simply discard all messages until we
receive our NameLost signal.
2017-05-11 15:56:55 +02:00
Zbigniew Jędrzejewski-Szmek 52511fae7b core: fix warning about unsigned variable (#5935)
Fixup for d8c92e8bc7.
2017-05-11 08:15:28 +02:00
Susant Sahani 36423ff433 networkd: route replace parse prefix with generic in_addr_prefix_from_string 2017-05-11 10:12:54 +05:30
Peter Hutterer 61b2f1976c udev: don't allow pointing stick sensitivities greater than 255 (#5927)
It gets truncated, so the result is that people mess with the const accel
because the sensitivity isn't the expected 300 but the too-low 45.

One example: https://bugs.freedesktop.org/show_bug.cgi?id=100965
2017-05-10 21:22:00 +02:00
Lennart Poettering 554a080674 Merge pull request #5920 from fbuihuu/sysusers-disable-gshadow
Sysusers disable group shadow support
2017-05-10 19:46:13 +02:00
Zbigniew Jędrzejewski-Szmek da1921a5c3 seccomp: enable RestrictAddressFamilies on ppc64, autodetect SECCOMP_RESTRICT_ADDRESS_FAMILIES_BROKEN
We expect that if socket() syscall is available, seccomp works for that
architecture.  So instead of explicitly listing all architectures where we know
it is not available, just assume it is broken if the number is not defined.
This should have the same effect, except that other architectures where it is
also broken will pass tests without further changes. (Architectures where the
filter should work, but does not work because of missing entries in
seccomp-util.c, will still fail.)

i386, s390, s390x are the exception — setting the filter fails, even though
socket() is available, so it needs to be special-cased
(https://github.com/systemd/systemd/issues/5215#issuecomment-277241488).

This remove the last define in seccomp-util.h that was only used in test-seccomp.c. Porting
the seccomp filter to new architectures should be simpler because now only two places need
to be modified.

RestrictAddressFamilies seems to work on ppc64[bl]e, so enable it (the tests pass).
2017-05-10 09:21:16 -04:00
Franck Bui 1dd98a71e5 sysusers: make use of cleanup(unlink_and_freep) in write_files() and its auxiliary helpers
No functional changes.
2017-05-10 14:29:21 +02:00
Anchor Cat e7d54bf587 automount: ack automount requests even when already mounted (#5916)
If a process accesses an autofs filesystem while systemd is in the
middle of starting the mount unit on top of it, it is possible for the
autofs_ptype_missing_direct request from the kernel to be received after
the mount unit has been fully started:

  systemd forks and execs mount             ...
            ...                     access autofs, blocks
  mount exits                               ...
  systemd receives SIGCHLD                  ...
            ...                     kernel sends request
  systemd receives request                  ...

systemd needs to respond to this request, otherwise the kernel will
continue to block access to the mount point.
2017-05-10 13:23:58 +02:00
Franck Bui b14e1b4394 sysusers: make group shadow support configurable
Some distros (openSUSE) don't have group shadow support enabled. This can lead
to the following error:

  # systemd-sysusers
  Creating group foofoo with gid 478.
  # systemd-sysusers
  # groupdel foofoo
  # systemd-sysusers
  Creating group foofoo with gid 478.
  Failed to write files: File exists

This patch adds --disable-gshadow option to configure. If used,
systemd-sysvusers won't consider /etc/gshadow.
2017-05-10 10:19:37 +02:00
Franck Bui b20b0b6606 sysusers: split make_files()
This patch extracts the code which is in charge to write the new users or
groups into temporary files and move it into 4 dedicated functions.

This part was previously inlined in makes_files() making this function quite
big and hard to read and maintain.

There should be no functional change.
2017-05-10 10:06:20 +02:00
Max Resch b2bb40ce9a sd-boot: added shim signature/MOK validation (#5702)
Adds support for booting in a SecureBoot environment with shim as a
preloader. Install an appropriate UEFI security policy to check PE
signature of a chained kernel or UEFI application (using LoadImage())
against the MOK database maintained by shim, using shim's installed
BootServices.

Implementation details for installing the security policy are based on
code from the LinuxFoundation's SecureBoot PreLoader, part of efitools
licensed under LGPL 2.1

Current signed (by Microsoft) versions of shim (Versions 0.8 & 0.9)
so not install a security policy by themselves, future Versions of
shim might (a compile time switch exists in rectent git versions),
so in the future this PR might become unnecessary.
2017-05-09 20:57:40 +02:00
Lennart Poettering 7ce63d7c9b Merge pull request #5619 from fbuihuu/fully-restore-unit-cgroup-state
core: when deserializing a unit, fully restore its cgroup state
2017-05-09 20:49:17 +02:00
Lennart Poettering 4e168f4606 Merge pull request #5420 from OpenDZ/tixxdz/namespace-fixes-v2
Namespace: RootImage= RootDirectory= and MountAPIVFS fixes
2017-05-09 20:42:32 +02:00
Susant Sahani 6c1ff21b00 network: add support for vlan confs(MVRP, reorder header, loose binding) (#5834) 2017-05-09 20:25:11 +02:00
Hristo Venev 465dfe59fc networkd: add IPv6ProxyNDP (#5913)
This allows enabling proxy_ndp even if no addresses are configured in
networkd, as well as disabling proxy_ndp from a drop-in.
2017-05-09 20:04:55 +02:00
Susant Sahani c83ecc04d9 networkd: add support to configure route protocol. (#5890)
Closes: #5889
2017-05-09 20:01:25 +02:00
John Paul Adrian Glaubitz eb8124f6d5 meson: Add missing dependency on libkmod for libudev_core 2017-05-09 13:13:49 +02:00
John Paul Adrian Glaubitz 849c09c4dd meson: Add missing dependency on libseccomp for libcore 2017-05-09 13:13:43 +02:00
Aggelos Avgerinos 488ab41cb8 execute: Properly log errors considering socket fds (#5910)
Till now if the params->n_fds was 0, systemd was logging that there were
more than one sockets.

Thanks @gregoryp and @VFXcode who did the most work debugging this.
2017-05-08 19:09:22 -04:00
Michael Biebl 3e4a040c94 Merge pull request #5907 from keszybz/mark-python-scripts-+x
Mark python scripts executable
2017-05-08 02:30:27 +02:00
Ian Wienand 7e563bfc97 Add short-iso-precise for journalctl output (#5884)
This adds a short-iso-precise option for journalctl output.  It is similar to
short-iso, but includes microseconds.
2017-05-07 20:23:49 -04:00
Zbigniew Jędrzejewski-Szmek 6b0c49e036 Mark python scripts executable
Since all our python scripts have a proper python3 shebang, there is no benefit
to letting meson autodetect them. On linux, meson will just uses exec(), so the
shebang is used anyway. The only difference should be in how meson reports the
script and that the detection won't fail for (most likely misconfigured)
non-UTF8 locales.

Closes #5855.
2017-05-07 20:16:47 -04:00
Zbigniew Jędrzejewski-Szmek 9631518895 test-af-list: drop unnecessary backslash 2017-05-07 20:01:04 -04:00
Zbigniew Jędrzejewski-Szmek 511ceb1f8d seccomp: assume clone() arg order is known on all architectures
While adding the defines for arm, I realized that we have pretty much all
known architectures covered, so SECCOMP_RESTRICT_NAMESPACES_BROKEN is not
necessary anymore. clone(2) is adamant that the order of the first two
arguments is only reversed on s390/s390x. So let's simplify things and remove
the #if.
2017-05-07 20:01:04 -04:00
Zbigniew Jędrzejewski-Szmek 4278d1f531 seccomp: add mmap/shmat defines for arm and arm64 2017-05-07 20:01:04 -04:00
Zbigniew Jędrzejewski-Szmek 2a8d6e6395 seccomp: add mmap/shmat defines for ppc64 2017-05-07 20:01:04 -04:00
Zbigniew Jędrzejewski-Szmek 6dc666886a seccomp: factor out seccomp_rule_add_exact to a helper function 2017-05-07 19:01:11 -04:00
Zbigniew Jędrzejewski-Szmek 2a65bd94e4 seccomp: drop SECCOMP_MEMORY_DENY_WRITE_EXECUTE_BROKEN, add test for shmat
SECCOMP_MEMORY_DENY_WRITE_EXECUTE_BROKEN was conflating two separate things:
1. whether shmat/shmdt/shmget can be filtered (if ipc multiplexer is used, they can not)
2. whether we know this for the current architecture

For i386, shmat is implemented as ipc, so seccomp filter is "broken" for shmat,
but not for mmap, and SECCOMP_MEMORY_DENY_WRITE_EXECUTE_BROKEN cannot be used
to cover both cases. The define was only used for tests — not in the implementation
in seccomp-util.c. So let's get rid of SECCOMP_MEMORY_DENY_WRITE_EXECUTE_BROKEN
and encode the right condition directly in tests.
2017-05-07 18:59:37 -04:00
Zbigniew Jędrzejewski-Szmek ab8ee0f259 tree-wide: use SET_FLAG in more places (#5892) 2017-05-07 07:03:28 -04:00
Susant Sahani f7bf1abef9 socket-util: add parse_ip_prefix (#5867)
networkd: replace parse prefix with generic in_addr_prefix_from_string
2017-05-05 20:04:07 -04:00
Franck Bui 8b108bd0ef core: when deserializing a unit, fully restore its cgroup state
The state of a unit was not fully restored, especially the
"cgroup_realized_mask/cgroup_enabled_mask" fields were missing.

This could be seen with the following sequence:

 $ systemctl show -p TasksCurrent sshd
 TasksCurrent=1

 $ systemctl daemon-reload

 $ systemctl show -p TasksCurrent sshd
 TasksCurrent=18446744073709551615

This was also visible with the "status" command: "Tasks: " row wasn't
showed in status of a service after a "daemon-reload" command.
2017-05-04 09:41:23 +02:00
Franck Bui aae7e17f9c core: introduce cg_mask_from_string()/cg_mask_to_string() 2017-05-04 09:41:19 +02:00
Zbigniew Jędrzejewski-Szmek dce0e62046 test-seccomp: limit the code under #ifdef
Try to make the paths for supported and unsupported architectures as
similar as possible.
2017-05-03 19:50:39 +00:00
James Cowgill a3645cc6dd seccomp: add clone syscall definitions for mips (#5880)
Also updates the documentation and adds a mention of ppc64 support
which was enabled by #5325.

Tested on Debian mipsel and mips64el. The other 4 mips architectures
should have an identical user <-> kernel ABI to one of the 2 tested
systems.
2017-05-03 18:35:45 +02:00
Michael Biebl 8251ee109c Merge pull request #5842 from keszybz/meson-status-and-conditionals
Meson status and conditional simplification
2017-05-03 16:45:31 +02:00
Zbigniew Jędrzejewski-Szmek 2c201c2140 meson: use booleans for conf.set and drop unecessary conditionals
Using conf.set() with a boolean argument does the right thing:
either #ifdef or #undef. This means that conf.set can be used unconditionally.

Previously I used '1' as the placeholder value, and that needs to be changed to
'true' for consistency (under meson 1 cannot be used in boolean context). All
checks need to be adjusted.
2017-05-02 16:29:11 -04:00
Patrik Flykt 7feeb89980 sd-ndisc: Reset counter for sent Router Solicitations (#5874)
Reset also the counter for number of Router Solicitations sent when
the associated file descriptor is closed and the event source
unreferenced. With this change the router discovery can now be
stopped and restarted arbitrary many times.
2017-05-02 15:36:24 -04:00
Dimitri John Ledkov f00ff0de40 network: reject bridge port priorities above kernel's max value. (#5877)
Bridge port priority in the kernel can only be between 0 and 63. Therefore
reject values above maximum.

Fixes: #5729
2017-05-02 15:32:42 -04:00
Jörg Thalheim 3e67e5c992 more portable python shebangs (#5816)
This is useful on systems like NixOS, where python3 is not in
/usr/bin/python3 as well as for people using alternative ways to
install python such as virtualenv/pyenv.
2017-04-30 20:26:56 -04:00
Roelf Wichertjes 14b6bb7762 networkd: Add check to ensure link is down before attempting to enslave (#5853)
netdev to bond.

There are situations where a link can be in an "UP" state when
 systemd-networkd attempts to add the link to a bond device.
This is a problem because the bonding driver will refuse to
 enslave a link if it is in the "UP" state.
This check ensures systemd-networkd sets the link to "DOWN"
 before attempting to add the link to the bond.

Fixes #5838.
2017-04-30 13:12:32 +02:00
Lennart Poettering 2766d951c9 Merge pull request #5808 from ssahani/util
conf parser: add config_parse_ip_port
2017-04-30 11:36:12 +02:00
Max Resch a0693fc951 sd-boot: remove compiler warning (#5860)
This small fixup removes a compiler warning when passing tcg (a const
arg type) to the uefi call wapper, which does not define it as const.

All other source files in sd-boot do this cast except measure.c, so
let's fix that.
2017-04-29 22:11:34 -04:00
Martin Pitt 815e542b7c Merge pull request #5809 from keszybz/glob-safe
Implement `safe_glob` that ignores "." and ".."
2017-04-29 21:19:24 +02:00
Yusuke Nojima 5b3cc0c86a journald: fix assertion failure on journal_file_link_data. (#5843)
When some error occurs during the initialization of JournalFile,
the JournalFile can be left without hash tables created.  When later
trying to append an entry to that file, the assertion in
journal_file_link_data() fails, and journald crashes.

This patch fix this issue by checking *_hash_table_size in
journal_file_verify_header().
2017-04-29 19:37:53 +02:00
Susant Sahani 9cdf4e3d7d networkd: replace geneve/vxlan port parsing with generic config_parse_ip_port 2017-04-29 22:33:50 +05:30