Susant Sahani [Thu, 3 May 2018 15:20:56 +0000 (20:50 +0530)]
ethtool: get_glinksettings Fix copy (#8889)
It should be other way around.
Yu Watanabe [Thu, 3 May 2018 14:23:32 +0000 (23:23 +0900)]
Merge pull request #8859 from poettering/virt-xen-lying
Prefer DMI over CPUID when detecting Xen
Lennart Poettering [Thu, 3 May 2018 14:15:04 +0000 (16:15 +0200)]
locale-util: add comment with link to unicode chars supported by eurlatgr (#8894)
See: #6443
Lennart Poettering [Thu, 3 May 2018 14:10:35 +0000 (16:10 +0200)]
mount-setup: add a comment that the character/block device nodes are "optional" (#8893)
if we lack privs to create device nodes that's fine, and creating
/run/systemd/inaccessible/chr or /run/systemd/inaccessible/blk won't
work then. Document this in longer comments.
Fixes: #4484
Yu Watanabe [Thu, 3 May 2018 14:07:07 +0000 (23:07 +0900)]
Merge pull request #8887 from poettering/file-hier-efi
three improvements to the file-hierarchy(7) man page
Lennart Poettering [Thu, 3 May 2018 14:02:43 +0000 (16:02 +0200)]
man: docbook doesn't like line breaks within table cells (#8885)
It will pass them on as they are to the formatted man pages, which is
pretty uncool. Let's hence avoid line breaks with table cells.
Lennart Poettering [Thu, 3 May 2018 13:47:42 +0000 (15:47 +0200)]
test: don't send image building output to /dev/null (#8886)
Yes, the output is sometimes annyoing, but /dev/null is not the right
place...
I figure this redirection was left in from some debugging session, let's
fix it, and make the setup_basic_environment invocation like in all
other test scripts.
Evgeny Vereshchagin [Thu, 3 May 2018 13:35:38 +0000 (16:35 +0300)]
Merge pull request #8865 from yuwata/fix-signal
util: fix integer overflow
Lennart Poettering [Thu, 3 May 2018 13:13:42 +0000 (15:13 +0200)]
update TODO
Lennart Poettering [Thu, 3 May 2018 11:07:56 +0000 (13:07 +0200)]
Merge pull request #8892 from poettering/binfmt-misc-rst
binfmt_misc url fixes
Lennart Poettering [Thu, 3 May 2018 08:55:16 +0000 (10:55 +0200)]
test: list more up-to-date urls in test-web-util
This is based on @jsynacek's patch from #8837, but adds the new URL in
two flavours instead of replacing the old, also making @keszybz happy.
Replaces: #8837
Yu Watanabe [Thu, 3 May 2018 07:57:29 +0000 (16:57 +0900)]
oss-fuzz: add the reproducer case by oss-fuzz #8064
Yu Watanabe [Thu, 3 May 2018 07:47:12 +0000 (16:47 +0900)]
test: add tests for signal_from_string()
Yu Watanabe [Thu, 3 May 2018 07:38:57 +0000 (16:38 +0900)]
util: rename signal_from_string_try_harder() to signal_from_string()
Also this makes the new `signal_from_string()` function reject
e.g, `SIG3` or `SIG+5`.
Yu Watanabe [Thu, 3 May 2018 07:40:02 +0000 (16:40 +0900)]
util: make signal_from_string() accept RTMIN, RTMAX, and RTMAX-n
Before this, `signal_from_string()` accepts simple signal name
or RTMIN+n. This makes the function also accept RTMIN, RTMAX,
and RTMAX-n.
Note that RTMIN+0 is equivalent to RTMIN, and RTMAX-0 is to RTMAX.
This also fixes the integer overflow reported by oss-fuzz #8064.
https://oss-fuzz.com/v2/testcase-detail/
5648573352902656
Lennart Poettering [Wed, 2 May 2018 20:03:02 +0000 (22:03 +0200)]
man: refer to the html version of binfmt-misc.rst
Yes, the kernel's file is called "binfmt-misc.rst", but let's link the
HTML version, after all HTML is much more appropriate for hyperlinking.
Susant Sahani [Wed, 2 May 2018 18:16:10 +0000 (23:46 +0530)]
networkd: use ipv6_accept_ra_use_dns rather than dhcp_use_dns (#8836)
While Saving the DNS server use [IPv6AcceptRA] UseDNS= that is
ipv6_accept_ra_use_dns.
Closes #8420
Lennart Poettering [Wed, 2 May 2018 18:06:13 +0000 (20:06 +0200)]
test-functions: don't nest KVM (#8883)
Nested KVM is very flaky as we learnt from our CI. Hence, let's avoid
KVM whenever we detect we are already running inside of KVM.
Maybe one day nested KVM is fixed, at which point we can turn this on
again, but for now let's simply avoid nested KVM, since reliable CI is
more important than quick CI, I guess.
And yes, avoiding KVM for our qemu runs does make things substantially
slower, but I think it's not a complete loss.
Inspired by @evverx' findings in:
https://github.com/systemd/systemd/pull/8701#issuecomment-
380213302
Lennart Poettering [Wed, 2 May 2018 15:00:30 +0000 (17:00 +0200)]
man: suffix all dir paths in file-hierarchy(7) with "/"
Our CODING_STYLE document suggests to suffix all paths referring to dirs
rather than regular files with a "/" in our docs and log messages.
Update file-hierarchy(7) to do just that.
No other changes.
Lennart Poettering [Wed, 2 May 2018 14:55:37 +0000 (16:55 +0200)]
man: document /efi in file-hiearchy(7)
We have been supporting the directory since a while in the gpt
generator, let's document it in file-hierarchy(7) too
Lennart Poettering [Wed, 2 May 2018 14:54:32 +0000 (16:54 +0200)]
man: document the XDG specs as further sources of specifications for file-hierarchy(7)
We document this further down in the text, but let's also list this
early on, where we mention the FHS as major influence too, so that it is
clear we incorporate all that thinking.
Yu Watanabe [Wed, 2 May 2018 14:21:30 +0000 (23:21 +0900)]
udev: do not mark ari_enabled true when its sysattr value is 0 (#8870)
Fixes #8869.
Lennart Poettering [Wed, 2 May 2018 14:15:26 +0000 (16:15 +0200)]
Merge pull request #8866 from yuwata/fix-8842
core: disable namespace sandboxing for '+' prefixed lines
Lennart Poettering [Wed, 2 May 2018 12:32:00 +0000 (14:32 +0200)]
Merge pull request #8867 from yuwata/update-readme
doc: Update README
Yu Watanabe [Wed, 2 May 2018 08:54:52 +0000 (17:54 +0900)]
set: drop unused set_make() function (#8879)
The function causes compiler error when built with '-Ddebug=hashmap',
and is not used anymore. Let's drop it.
Lennart Poettering [Wed, 2 May 2018 08:51:48 +0000 (10:51 +0200)]
Merge pull request #8815 from poettering/get-unit-by-cgroup
add new GetUnitByControlGroup API
Yu Watanabe [Wed, 2 May 2018 08:05:51 +0000 (17:05 +0900)]
meson: drop 'name' argument in cc.has_argument() (#8878)
Adam Duskett [Wed, 2 May 2018 08:04:50 +0000 (04:04 -0400)]
add __nr_statx defines for extra architectures (#8872)
This includes:
- arm
- arm64
- alpha
- powerpc64
- sparc
Taken from kernel 4.16.6
Yu Watanabe [Wed, 2 May 2018 08:03:31 +0000 (17:03 +0900)]
nspawn: fix warning by -Wnonnull (#8877)
Filipe Brandenburger [Wed, 2 May 2018 06:47:04 +0000 (23:47 -0700)]
systemd-path: fix memory leak reported by ASAN (#8874)
The leak can be reproduced by running systemd-path --suffix .tmp under valgrind or asan:
$ ./build/systemd-path --suffix .tmp search-binaries
/usr/local/bin/.tmp:/usr/bin/.tmp:/usr/local/sbin/.tmp:/usr/sbin/.tmp:/home/vagrant/.local/bin/.tmp:/home/vagrant/bin/.tmp
=================================================================
==19177==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 56 byte(s) in 1 object(s) allocated from:
*0 0x7fd6adf72850 in malloc (/lib64/libasan.so.4+0xde850)
*1 0x7fd6ad2b93d2 in malloc_multiply ../src/basic/alloc-util.h:69
*2 0x7fd6ad2bafd2 in strv_split ../src/basic/strv.c:269
*3 0x7fd6ad42ba67 in search_from_environment ../src/libsystemd/sd-path/sd-path.c:409
*4 0x7fd6ad42bffe in get_search ../src/libsystemd/sd-path/sd-path.c:482
*5 0x7fd6ad42c55b in sd_path_search ../src/libsystemd/sd-path/sd-path.c:607
*6 0x7fd6ad42b3a2 in sd_path_home ../src/libsystemd/sd-path/sd-path.c:348
*7 0x55f59c65ebea in print_home ../src/path/path.c:97
*8 0x55f59c65f157 in main ../src/path/path.c:177
*9 0x7fd6abaea009 in __libc_start_main (/lib64/libc.so.6+0x21009)
Indirect leak of 68 byte(s) in 5 object(s) allocated from:
*0 0x7fd6adf72850 in malloc (/lib64/libasan.so.4+0xde850)
*1 0x7fd6abb5f689 in strndup (/lib64/libc.so.6+0x96689)
Indirect leak of 25 byte(s) in 1 object(s) allocated from:
*0 0x7fd6adf72850 in malloc (/lib64/libasan.so.4+0xde850)
*1 0x7fd6abb5f689 in strndup (/lib64/libc.so.6+0x96689)
*2 0x6c2e2f746e617266 (<unknown module>)
SUMMARY: AddressSanitizer: 149 byte(s) leaked in 7 allocation(s).
Yu Watanabe [Tue, 1 May 2018 06:18:10 +0000 (15:18 +0900)]
doc: update hosts nsswitch setting to which consistent to man pages
Yu Watanabe [Tue, 1 May 2018 06:16:39 +0000 (15:16 +0900)]
doc: drop static user systemd-timesync from README
Yu Watanabe [Tue, 1 May 2018 06:15:44 +0000 (15:15 +0900)]
doc: drop static user systemd-journal-gateway from README
and add systemd-journal-remote instead.
Yu Watanabe [Tue, 1 May 2018 04:42:48 +0000 (13:42 +0900)]
test: fix descriptions
Yu Watanabe [Tue, 1 May 2018 04:42:32 +0000 (13:42 +0900)]
test: add tests for PrivateDevices= with '+' prefix
Yu Watanabe [Tue, 1 May 2018 04:33:34 +0000 (13:33 +0900)]
core: disable namespace sandboxing for '+' prefixed lines
Fixes #8842.
Guillem Jover [Mon, 30 Apr 2018 16:21:27 +0000 (18:21 +0200)]
systemctl: make sure legacy "reboot", "suspend" and friends are always asynchronous (#8848)
Currently, "reboot" behaves differently in setups with and without logind.
If logind is used (which is probably the more common case) the operation
is asynchronous, we should behave in the same way as "systemctl <verb>".
Let's clean this up, and always expose the same behaviour, regardless if
logind is used or not: let's always make it asynchronous.
See: #6479
Fixes: commit
130246d2e8d7a0c91dbaa1110fa7a6d6e6f86a50
Lennart Poettering [Mon, 30 Apr 2018 10:24:57 +0000 (12:24 +0200)]
virt: simplifications
Let's simplify the code a bit. Let's reduce the number of redundant if
checks a bit, (i.e. if we want to check for equality with
VIRTUALIZATION_VM_OTHER there's no need to check for non-equality with
VIRTUALIZATION_NONE first). As a very welcome side-effect this means we
lose some lines of code and our level of indentation is reduced.
No changes in behaviour.
Lennart Poettering [Mon, 30 Apr 2018 10:23:03 +0000 (12:23 +0200)]
virt: if we detect Xen by DMI, trust that over CPUID
Apparently Xen sometimes lies about its identity when queried via CPUID.
Let's hence prefer DMI tests for CPUID
Fixes: #8844
Zbigniew Jędrzejewski-Szmek [Mon, 30 Apr 2018 07:50:03 +0000 (09:50 +0200)]
Merge pull request #8847 from poettering/transient-once
enforce that scope units are started at most once
Hans de Goede [Sat, 28 Apr 2018 08:43:06 +0000 (10:43 +0200)]
hwdb: Add accelerometer orientation quirk for the Kazam Vision tablet (#8845)
Add accelerometer orientation quirk for the 8" Kazam Vision "gaming"
tablet.
Lennart Poettering [Fri, 27 Apr 2018 19:31:43 +0000 (21:31 +0200)]
update TODO
Lennart Poettering [Fri, 27 Apr 2018 18:35:10 +0000 (20:35 +0200)]
core: enforce that scope units can be started only once
Scope units are populated from PIDs specified by the bus client. We do
that when a scope is started. We really shouldn't allow scopes to be
started multiple times, as the PIDs then might be heavily out of date.
Moreover, clients should have the guarantee that any scope they allocate
has a clear runtime cycle which is not repetitive.
Lennart Poettering [Fri, 27 Apr 2018 18:22:35 +0000 (20:22 +0200)]
Merge pull request #8808 from poettering/logind-signal
logind: process SIGTERM + SIGINT properly
Zbigniew Jędrzejewski-Szmek [Fri, 27 Apr 2018 16:26:19 +0000 (18:26 +0200)]
Merge pull request #8799 from poettering/exit-status-string
add friendly string support for BSD EX_ exit statusses
Lennart Poettering [Tue, 24 Apr 2018 16:23:29 +0000 (18:23 +0200)]
update TODO
Lennart Poettering [Tue, 24 Apr 2018 16:16:44 +0000 (18:16 +0200)]
machined: minor code cleanups, such as voidifying calls
Lennart Poettering [Tue, 24 Apr 2018 16:16:14 +0000 (18:16 +0200)]
logind: (void)ify all things we knowingly ignore
Lennart Poettering [Tue, 24 Apr 2018 16:14:25 +0000 (18:14 +0200)]
logind: terminate cleanly on SIGTERM/SIGINT
Let's properly terminate on SIGTERM or SIGINT. Previously we'd just rely
on the implicit process clean-up logic on UNIX. By shutting down
properly on SIGTERM/SIGINT we make it easier to track down memory leaks
by employing valgrind.
Lennart Poettering [Tue, 24 Apr 2018 16:13:12 +0000 (18:13 +0200)]
logind: modernize Manager object allocation and freeing
Let's propagate errors correctly, and stick to the usual naming and
behaviour of these functions. Or in other words, make this closer to the
matching code in machined.
Zbigniew Jędrzejewski-Szmek [Fri, 27 Apr 2018 16:00:58 +0000 (18:00 +0200)]
basic/log: always ignore errno from the enviornment (#8841)
This extends the change done in
b29f6480ec to other logging functions.
This actually fixes some bugs in callers of log_struct(), for example
config_parse_alias() called 'return log_syntax(..., 0, ...)' which could result
in a bogus non-zero return value.
Calls to log_object() and log_format_iovec() — which is only used by
server_driver_message() — appear correct.
Lennart Poettering [Fri, 27 Apr 2018 15:29:38 +0000 (17:29 +0200)]
journal-send: drop redundant parenthesis
As suggested in @keszybz' comments on #8840
Lennart Poettering [Tue, 24 Apr 2018 09:51:21 +0000 (11:51 +0200)]
man: don't claim we'd set XDG_SEAT and XDG_VTNR as part of service management
Previously, reading through systemd.exec(5) one might get the idea that
XDG_SEAT and XDG_VTNR are part of the service management logic, but they
are not, they are only set if pam_systemd is part of a PAM stack an
pam_systemd is used.
Hence, let's drop these env vars from the list of env vars, and instead
add a paragraph after the list mentioning that pam_systemd might add
more systemd-specific env vars if included in the PAM stack for a
service that uses PAMName=.
Lennart Poettering [Mon, 23 Apr 2018 17:26:25 +0000 (19:26 +0200)]
exit-status: list BSD exit codes too
Let's optionally translate BSD exit codes to error strings too.
My first approach on adding this was to turn ExitStatusLevel into a
bitmask rather than a linear level, with one bit for the various feature
bits. However, the exit code ranges are generally not defined
independently from each other, i.e. our own ones are defined with the
LSB ones in mind, and most sets are defined with the ISO C ones.
Hence, instead I changed the existing hierarchy of MINIMAL, SYSTEMD, LSB
with an alias of FULL == LSB, only slightly by seperating FULL and LSB
into two separate levels, so that there's now:
1. MINIMAL (only EXIT_SUCCESS/EXIT_FAILURE)
2. SYSTEMD (incorporating our own exit codes)
3. LSB (like SYSTEMD but adding in LSB service exit codes)
4. FULL (like FULL but adding BSD exit codes)
Note that across the codebase only FULL, SYSTEMD, and MINIMAL are used,
depending on context, how much we know about the process and whether we
are logging for debugging purposes or not. This means the LSB level
wouldn't really have to be separate, but it appeared careless to me to
fold it into FULL along with the BSD exit codes.
Note that this commit doesn't change much for regular codepaths: the
FULL exit status level is only used during debug logging, as a helper to
the user reading the debug logs.
Lennart Poettering [Mon, 23 Apr 2018 17:25:23 +0000 (19:25 +0200)]
man: document BSD exit codes in systemd.exec(5) too
Our own tools use them now, and we probably should encourage that, hence
let's document them along with the other exit codes we use.
Lennart Poettering [Mon, 23 Apr 2018 17:21:27 +0000 (19:21 +0200)]
doc: clarify the intended audience of CGROUP_DELEGATION.md
There was some confusion about who is the intended audience. Let's
clarify that early on, to ensure people aren't disappointed.
Lennart Poettering [Fri, 27 Apr 2018 15:15:45 +0000 (17:15 +0200)]
Merge pull request #8840 from poettering/unsigned-size_t
fix various array size/index types to be size_t rather than unsigned
Mikhail Kasimov [Fri, 27 Apr 2018 14:06:39 +0000 (17:06 +0300)]
man: updated systemd-analyze blame description for service-units with Type=simple (#8834)
Fixes #5121.
Lennart Poettering [Fri, 27 Apr 2018 12:28:51 +0000 (14:28 +0200)]
update TODO
Lennart Poettering [Fri, 27 Apr 2018 12:28:35 +0000 (14:28 +0200)]
tree-wide: use newa() rather than alloca() where we can
Lennart Poettering [Fri, 27 Apr 2018 12:27:14 +0000 (14:27 +0200)]
alloca: add an overflow check too
Of course, alloca() shouldn't be used with anything that can grow
without bounds anyway, but let's better safe than sorry, and catch this
early.
Since alloca() is not supposed to return an error we trigger an
assert() instead, which is still better than heap trickery.
Lennart Poettering [Fri, 27 Apr 2018 12:09:31 +0000 (14:09 +0200)]
tree-wide: be more careful with the type of array sizes
Previously we were a bit sloppy with the index and size types of arrays,
we'd regularly use unsigned. While I don't think this ever resulted in
real issues I think we should be more careful there and follow a
stricter regime: unless there's a strong reason not to use size_t for
array sizes and indexes, size_t it should be. Any allocations we do
ultimately will use size_t anyway, and converting forth and back between
unsigned and size_t will always be a source of problems.
Note that on 32bit machines "unsigned" and "size_t" are equivalent, and
on 64bit machines our arrays shouldn't grow that large anyway, and if
they do we have a problem, however that kind of overly large allocation
we have protections for usually, but for overflows we do not have that
so much, hence let's add it.
So yeah, it's a story of the current code being already "good enough",
but I think some extra type hygiene is better.
This patch tries to be comprehensive, but it probably isn't and I missed
a few cases. But I guess we can cover that later as we notice it. Among
smaller fixes, this changes:
1. strv_length()' return type becomes size_t
2. the unit file changes array size becomes size_t
3. DNS answer and query array sizes become size_t
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=76745
Yu Watanabe [Fri, 27 Apr 2018 11:07:23 +0000 (20:07 +0900)]
test: add tests for %j and %J specifier in test-execute (#8838)
Follow-up for
250e9fadbcc0ca90e697d7efb40855b054ed3b8f.
Lennart Poettering [Fri, 27 Apr 2018 10:58:16 +0000 (12:58 +0200)]
Merge pull request #8839 from yuwata/fix-8833
unit: tighten sandboxing for logind
Yu Watanabe [Fri, 27 Apr 2018 09:11:29 +0000 (18:11 +0900)]
unit: tighten sandboxing for logind
Yu Watanabe [Fri, 27 Apr 2018 08:50:26 +0000 (17:50 +0900)]
login: drop unnecessary headers
Susant Sahani [Fri, 27 Apr 2018 08:32:28 +0000 (14:02 +0530)]
networkd: Bridge Property Use kernel defaults. (#8825)
Rather than choosing to set or unset any of these flag
use kernel defaults. This patch makes following properties to unset.
UseBPDU = unset
HairPin = unset
FastLeave = unset
AllowPortToBeRoot = unset
UnicastFlood = unset
Lennart Poettering [Thu, 26 Apr 2018 19:39:05 +0000 (21:39 +0200)]
Merge pull request #7599 from keszybz/slice-templates
Make user@.service independent of logind
Lennart Poettering [Thu, 26 Apr 2018 19:19:16 +0000 (21:19 +0200)]
Merge pull request #8798 from yuwata/follow-up-8675
device: fix serialization and deserialization of DeviceFound
Yu Watanabe [Thu, 26 Apr 2018 19:05:32 +0000 (04:05 +0900)]
network: recreate link if its interface name is changed (#8795)
If an interface name is changed, then the link state, especially
managed or not, may need to be updated, as its corresponding
.link or .network files may be different. So, let's once drop
the link and recreate a new link object.
Fixes #8794.
Lennart Poettering [Thu, 26 Apr 2018 19:02:55 +0000 (21:02 +0200)]
Merge pull request #8776 from poettering/mtu-cleanup
networkd/udev: clean up parsing and handling of MTU values
Zbigniew Jędrzejewski-Szmek [Thu, 26 Apr 2018 18:31:11 +0000 (20:31 +0200)]
hwdb: add "special" keys on Dell XPS L702x (#8828)
Based on information provided by phenest in
https://github.com/systemd/systemd/issues/5341.
Those keys map to some special functions in windows, so let's map them
to prog1/prog2 so the user map them to something.
Fixes #5341.
Yu Watanabe [Thu, 26 Apr 2018 13:40:45 +0000 (22:40 +0900)]
core: an empty string resets delegate controllers but enables Delegate= (#8826)
This partially reverts
ff1b8455c26b560641d476b426209e297209333a.
Lennart Poettering [Fri, 20 Apr 2018 14:36:56 +0000 (16:36 +0200)]
link: follow our rule of suffix settings with = in log messages
Lennart Poettering [Fri, 20 Apr 2018 14:33:00 +0000 (16:33 +0200)]
networkd,udev: clean up MTU handling
This cleans up handling of MTU values across the codebase. Previously
MTU values where stored sometimes in uint32_t, sometimes in uint16_t,
sometimes unsigned and sometimes in size_t. This now unifies this to
uint32_t across the codebase, as that's what netlink spits out, and what
the majority was already using.
Also, all MTU parameters are now parsed with config_parse_mtu() and
config_parse_ipv6_mtu() is dropped as it is now unneeded.
(Note there is one exception for the MTU typing: in the DCHPv4 code we
continue to process the MTU as uint16_t value, as it is encoded like
that in the protocol, and it's probably better stay close to the
protocol there.)
Lennart Poettering [Fri, 20 Apr 2018 14:31:17 +0000 (16:31 +0200)]
conf-parse: add a generic config_parse_mtu() conf file parser function
It's mostly a wrapper around parse_mtu() but with some nicer logging.
The address family is initialized from the "ltype" parameter, so that
configuration file parser tables can be easily declare it.
Lennart Poettering [Fri, 20 Apr 2018 14:28:12 +0000 (16:28 +0200)]
parse-util: add explicit parsers for MTU values
We use MTUs all over the place, let's add a unified, strict parser for
it, that takes MTU ranges into account.
We already have parse_ifindex() close-by, hence this appears to be a
natural addition, in particular as the range checking is not entirely
trivial to do, as it depends on the protocol used.
Lennart Poettering [Fri, 20 Apr 2018 14:18:09 +0000 (16:18 +0200)]
missing: add IPV4_MIN_MTU
Similar to IPV6_MIN_MTU, let's add the same for IPv4.
Lennart Poettering [Fri, 20 Apr 2018 14:17:45 +0000 (16:17 +0200)]
networkd: drop duplicate definition of IPV6_MIN_MTU
We already have it in missing.h, and once suffices.
Antique [Thu, 26 Apr 2018 10:37:35 +0000 (12:37 +0200)]
cgroup-util: fix enabling of controllers (#8816)
If enabling controller for some reason fails we need to clear error
for the FILE stream. Enabling remaining controllers would otherwise
fail because write_string_stream_ts() checks for ferror(f) and returns
-EIO if there is one.
Broken by commit <
77fa610b22>.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Yu Watanabe [Thu, 26 Apr 2018 08:53:10 +0000 (17:53 +0900)]
meson: drop 'name' argument in cc.has_argument() (#8823)
This fixes the following warning with clang and meson-0.46.0,
```
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-typedef-redefinition: YES
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-gnu-variable-sized-type-not-at-end: YES
```
Zbigniew Jędrzejewski-Szmek [Thu, 26 Apr 2018 08:05:33 +0000 (10:05 +0200)]
core: include Found state in device dumps
In particular, this confirms that the Found state needs to remain a bit-field:
$ systemd-analyze dump |grep 'Found: '|sort |uniq -c
105 Found: found-udev
3 Found: found-udev,found-mount
1 Found: found-udev,found-swap
Yu Watanabe [Thu, 26 Apr 2018 07:51:11 +0000 (16:51 +0900)]
man: fix description of --value option for loginctl (#8820)
Zbigniew Jędrzejewski-Szmek [Tue, 24 Apr 2018 07:41:34 +0000 (09:41 +0200)]
logind: remove manager_start_slice()
It is now unused.
Zbigniew Jędrzejewski-Szmek [Sat, 9 Dec 2017 18:30:17 +0000 (19:30 +0100)]
logind: split %t directory creation to a helper unit
Unfortunately this needs a new binary to do the mount because there's just
too many special steps to outsource this to systemd-mount:
- EPERM needs to be treated specially
- UserRuntimeDir= setting must be obeyed
- SELinux label must be adjusted
This allows user@.service to be started independently of logind.
So 'systemctl start user@nnn' will start the user manager for user nnn.
Logind will start it too when the user logs in, and will stop it (unless
lingering is enabled) when the user logs out.
Fixes #7339.
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 21:25:26 +0000 (22:25 +0100)]
Use a dash-truncated drop-in for user-%j.slice configuration
This removes the UserTasksMax= setting in logind.conf. Instead, the generic
TasksMax= setting on the slice should be used. Instead of a transient unit we
use a drop-in to tweak the default definition of a .slice. It's better to use
the normal unit mechanisms instead of creating units on the fly. This will also
make it easier to start user@.service independently of logind, or set
additional settings like MemoryMax= for user slices.
The setting in logind is removed, because otherwise we would have two sources
of "truth": the slice on disk and the logind config. Instead of trying to
coordinate those two sources of configuration (and maintainer overrides to
both), let's just convert to the new one fully.
Right now now automatic transition mechanism is provided. logind will emit a
hint when it encounters the setting, but otherwise it will be ignored.
Fixes #2556.
Lennart Poettering [Wed, 25 Apr 2018 13:46:57 +0000 (15:46 +0200)]
Merge pull request #8812 from keszybz/gpt-auto-memleak
gpt-auto-generator: use stack variables and fix minor memleak
Yu Watanabe [Wed, 25 Apr 2018 13:05:00 +0000 (22:05 +0900)]
device: fix serialization and deserialization of DeviceFound
DeviceFound is a bit flag. So, it is necessary to support the case
that multiple bits are set.
Follow-up for
918e6f1c0151429f5095355f4f3f74f16e79724a.
Zbigniew Jędrzejewski-Szmek [Wed, 25 Apr 2018 11:47:18 +0000 (13:47 +0200)]
meson: do not link libsystemd_static into libcore (#8813)
(or in terms of the names of the actual files on disk, do not link
libsystemd-shared-238.a into libcore.a).
libsystemd_static is linked into libsystemd_shared, which in turn means that
anything that links to libcore and libsystemd_shared will get libsystemd_static
twice:
$ cc -o systemd 'systemd@exe/src_core_main.c.o' -Wl,--no-undefined -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie -DVALGRIND -Wl,--start-group src/core/libcore.a src/shared/libsystemd-shared-238.a src/shared/libsystemd-shared-238.so -pthread -lrt -lseccomp -lselinux -lmount -lblkid -Wl,--end-group -lseccomp -lpam -L/lib64 -laudit -lkmod -lmount -lrt -lcap -lacl -lcryptsetup -lgcrypt -lip4tc -lip6tc -lseccomp -lselinux -lidn -llzma -llz4 -lblkid '-Wl,-rpath,$ORIGIN/src/shared' -Wl,-rpath-link,/home/zbyszek/src/systemd/build/src/shared
This propagation of the dependency seems correct (in the sense that meson is
doing the expected thing based on the given configuration). Linking was done
this way in the original meson conversion. I was probably trying to get
everything to compile and link, I'm not sure why this particular choice was
made. In the meantime, meson has gotten better at propagating dependencies, so
it's possible that this had slightly different effect in the original
conversion, but I did not verify this. Either way, I think we should drop this.
With the patch:
$ cc -o systemd 'systemd@exe/src_core_main.c.o' -Wl,--no-undefined -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie -DVALGRIND -Wl,--start-group src/core/libcore.a src/shared/libsystemd-shared-238.so -pthread -lrt -lseccomp -lselinux -lmount -Wl,--end-group -lblkid -lrt -lseccomp -lpam -L/lib64 -laudit -lkmod -lselinux -lmount '-Wl,-rpath,$ORIGIN/src/shared' -Wl,-rpath-link,/home/zbyszek/src/systemd/build/src/shared
This is more correct because we're not linking the same code twice.
With the patch, libystemd_static is used in exactly four places:
- src/shared/libsystemd-shared-238.so
- src/udev/libudev.so.1.6.10
- pam_systemd.so
- test-bus-error
(compared to a bunch more executables before, including systemd,
systemd-analyze, test-hostname, test-ns, etc.)
Size savings are also noticable:
$ size /var/tmp/inst?/usr/lib/systemd/libsystemd-shared-238.so
text data bss dec hex filename
2397826 578488 15920 2992234 2da86a /var/tmp/inst1/usr/lib/systemd/libsystemd-shared-238.so
2397826 578488 15920 2992234 2da86a /var/tmp/inst2/usr/lib/systemd/libsystemd-shared-238.so
$ size /var/tmp/inst?/usr/lib/systemd/systemd
text data bss dec hex filename
1858790 261688 9320 2129798 207f86 /var/tmp/inst1/usr/lib/systemd/systemd
1556358 258704 8072 1823134 1bd19e /var/tmp/inst2/usr/lib/systemd/systemd
$ du -s /var/tmp/inst?
52216 /var/tmp/inst1
50844 /var/tmp/inst2
https://github.com/google/oss-fuzz/issues/1330#issuecomment-
384054530 might be related.
Lennart Poettering [Wed, 25 Apr 2018 11:36:06 +0000 (13:36 +0200)]
doc: recommend GetUnitByControlGroup() in the docs
Lennart Poettering [Wed, 25 Apr 2018 11:34:47 +0000 (13:34 +0200)]
core: add a new GetUnitByControlGroup() bus call
This is useful for foreign container runtimes implementing the OCI
runtime spec, which only wants to deal with cgroup paths. There's
already an API to translate units into cgroup paths, with this we add
the reverse.
Lennart Poettering [Wed, 25 Apr 2018 11:31:48 +0000 (13:31 +0200)]
core: hide snapshot method calls from introspection data
They are obsolete, let's hide them
Lennart Poettering [Wed, 25 Apr 2018 10:31:45 +0000 (12:31 +0200)]
tree-wide: drop redundant _cleanup_ macros (#8810)
This drops a good number of type-specific _cleanup_ macros, and patches
all users to just use the generic ones.
In most recent code we abstained from defining type-specific macros, and
this basically removes all those added already, with the exception of
the really low-level ones.
Having explicit macros for this is not too useful, as the expression
without the extra macro is generally just 2ch wider. We should generally
emphesize generic code, unless there are really good reasons for
specific code, hence let's follow this in this case too.
Note that _cleanup_free_ and similar really low-level, libc'ish, Linux
API'ish macros continue to be defined, only the really high-level OO
ones are dropped. From now on this should really be the rule: for really
low-level stuff, such as memory allocation, fd handling and so one, go
ahead and define explicit per-type macros, but for high-level, specific
program code, just use the generic _cleanup_() macro directly, in order
to keep things simple and as readable as possible for the uninitiated.
Note that before this patch some of the APIs (notable libudev ones) were
already used with the high-level macros at some places and with the
generic _cleanup_ macro at others. With this patch we hence unify on the
latter.
Zbigniew Jędrzejewski-Szmek [Wed, 25 Apr 2018 08:06:23 +0000 (10:06 +0200)]
gpt-auto-generator: emit warnings and fail if we fail to query mount points
Right now gpt-auto-generator will iterate through all mount entries, and
silently ignore failure to check if the mount point target is empty.
This can hide real errors (in particular from MAC), so instead let's warn
and return failure at the end if this happens. We will still iterate
over other candidates, so there should be no change in behaviour.
Logging is moved into path_is_busy() to avoid the duplication of the same
logging code in the two callers.
Zbigniew Jędrzejewski-Szmek [Wed, 25 Apr 2018 07:45:28 +0000 (09:45 +0200)]
gpt-auto-generator: use stack variables and fix minor memleak
Lennart Poettering [Wed, 25 Apr 2018 00:14:54 +0000 (02:14 +0200)]
Merge pull request #8807 from ChrisLesiak/systemd-update-done-mtime-fix
fileio.c: fix incorrect mtime
Zbigniew Jędrzejewski-Szmek [Tue, 24 Apr 2018 18:57:56 +0000 (20:57 +0200)]
Merge pull request #8775 from poettering/strip-cso
teach strip_tab_ansi() to strip ANSI CSO sequences
Lennart Poettering [Tue, 24 Apr 2018 18:25:27 +0000 (20:25 +0200)]
Merge pull request #8802 from keszybz/errno-reform
Errno reform
Chris Lesiak [Tue, 24 Apr 2018 14:50:42 +0000 (09:50 -0500)]
fileio.c: fix incorrect mtime
A regression was introduced that caused the mtime of /etc/.updated
and /var/.updated to be the current time when systemd-update-done
ran instead of being copied from /usr.
This was nearly fixed, but due to fflush being called after mtime
was carefully set, it was overwritten with the current time.
Regression introduced in
872c40396384f9fa89b01baf4e739d28ed590299
A fix was just missed in
39c38d773fbe2b4f76ff29ecd3344640efb9a86c
Fixes #8806
Lennart Poettering [Tue, 24 Apr 2018 15:30:07 +0000 (17:30 +0200)]
Merge pull request #8800 from keszybz/trivialities
Trivial cleanups