Commit graph

31848 commits

Author SHA1 Message Date
Yu Watanabe 2b6d2dda6b fs-util: use _cleanup_close_ attribute
The commit f14f1806e3 introduced CHASE_SAFE
flag. When the flag is set, then `fd_parent` may not be properly closed.
This sets `_cleanup_close_` attribute to `fd_parent`.
Thus, now `fd_parent` is always closed properly.
2018-01-21 19:07:14 +09:00
Zbigniew Jędrzejewski-Szmek 91ec71c162 man: document that sd_j_stream_fd is signal safe (#7942)
Fixes #7912.
2018-01-21 18:51:55 +09:00
Yu Watanabe 08fde561ba
Merge pull request #7938 from keszybz/get-fd-unsafe
man: document signal unsafeness of sd_journal_get_fd
2018-01-20 13:20:33 +09:00
Zbigniew Jędrzejewski-Szmek 89f552c0e2 man: document signal unsafeness of journal functions
Fixes #7912.
2018-01-20 15:11:54 +11:00
Zbigniew Jędrzejewski-Szmek 000b1ba561 NEWS: fix typo 2018-01-20 14:04:17 +11:00
Alan Jenkins bf105e38d5 man: sd_journal_stream_fd: no, fds are not shared (#7926)
sd_journal_stream_fd() does not return the same file descriptor across
different calls.  It can't possibly do so, because the file descriptor
is created using certain parameters passed by the caller.

Also the implementation clearly isn't doing this, it's just connecting
to a unix socket.

It opens exactly one file descriptor, and does not close it unless there
is a write failure.  Nothing like "temporarily multiple file descriptors
may be open".
2018-01-20 14:02:50 +11:00
Zbigniew Jędrzejewski-Szmek 18e3beac2f
Merge pull request #7936 from titanous/fuzz-dhcp-server
fuzz: add DHCP server fuzzer
2018-01-20 13:58:19 +11:00
Jonathan Rudenberg 33d62eba91 fuzz: simplify oss-fuzz build instructions in HACKING 2018-01-19 21:48:14 -05:00
Jonathan Rudenberg 2bd37c5be2 fuzz: add DHCP server fuzzer 2018-01-19 21:48:14 -05:00
Yu Watanabe fec0ccea86 man: fix typo (#7937)
Reported by Дилян Палаузов (https://github.com/dilyanpalauzov) in #7870.
2018-01-20 13:22:57 +11:00
Yu Watanabe 7e577c30d6
Merge pull request #7934 from keszybz/man-improvements
Man page improvements
2018-01-20 11:15:52 +09:00
Susant Sahani 09f5dfad2c networkd: add quickack option to route (#7896)
This patch adds quickack option to enable/disable TCP quick ack
mode for per-route.
2018-01-20 08:49:15 +09:00
Michal Sekletar 877dce40cb man: make clear that accessing network and mounting filesystems is not supported in udev rules (#7916)
These restrictions are implied by systemd options used for
systemd-udevd.service, i.e. MountFlags=slave and
IPAddressDeny=any. However, there are users out there getting tripped by
this, so let's make things clear in the man page so the actual
restrictions we implement by default have better visibility.
2018-01-20 08:47:27 +09:00
Zbigniew Jędrzejewski-Szmek 22a705631d man: clarify that Requires stop propagation only applies to explit requests
Follow-up for e79eabdb1b. There was an
apparent contradiction:

  man/systemd.unit says for Requires=:

  Besides, with or without specifying After=, this unit will be deactivated
  if one of the other units get deactivated.

  Also, some unit types may deactivate on their own (for example, a service
  process may decide to exit cleanly, or a device may be unplugged by the
  user), which is not propagated to units having a Requires= dependency.

Fixes #7870.
2018-01-20 10:45:02 +11:00
Susant Sahani 8cdc46e7ba networkd: ignore Static Routes option when Classless Static Routes is given (#7807)
When the DHCP server returns both a Classless Static Routes
option and a Static Routes option, the DHCP client MUST ignore the
Static Routes option.

Closes #7792
2018-01-20 08:42:45 +09:00
Zbigniew Jędrzejewski-Szmek 1317f55b9b man: alphabetize and move targets to proper sections in systemd.special 2018-01-20 10:38:09 +11:00
Zbigniew Jędrzejewski-Szmek 1655cdee04 man: fix example formatting in systemd.preset
Repeating "example" everywhere was not useful, so remove
that and improve the formatting a bit.
2018-01-20 10:37:34 +11:00
Zbigniew Jędrzejewski-Szmek c605bd00d2 man: document default for WakeOnLan 2018-01-20 10:33:15 +11:00
Zbigniew Jędrzejewski-Szmek 8eeaf79c86 man: add a note where coredump default values are
I don't want to include all the default values in the man page
because that's bound to get out of date…
2018-01-20 10:27:46 +11:00
Zbigniew Jędrzejewski-Szmek ee8f5a58b0 man: fix _STREAM_ID, _LINE_BREAK descriptions
Pointed out by Дилян Палаузов (https://github.com/dilyanpalauzov).
Fixes #7870.
2018-01-20 10:15:06 +11:00
Zbigniew Jędrzejewski-Szmek c3de717e51
Merge pull request #7675 from shawnl/unaligned
Issue #7654 (unaligned loads on sparc64)
2018-01-20 10:00:14 +11:00
Yu Watanabe 22bc57c58a fs-util: chase_symlinks(): support empty root
The commit b1bfb84804 makes chase_symlinks()
recognize empty string for root as an invalid parameter. However,
empty root is often used e.g. systemd-nspawn.
This makes chase_symlinks() support empty string safely.

Fixes #7927.
2018-01-19 11:41:28 +01:00
Zbigniew Jędrzejewski-Szmek 8f2e968659
Merge pull request #7923 from keszybz/resolved-generic-packet
Resolved generic packet
2018-01-19 17:42:29 +11:00
Alan Jenkins 68f7480b7e
Merge pull request #7913 from sourcejedi/devpts
3 nitpicks from core/namespace.c
2018-01-18 21:56:26 +00:00
jdkbx 51aa88268e hwdb: Add Lenovo IdeaPad Miix 320 sensor mount quirk (#7707) 2018-01-19 05:09:58 +09:00
Alan Jenkins a30504ed69 man: systemd-nspawn: fix list of default capabilities (#7925)
* Sort them alphabetically.
* Add CAP_MKNOD (commit 7f112f50fe added it).

the list is now in sync with the one at the top of nspawn.c
2018-01-19 04:11:11 +09:00
Alan Jenkins 0970be500d
Merge pull request #7924 from sourcejedi/devpts-regression-fix
core: un-break PrivateDevices= by allowing it to mknod /dev/ptmx
2018-01-18 19:04:12 +00:00
Alan Jenkins 225874dc9c core: clone_device_node(): add debug message
For people who use debug messages, maybe it is helpful to know that
PrivateDevices= failed due to mknod(), and which device node.

(The other (un-logged) failures could be while mounting filesystems e.g. no
CAP_SYS_ADMIN which is the common case, or missing /dev/shm or /dev/pts,
or missing /dev/ptmx).
2018-01-18 13:58:13 +00:00
Alan Jenkins 5a7f87a9e0 core: un-break PrivateDevices= by allowing it to mknod /dev/ptmx
#7886 caused PrivateDevices= to silently fail-open.
https://github.com/systemd/systemd/pull/7886#issuecomment-358542849

Allow PrivateDevices= to succeed, in creating /dev/ptmx, even though
DeviceControl=closed applies.

No specific justification was given for blocking mknod of /dev/ptmx.  Only
that we didn't seem to need it, because we weren't creating it correctly as
a device node.
2018-01-18 12:10:20 +00:00
Zbigniew Jędrzejewski-Szmek bfc1d7345f resolved: fix confusion with generic data in unparsable packets
Issue 5465.
2018-01-18 20:28:38 +11:00
Zbigniew Jędrzejewski-Szmek 4a49e560d4 resolved: split out parts of dns_packet_extract
This fairly complicated function was deeply nested and
hard to read...
2018-01-18 19:35:47 +11:00
Zbigniew Jędrzejewski-Szmek 0241c1c0ee bus-message: avoid -Wnull-pointer-arithmetic warning on new clang
We just need some pointer, so use alignment directly converted
to the right type.
2018-01-18 17:38:35 +11:00
Zbigniew Jędrzejewski-Szmek 1aaadf859b
Merge pull request #7876 from titanous/oss-fuzz
Add initial fuzzing infrastructure
2018-01-18 12:41:13 +11:00
Jonathan Rudenberg 8b53eb4d47 fuzz: add docs on creating fuzzer targets to HACKING 2018-01-17 13:57:06 -05:00
Jonathan Rudenberg 31e57a35dc fuzz: allow building fuzzers outside of oss-fuzz
Add a new -Dllvm-fuzz=true option that can be used to build against
libFuzzer and update the oss-fuzz script to work outside of the
oss-fuzz build environment.
2018-01-17 13:57:06 -05:00
Jonathan Rudenberg 7d941c0635 fuzz: rebuild everything during each oss-fuzz build
This avoids failures while using the oss-fuzz local testing
infrastructure.
2018-01-17 13:57:06 -05:00
Jonathan Rudenberg b4081f3ea2 fuzz: disable all deps when building with oss-fuzz
The fuzz targets are intended to be fast and only target systemd
code, so they don't need to call out to any dependencies. They also
shouldn't depend on shared libraries outside of libc, so we disable
every dependency when compiling against oss-fuzz. This also
simplifies the upstream build environment significantly.
2018-01-17 13:57:06 -05:00
Jonathan Rudenberg 7db7d5b733 fuzz: add initial fuzzing infrastructure
The fuzzers will be used by oss-fuzz to automatically and
continuously fuzz systemd.

This commit includes the build tooling necessary to build fuzz
targets, and a fuzzer for the DNS packet parser.
2018-01-17 13:57:06 -05:00
Lennart Poettering 52ffb3d2e9
Merge pull request #7903 from yuwata/fix-7863
network: create runtime sub-directories after drop_privileges()
2018-01-17 19:18:47 +01:00
Lennart Poettering b79fe07243
Merge pull request #7910 from poettering/getcwd
some getcwd() fixes, and other path-util tweaks
2018-01-17 19:16:42 +01:00
Lennart Poettering 897c8395c7
Merge pull request #7911 from poettering/chase-symlinks-tweaks
chase_symlinks() tweaks
2018-01-17 19:15:49 +01:00
Alan Jenkins 8d95368210 core: namespace: remove unnecessary mode on /dev/shm mount target
This should have no behavioural effect; it just confused me.

All the other mount directories in this function are created as 0755.
Some of the mounts are allowed to fail - mqueue and hugepages.
If the /dev/mqueue mount target was created with the permissive mode 01777,
to match the filesystem we're trying to mount there, then a mount failure
would allow unprivileged users to write to the /dev filesystem, e.g. to
exhaust the available space.  There is no reason to allow this.

(Allowing the user read access (0755) seems a reasonable idea though, e.g. for
quicker troubleshooting.)

We do not allow failure of the /dev/shm mount, so it doesn't matter that
it is created as 01777.  But on the same grounds, we have no *reason* to
create it as any specific mode.  0755 is equally fine.

This function will be clearer by using 0755 throughout, to avoid
unintentionally implying some connection between the mode of the mount
target, and the mode of the mounted filesystem.
2018-01-17 18:04:34 +00:00
Alan Jenkins 45a582d536 README: fix context for CONFIG_DEVPTS_MULTIPLE_INSTANCES
`newinstance` (and `ptmxmode`) options of devpts are _not_ used by
PrivateDevices=.  (/dev/pts is shared, similar to how /dev/shm and
/dev/mqueue are handled).  It is used by nspawn containers though.

Also CONFIG_DEVPTS_MULTIPLE_INSTANCES was removed in 4.7-rc2
eedf265aa0
and no longer needs to be set, so make that clearer to avoid confusion.
2018-01-17 18:04:27 +00:00
Shawn Landden 8a0f6d1f6b resolve: check for underflow of size parameter (#7889)
to dns_packet_read_memdup()

Closes #7888
2018-01-18 00:49:22 +11:00
Alan Jenkins 98b1d2b8d9 core: namespace: nitpick /dev/ptmx error handling
If /dev/tty did not exist, or had st_rdev == 0, we ignored it.  And the
same is true for null, zero, full, random, urandom.

If /dev/ptmx did not exist, we treated this as a failure.  If /dev/ptmx had
st_rdev == 0, we ignored it.

This was a very recent change, but there was no reason for ptmx creation
specifically to treat st_rdev == 0 differently from non-existence.  This
confuses me when reading it.

Change the creation of /dev/ptmx so that st_rdev == 0 is
treated as failure.

This still leaves /dev/ptmx as a special case with stricter handling.
However it is consistent with the immediately preceding creation of
/dev/pts/, which is treated as essential, and is directly related to ptmx.

I don't know why we check st_rdev.  But I'd prefer to have only one
unanswered question here, and not to have a second unanswered question
added on top.
2018-01-17 13:28:32 +00:00
Lennart Poettering 382a5078a6 fs-util: refuse taking a relative path to chase if "root" is specified and CHASE_PREFIX_ROOT is set
If we take a relative path we first make it absolute, based on the
current working directory. But if CHASE_PREFIX_ROOT is passe we are
supposed to make the path absolute taking the specified root path into
account, but that makes no sense if we talk about the current working
directory as that is relative to the host's root in any case. Hence,
let's refuse this politely.
2018-01-17 12:04:15 +01:00
Lennart Poettering a49424af6a fs-util: extra chase_symlink() safety check on "path" parameter
It's not clear what an empty "path" is even supposed to mean, hence
refuse.
2018-01-17 12:04:15 +01:00
Lennart Poettering b1bfb84804 fs-util: extra safety checks on chase_symlinks() root parameter
Let's handle root="" and root="/" safely.
2018-01-17 12:04:15 +01:00
Lennart Poettering 7aeeb313ad path-util: don't insert duplicate "/" in path_make_absolute_cwd()
When the working directory is "/" it's prettier not to insert a second
"/" in the path, even though it is technically correct.
2018-01-17 11:17:55 +01:00
Lennart Poettering d72495759b tree-wide: port all code to use safe_getcwd() 2018-01-17 11:17:38 +01:00