]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agotmpfiles: change ownership of symlinks too
Lennart Poettering [Mon, 22 Jan 2018 20:03:53 +0000 (21:03 +0100)] 
tmpfiles: change ownership of symlinks too

Ownership is supported for symlinks, too, only file modes are not.
Support that too.

Fixes: #7509
6 years agoMerge pull request #7965 from poettering/local-gateways-fix
Lennart Poettering [Tue, 23 Jan 2018 20:15:15 +0000 (21:15 +0100)] 
Merge pull request #7965 from poettering/local-gateways-fix

netlink fixes, including better determination of the default gateway, to fix #7854

6 years agoresolve: signal Ed25519 support (#7960)
ott [Tue, 23 Jan 2018 20:13:05 +0000 (21:13 +0100)] 
resolve: signal Ed25519 support (#7960)

Ed25519 is supported but not signalled as an understood cryptographic
algorithm as per RFC 6975.

6 years agoMerge pull request #7971 from poettering/dev-node-fixes
Yu Watanabe [Tue, 23 Jan 2018 19:27:27 +0000 (04:27 +0900)] 
Merge pull request #7971 from poettering/dev-node-fixes

small follow-up for #7886

6 years agonamepace: fix error handling when clone_device_node() returns 0 7971/head
Lennart Poettering [Tue, 23 Jan 2018 18:37:59 +0000 (19:37 +0100)] 
namepace: fix error handling when clone_device_node() returns 0

Before this patch, we'd treat clone_device_node() returning 0 (as
opposed to 1) as error, but then propagate this non-error result in
confusion.

This makes sure that if we ptmx isn't around we propagate that as
-ENXIO.

This is a follow-up for 98b1d2b8d9ea27087a5980b4b902b6a6ab716e03

6 years agoMerge pull request #7969 from poettering/stream-fd
Lennart Poettering [Tue, 23 Jan 2018 18:41:57 +0000 (19:41 +0100)] 
Merge pull request #7969 from poettering/stream-fd

man: minor improvements regarding journal API descriptions

6 years agonamespace: use is_symlink() helper
Lennart Poettering [Tue, 23 Jan 2018 18:36:55 +0000 (19:36 +0100)] 
namespace: use is_symlink() helper

We have this prett ylittle helper, let's use it, it makes things a tiny
bit more readable.

6 years agonamespace: use stack allocation for paths, where we can
Lennart Poettering [Tue, 23 Jan 2018 18:36:36 +0000 (19:36 +0100)] 
namespace: use stack allocation for paths, where we can

6 years agoman: it appears the description of async signal safety has its own man page now 7969/head
Lennart Poettering [Tue, 23 Jan 2018 18:09:54 +0000 (19:09 +0100)] 
man: it appears the description of async signal safety has its own man page now

Let's refer to the new page.

6 years agojournal: cast to (void) where we knowingly ignore syscall returns
Lennart Poettering [Tue, 23 Jan 2018 18:07:06 +0000 (19:07 +0100)] 
journal: cast to (void) where we knowingly ignore syscall returns

6 years agoman: document explicitly that sd_journal_stream_fd() never shares fds
Lennart Poettering [Tue, 23 Jan 2018 18:06:21 +0000 (19:06 +0100)] 
man: document explicitly that sd_journal_stream_fd() never shares fds

Also, clarify that O_NONBLOCK is turned off and that the fd is only
half-open.

6 years agoMerge pull request #7939 from npmccallum/implicit
Lennart Poettering [Tue, 23 Jan 2018 17:47:38 +0000 (18:47 +0100)] 
Merge pull request #7939 from npmccallum/implicit

Implicitly resolve default contexts in sd-event and sd-bus

6 years agopid1: rework how we dispatch SIGCHLD and other signals 7968/head
Lennart Poettering [Tue, 23 Jan 2018 17:18:13 +0000 (18:18 +0100)] 
pid1: rework how we dispatch SIGCHLD and other signals

This fundamentally makes one change: we never process more than one
signal or more than one waitid() event per event loop. We'll never tight
loop around waitid() or around read() on our signalfd instead, but
always return to the main event loop after processing one event.

By doing this we put the event priorization handling into full power
again, as we'll always check for higher priority events before looking
at the next signal or waitid() again.

This introduces a new "defer" event source "sigchld_event". It's enabled
as soon as we see SIGCHLD, and disabled as soon as waitid() reported no
further children pending. It's running at a relatively high priority,
one step higher than signal handling itself, but lower than
/proc/self/mountinfo event handling, so that the latter always takes
precedence.

Since we want to process sd_notify() events at an even higher priority
than SIGCHLD (as before) it is moved one priority step up, too.

Fixes: #7932
Possibly fixes: #7966

6 years agocore: move user lookup event priority to -11
Lennart Poettering [Tue, 23 Jan 2018 17:15:16 +0000 (18:15 +0100)] 
core: move user lookup event priority to -11

This is internal stuff, us talking to ourselves and relatively
independent of everything else, let's put this at
highest priority hence.

6 years agomount,swap: write event loop priority as "SD_EVENT_PRIORITY_NORMAL-x"
Lennart Poettering [Tue, 23 Jan 2018 17:13:01 +0000 (18:13 +0100)] 
mount,swap: write event loop priority as "SD_EVENT_PRIORITY_NORMAL-x"

We do that in all other cases, let's do it here too. Since
SD_EVENT_PRIORITY_NORMAL evaluates to zero there's zero effective
difference, but it makes things easier to grok and grep for if we always
express relative priorities within PID 1 only.

6 years agomanager: add MANAGER_IS_RUNNING() for checking whether the manager is running
Lennart Poettering [Tue, 23 Jan 2018 15:43:56 +0000 (16:43 +0100)] 
manager: add MANAGER_IS_RUNNING() for checking whether the manager is running

This macro is useful as the check is not obvious, and we better abstract
this away.

6 years agomanager: split out send_ready and basic.target checking into functions of their own
Lennart Poettering [Tue, 23 Jan 2018 15:32:06 +0000 (16:32 +0100)] 
manager: split out send_ready and basic.target checking into functions of their own

Let's shorten manager_check_finished() a bit by splitting out checking
of basic.target and the two things we do when we reach it.

This should not change behaviour, except for one thing: we now check
basic.target's actual state for figuring out whether it is up, instead
of generically checking whether it has any job queued. This is arguably
more correct, and is what other code does too for similar purposes, for
example manager_state()

6 years agoMerge pull request #7834 from jkloetzke/disable-watchdog
Lennart Poettering [Tue, 23 Jan 2018 14:58:17 +0000 (15:58 +0100)] 
Merge pull request #7834 from jkloetzke/disable-watchdog

core: add "disable watchdog " function

6 years agolocal-addresses: handle gracefully if routes lack an RTA_OIF attribute 7965/head
Lennart Poettering [Tue, 23 Jan 2018 14:48:28 +0000 (15:48 +0100)] 
local-addresses: handle gracefully if routes lack an RTA_OIF attribute

Some routes (such as those using "nexthop") don't have an RTA_OIF
attribute. We need to handle that gracefully, by simply ignoring the
route.

Fixes: #7854
6 years agotest-local-addresses: turn on debug logging by default
Lennart Poettering [Tue, 23 Jan 2018 14:47:56 +0000 (15:47 +0100)] 
test-local-addresses: turn on debug logging by default

This is a test, we should hence debug log.

6 years agosd-netlink: minor coding style updates
Lennart Poettering [Tue, 23 Jan 2018 14:47:18 +0000 (15:47 +0100)] 
sd-netlink: minor coding style updates

nothing really relevant

6 years agoAdd support for SD_BUS_DEFAULT* 7939/head
Nathaniel McCallum [Mon, 22 Jan 2018 21:26:44 +0000 (16:26 -0500)] 
Add support for SD_BUS_DEFAULT*

Currently, sd-bus supports the ability to have thread-local default busses.
However, this is less useful than it can be since all functions which
require an sd_bus* as input require the caller to pass it. This patch adds
a new macro which allows the developer to pass a constant SD_BUS_DEFAULT,
SD_BUS_DEFAULT_USER or SD_BUS_DEFAULT_SYSTEM instead. This reduces work for
the caller.

For example:

    r = sd_bus_default(&bus);
    r = sd_bus_call_method(bus, ...);
    sd_bus_unref(bus);

Becomes:

    r = sd_bus_call_method(SD_BUS_DEFAULT, ...);

If the specified thread-local default bus does not exist, the function
calls will return -ENOPKG. No bus will ever be implicitly created.

6 years agoAdd support for SD_EVENT_DEFAULT
Nathaniel McCallum [Mon, 22 Jan 2018 20:38:07 +0000 (15:38 -0500)] 
Add support for SD_EVENT_DEFAULT

Currently, sd-event supports the ability to have a thread-local default
event loop. However, this is less useful than it can be since all functions
which require an sd_event* as input require the caller to pass it. This
patch adds a new macro which allows the developer to pass a constant
SD_EVENT_DEFAULT instead. This reduces work for the caller.

For example:

    r = sd_event_default(&e);
    r = sd_event_add_io(e, ...);
    sd_event_unref(e);

Becomes:

    r = sd_event_add_io(SD_EVENT_DEFAULT, ...);

If no thread-local default event loop exists, the function calls will
return -ENOPKG. No event loop will ever be implicitly created.

6 years agoMerge pull request #7940 from sourcejedi/mount
Lennart Poettering [Tue, 23 Jan 2018 12:45:24 +0000 (13:45 +0100)] 
Merge pull request #7940 from sourcejedi/mount

mount rationalization

6 years agosd-dhcp6-client: Fix DHCPv6 client file descriptor handling
Patrik Flykt [Tue, 23 Jan 2018 10:34:31 +0000 (12:34 +0200)] 
sd-dhcp6-client: Fix DHCPv6 client file descriptor handling

The DHCPv6 client will set its state to DHCP6_STATE_STOPPED if
an error occurs or when receiving an Information Reply DHCPv6
message. Once in DHCP6_STATE_STOPPED, the DHCPv6 client needs
to be restarted by calling sd_dhcp6_client_start().

As of pull request #7796 client_reset() no longer closes the
network socket, thus a call to sd_dhcp6_client_start() needs to
check whether the file descriptor already exists in order not to
create a new one. Likewise, a call to sd_dhcp6_client_unref()
must now close the network socket as client_reset() is not
closing it.

Reported by asavah and Yu Watanabe.

6 years agomount: don't consider activated until /sbin/mount returns 7940/head
Alan Jenkins [Sat, 20 Jan 2018 20:12:09 +0000 (20:12 +0000)] 
mount: don't consider activated until /sbin/mount returns

So far, we considered mount units activated as soon as the mount
appeared.  This avoided seeing a difference between mounts started by
systemd, and e.g. by running `mount` from a terminal.
(`umount` was not handled this way).

However in some cases, options passed to `mount` require additional
system calls after the mount is successfully created.  E.g. the
`private` mount option, or the `ro` option on bind mounts.
It seems best to wait for mount to finish doing that.  E.g. in
the `private` case, the current behaviour could theoretically cause
non-deterministic results, as child mounts inherit the
private/shared propagation setting from their parent.

This also avoids a special case in mount_reload().

6 years agomount: clarify that umount retries do not (anymore) allow multiple timeouts
Alan Jenkins [Mon, 22 Jan 2018 17:42:25 +0000 (17:42 +0000)] 
mount: clarify that umount retries do not (anymore) allow multiple timeouts

It _looks_ as if, back when we used to retry unsuccessful calls to umount,
this would have inflated the effective timeout.  Multiplying it by
RETRY_UMOUNT_MAX.  Which is set to 32.

I'm surprised if it's true: I would have expected it to be noticed during
the work on NFS timeouts.  But I can't see what would have stopped it.

Clarify that I do not expect this to happen anymore.  I think each
individual umount call is allowed up to the full timeout, but if umount
ever exited with a signal status, we would stop retrying.

To be extra clear, make sure that we do not retry in the event that umount
perversely returned EXIT_SUCCESS after receiving SIGTERM.

6 years agomount: mountinfo event is supposed to always arrive before SIGCHLD
Alan Jenkins [Sat, 20 Jan 2018 20:05:52 +0000 (20:05 +0000)] 
mount: mountinfo event is supposed to always arrive before SIGCHLD

"Due to the io event priority logic we can be sure the new mountinfo is
loaded before we process the SIGCHLD for the mount command."

I think this is a reasonable expectation.  But if it works, then the
other comment must be false:

"Note that mount(8) returning and the kernel sending us a mount table
change event might happen out-of-order."

Therefore we can clean up the code for the latter.

If this is working as advertised, then we can make sure that mount units
fail if the mount we thought we were creating did not actually appear,
due to races or trickery (or because /sbin/mount did something unexpected
despite returning EXIT_SUCCESS).

Include a specific warning message for this failure.

If we give up when the mount point is still mounted after 32 successful
calls to /sbin/umount, that seems a fairly similar case.  So make that
message a LOG_WARN as well (not LOG_DEBUG). Also, this was recently changed to only
retry while umount is returning EXIT_SUCCESS; in that case in particular
there would be no other messages in the log to suggest what had happened.

6 years agohwdb: map zoomin/out keys to up/down
Martin Pitt [Mon, 22 Jan 2018 20:17:08 +0000 (21:17 +0100)] 
hwdb: map zoomin/out keys to up/down

Some keyboards come with a zoom see-saw or rocker which until now got
mapped to the Linux "zoomin/out" keys in hwdb. However, these keycodes
are not recognized by any major desktop. They now produce Up/Down key
events so that they can be used for scrolling.

The internet is full of instructions how to "unbreak" these keys, e. g.

  https://askubuntu.com/questions/471802/make-the-zoom-slider-of-microsoft-natural-ergonomic-keyboard-4000-and-7000-scrol
  https://unix.stackexchange.com/questions/322075/how-to-get-ms-natural-ergonomic-4000-slider-work-on-linux-mint

So let's make it official. But keep their physical meaning in comments
in case desktops start to do something useful with them at some point.

Thanks to Finn Christiansen for the original patch!

Replaces #6953

6 years agohwdb: Add Microsoft Sculpt Comfort Mouse data (#7946)
Maciej S. Szmigiero [Tue, 23 Jan 2018 05:25:24 +0000 (06:25 +0100)] 
hwdb: Add Microsoft Sculpt Comfort Mouse data (#7946)

This adds measured Microsoft Sculpt Comfort (Bluetooth) Mouse data to hwdb.

6 years agoresolve: Adjust and unify D-Bus call timeout (#7847)
ott [Tue, 23 Jan 2018 00:53:31 +0000 (01:53 +0100)] 
resolve: Adjust and unify D-Bus call timeout (#7847)

DNS queries have a timeout of DNS_TRANSACTION_ATTEMPTS_MAX *
DNS_TIMEOUT_MAX_USEC = 120 s. Calls to the ResolveHostname method of
the org.freedesktop.resolve1.Manager interface have various call
timeouts that are smaller than 120 s. So it seems correct to adjust
the call timeout to the maximum query timeout and to unify the call
timeout among all callers.

A timeout of 120 s might seem large, in particular since BIND does seem
to have a query timeout of 10 s. However, it seems match the timeout
value of 120 s of Unbound. Moreover, the query and timeout handling of
resolve have problems and might be improved in the future, so this
change is at best an interim solution.

6 years agohwdb: Added sensor geometry for Jumper EZpad 6 Pro (#7955)
lbernstone [Tue, 23 Jan 2018 00:51:11 +0000 (17:51 -0700)] 
hwdb: Added sensor geometry for Jumper EZpad 6 Pro (#7955)

6 years agoloopback-setup: update log message (#7956)
Yu Watanabe [Tue, 23 Jan 2018 00:50:30 +0000 (09:50 +0900)] 
loopback-setup: update log message (#7956)

This makes not log "Failed to ..." when each operation succeeds.

Fixes #7930.

6 years agohwdb: readded accelerometer orientation entry for AsusTek TP500LB (#7958)
Gianluca Boiano [Tue, 23 Jan 2018 00:50:09 +0000 (01:50 +0100)] 
hwdb: readded accelerometer orientation entry for AsusTek TP500LB (#7958)

6 years agohwdb: add Ideazon Zboard Merc and Ideazon Zboard Fang (#6954)
Olivier Schwander [Mon, 22 Jan 2018 20:41:11 +0000 (21:41 +0100)] 
hwdb: add Ideazon Zboard Merc and Ideazon Zboard Fang (#6954)

6 years agobash-completion: systemd-analyze: add service-watchdogs verb 7834/head
Jan Klötzke [Mon, 22 Jan 2018 20:39:57 +0000 (21:39 +0100)] 
bash-completion: systemd-analyze: add service-watchdogs verb

6 years agoMerge pull request #7719 from gdamjan/efistub-LoaderImageIdentifier
Lennart Poettering [Mon, 22 Jan 2018 19:41:22 +0000 (20:41 +0100)] 
Merge pull request #7719 from gdamjan/efistub-LoaderImageIdentifier

EFI stub: add LoaderImageIdentifier, LoaderFirmwareInfo, LoaderFirmwareType and StubInfo

6 years agoMerge pull request #7952 from poettering/tmpfiles-tweaks
Lennart Poettering [Mon, 22 Jan 2018 19:33:40 +0000 (20:33 +0100)] 
Merge pull request #7952 from poettering/tmpfiles-tweaks

Some tmpfiles tweaks

6 years agosystemctl: replace manual GetAll call with bus_map_all_properties() in unit_exists()
Reverend Homer [Mon, 22 Jan 2018 15:04:44 +0000 (18:04 +0300)] 
systemctl: replace manual GetAll call with bus_map_all_properties() in unit_exists()

6 years agofix reload propagation for device alias
Jérémy Rosen [Sat, 6 Jan 2018 21:55:22 +0000 (22:55 +0100)] 
fix reload propagation for device alias

udev-made .device aliases are not normal alias

They are full-fledged units which are linked to
the same sysfs path

we need to explicitely propagate reload to all
alias

6 years agosystemd-analyze: add service-watchdogs verb
Jan Klötzke [Thu, 11 Jan 2018 09:44:38 +0000 (10:44 +0100)] 
systemd-analyze: add service-watchdogs verb

New debug verb that enables or disables the service runtime watchdogs
and emergency actions during runtime. This is the systemd-analyze
version of the systemd.service_watchdogs command line option.

6 years agopid1: add option to disable service watchdogs
Jan Klötzke [Mon, 20 Mar 2017 12:10:43 +0000 (13:10 +0100)] 
pid1: add option to disable service watchdogs

Add a "systemd.service_watchdogs=" option to the command line which
disables all service runtime watchdogs and emergency actions.

6 years agojournal: Fix journal dumping for json, cat and export output
Armin Widegreen [Thu, 11 Jan 2018 11:42:56 +0000 (12:42 +0100)] 
journal: Fix journal dumping for json, cat and export output

Incorporating the fix from d00f1d57 into other output formats of journalctl.

If journal files are corrupted, e.g. not cleanly closed, some journal
entries can not be read by output options other than 'short' (default).
If such entries has been identified, they will now just be skipped.

6 years agobus-util: add bool property setter
Jan Klötzke [Thu, 11 Jan 2018 09:42:27 +0000 (10:42 +0100)] 
bus-util: add bool property setter

6 years agocore/timer: Prevent timer looping when unit cannot start
Michal Koutný [Tue, 16 Jan 2018 18:22:46 +0000 (19:22 +0100)] 
core/timer: Prevent timer looping when unit cannot start

When a unit job finishes early (e.g. when fork(2) fails) triggered unit goes
through states
        stopped->failed (or failed->failed),
in case a ExecStart= command fails unit passes through
        stopped->starting->failed.

The former transition doesn't result in unit active/inactive timestamp being
updated and timer (OnUnitActiveSec= or OnUnitInactiveSec=) would use an expired
timestamp triggering immediately again (repeatedly).

This patch exploits timer's last trigger timestamp to ensure the timer isn't
triggered more frequently than OnUnitActiveSec=/OnUnitInactiveSec= period.

Steps to reproduce:

0) Create sample units:

cat >~/.config/systemd/user/looper.service <<EOD
[Service]
ExecStart=/usr/bin/sleep 2
EOD

cat >~/.config/systemd/user/looper.timer <<EOD
[Timer]
AccuracySec=5
OnUnitActiveSec=5
EOD

1) systemctl --user daemon-reload

2) systemctl --user start looper.timer
   # to have first activation timestamp/sentinel
   systemctl --user start looper.service

o  Observe the service is being regularly triggered.

3) systemctl set-property user@$UID.service TasksMax=2

o  Observe the tight looping as long as the looper.service cannot be started.

Ref: #5969

6 years agoupdate TODO 7915/head
Lennart Poettering [Wed, 17 Jan 2018 19:10:22 +0000 (20:10 +0100)] 
update TODO

6 years agocgtop: make sure we can show a tasks number for the root cgroup too
Lennart Poettering [Wed, 17 Jan 2018 18:01:44 +0000 (19:01 +0100)] 
cgtop: make sure we can show a tasks number for the root cgroup too

Let's also use our new API in cgtop so that we can finally show a usable
tasks count for the root cgroup too. Yay!

6 years agocgtop: minor modernization
Lennart Poettering [Wed, 17 Jan 2018 18:01:10 +0000 (19:01 +0100)] 
cgtop: minor modernization

6 years agocore: propagate TasksMax= on the root slice to sysctls
Lennart Poettering [Wed, 17 Jan 2018 17:50:27 +0000 (18:50 +0100)] 
core: propagate TasksMax= on the root slice to sysctls

The cgroup "pids" controller is not supported on the root cgroup.
However we expose TasksMax= on it, but currently don't actually apply it
to anything. Let's correct this: if set, let's propagate things to the
right sysctls.

This way we can expose TasksMax= on all units in a somewhat sensible
way.

6 years agocgroup: when querying the number of tasks in the root slice use the pid_max sysctl
Lennart Poettering [Wed, 17 Jan 2018 14:39:39 +0000 (15:39 +0100)] 
cgroup: when querying the number of tasks in the root slice use the pid_max sysctl

The root cgroup doesn't expose and properties in the "pids" cgroup
controller, hence we need to get the data from somewhere else.

6 years agocgroup: add proper API to determine whether our unit manags to root cgroup
Lennart Poettering [Wed, 17 Jan 2018 17:41:42 +0000 (18:41 +0100)] 
cgroup: add proper API to determine whether our unit manags to root cgroup

6 years agoutil: rework system_tasks_max() to make use of procfs_tasks_max()
Lennart Poettering [Wed, 17 Jan 2018 14:35:01 +0000 (15:35 +0100)] 
util: rework system_tasks_max() to make use of procfs_tasks_max()

Let's use our new code.

6 years agoutil-lib: add new procfs-util.[ch] API for dealing with tasks limits
Lennart Poettering [Wed, 17 Jan 2018 17:40:10 +0000 (18:40 +0100)] 
util-lib: add new procfs-util.[ch] API for dealing with tasks limits

As it turns out the limit on concurrent tasks on Linux nasty to
determine, hence let's appropriate helpers for this.

6 years agocgroup: use CGROUP_LIMIT_MAX where appropriate
Lennart Poettering [Wed, 17 Jan 2018 14:39:16 +0000 (15:39 +0100)] 
cgroup: use CGROUP_LIMIT_MAX where appropriate

6 years agoutil: introduce more accurate definitions of TASKS_MAX
Lennart Poettering [Wed, 17 Jan 2018 14:31:23 +0000 (15:31 +0100)] 
util: introduce more accurate definitions of TASKS_MAX

The maximum number of processes a tasks on the system is usually lower
than what pid_t would allow, and is compiled into the kernel (and
documented in proc(5)). Let's add proper defines for that, so that
we can adjust the pid_max sysctl without fearing invalid accesses.

6 years agonetword: tunnel remove unwanted space.
Susant Sahani [Mon, 22 Jan 2018 14:33:22 +0000 (20:03 +0530)] 
netword: tunnel remove unwanted space.

6 years agoremove canonicalize_file_name() mention from TODO
Reverend Homer [Mon, 22 Jan 2018 14:26:52 +0000 (17:26 +0300)] 
remove canonicalize_file_name() mention from TODO

canonicalize_file_name() invocations were replaced by chase_symlinks() in
Decemeber 2016 with PR #4694, so we don't need this mention in the TODO anymore

6 years agoupdate TODO 7952/head
Lennart Poettering [Mon, 22 Jan 2018 14:33:26 +0000 (15:33 +0100)] 
update TODO

6 years agotmpfiles: use the DEBUG_LOGGING macro where applicable
Lennart Poettering [Mon, 22 Jan 2018 14:33:13 +0000 (15:33 +0100)] 
tmpfiles: use the DEBUG_LOGGING macro where applicable

6 years agotmpfiles: add missing OOM check
Lennart Poettering [Mon, 22 Jan 2018 14:32:57 +0000 (15:32 +0100)] 
tmpfiles: add missing OOM check

6 years agotmpfiles: avoid using wrong type for strlen() result
Lennart Poettering [Mon, 22 Jan 2018 14:31:50 +0000 (15:31 +0100)] 
tmpfiles: avoid using wrong type for strlen() result

The result of strlen is size_t, hence let's not store it in an "int"
just to pass it on as as size_t right-away. In fact let's not store it
at all…

6 years agotmpfiles: in dir_cleanup() take benefit that log_error_errno() returns the error...
Lennart Poettering [Mon, 22 Jan 2018 14:31:01 +0000 (15:31 +0100)] 
tmpfiles: in dir_cleanup() take benefit that log_error_errno() returns the error code passed in

6 years agotmpfiles: fold five lines into two
Lennart Poettering [Mon, 22 Jan 2018 14:29:30 +0000 (15:29 +0100)] 
tmpfiles: fold five lines into two

log_full_errno() has all these nice benefits, let's make use of them to
shorten five lines into two.

6 years agoMerge pull request #7943 from yuwata/fix-chase_symlinks
Lennart Poettering [Mon, 22 Jan 2018 11:42:24 +0000 (12:42 +0100)] 
Merge pull request #7943 from yuwata/fix-chase_symlinks

fs-util: use `_cleanup_close_` attribute

6 years agojournald-native: Fix typo in MANDLOCK message
Frantisek Sumsal [Mon, 22 Jan 2018 10:18:53 +0000 (11:18 +0100)] 
journald-native: Fix typo in MANDLOCK message

6 years agonetworkd: DHCPv6 client allow to configure Rapid Commit (#6930)
Susant Sahani [Mon, 22 Jan 2018 08:09:18 +0000 (13:39 +0530)] 
networkd: DHCPv6 client allow to configure Rapid Commit (#6930)

The DHCPv6 client can obtain configuration parameters from a
DHCPv6 server through a rapid two-message exchange solicit and reply).
When the rapid commit option is enabled by both the DHCPv6 client and
the DHCPv6 server, the two-message exchange is used, rather than the default
four-method exchange (solicit, advertise, request, and reply). The two-message
exchange provides faster client configuration and is beneficial in environments
in which networks are under a heavy load.

Closes #5845

6 years agofuzz: cast to void when return value is ignored 7943/head
Yu Watanabe [Mon, 22 Jan 2018 00:56:46 +0000 (09:56 +0900)] 
fuzz: cast to void when return value is ignored

6 years agofuzz: check return value
Yu Watanabe [Mon, 22 Jan 2018 00:55:38 +0000 (09:55 +0900)] 
fuzz: check return value

Closes CID #1385306 and #1385300.

6 years agofuzz: fix coding style
Yu Watanabe [Sun, 21 Jan 2018 13:25:37 +0000 (22:25 +0900)] 
fuzz: fix coding style

6 years agocore: delay logging the taint string until after basic.target is reached (#7935)
Zbigniew Jędrzejewski-Szmek [Sun, 21 Jan 2018 12:17:54 +0000 (23:17 +1100)] 
core: delay logging the taint string until after basic.target is reached (#7935)

This happens to be almost the same moment as when we send READY=1 in the user
instance, but the logic is slightly different, since we log taint when
basic.target is reached in the system manager, but we send the notification
only in the user manager. So add a separate flag for this and propagate it
across reloads.

Fixes #7683.

6 years agotest-resolve: check return value
Yu Watanabe [Sun, 21 Jan 2018 10:38:29 +0000 (19:38 +0900)] 
test-resolve: check return value

Closes CID #1385310.

6 years agosd-dhcp6-client: do not refer uninitialized variable
Yu Watanabe [Sun, 21 Jan 2018 10:27:27 +0000 (19:27 +0900)] 
sd-dhcp6-client: do not refer uninitialized variable

Fixes CID #1385308.

6 years agofs-util: chase_symlinks(): prevent double free
Yu Watanabe [Sun, 21 Jan 2018 10:19:25 +0000 (19:19 +0900)] 
fs-util: chase_symlinks(): prevent double free

Fixes CID #1385316.

6 years agofs-util: use _cleanup_close_ attribute
Yu Watanabe [Sun, 21 Jan 2018 10:07:10 +0000 (19:07 +0900)] 
fs-util: use _cleanup_close_ attribute

The commit f14f1806e329fe92d01f15c22a384702f0cb4ae0 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.

6 years agoman: document that sd_j_stream_fd is signal safe (#7942)
Zbigniew Jędrzejewski-Szmek [Sun, 21 Jan 2018 09:51:55 +0000 (20:51 +1100)] 
man: document that sd_j_stream_fd is signal safe (#7942)

Fixes #7912.

6 years agomount: forbid mount on path with symlinks
Alan Jenkins [Fri, 19 Jan 2018 17:28:38 +0000 (17:28 +0000)] 
mount: forbid mount on path with symlinks

It was forbidden to create mount units for a symlink.  But the reason is
that the mount unit needs to know the real path that will appear in
/proc/self/mountinfo.  The kernel dereferences *all* the symlinks in the
path at mount time (I checked this with `mount -c` running under `strace`).

This will have no effect on most systems.  As recommended by docs, most
systems use /etc/fstab, as opposed to native mount unit files.
fstab-generator dereferences symlinks for backwards compatibility.

A relatively minor issue regarding Time Of Check / Time Of Use also exists
here.  I can't see how to get rid of it entirely.  If we pass an absolute
path to mount, the racing process can replace it with a symlink.  If we
chdir() to the mount point and pass ".", the racing process can move the
directory.  The latter might potentially be nicer, except that it breaks
WorkingDirectory=.

I'm not saying the race is relevant to security - I just want to consider
how bad the effect is.  Currently, it can make the mount unit active (and
hence the job return success), despite there never being a matching entry
in /proc/self/mountinfo.  This wart will be removed in the next commit;
i.e. it will make the mount unit fail instead.

6 years agoMerge pull request #7938 from keszybz/get-fd-unsafe
Yu Watanabe [Sat, 20 Jan 2018 04:20:33 +0000 (13:20 +0900)] 
Merge pull request #7938 from keszybz/get-fd-unsafe

man: document signal unsafeness of sd_journal_get_fd

6 years agoman: document signal unsafeness of journal functions 7938/head
Zbigniew Jędrzejewski-Szmek [Sat, 20 Jan 2018 03:23:54 +0000 (14:23 +1100)] 
man: document signal unsafeness of journal functions

Fixes #7912.

6 years agoNEWS: fix typo
Zbigniew Jędrzejewski-Szmek [Sat, 20 Jan 2018 03:04:17 +0000 (14:04 +1100)] 
NEWS: fix typo

6 years agoman: sd_journal_stream_fd: no, fds are not shared (#7926)
Alan Jenkins [Sat, 20 Jan 2018 03:02:50 +0000 (03:02 +0000)] 
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".

6 years agoMerge pull request #7936 from titanous/fuzz-dhcp-server
Zbigniew Jędrzejewski-Szmek [Sat, 20 Jan 2018 02:58:19 +0000 (13:58 +1100)] 
Merge pull request #7936 from titanous/fuzz-dhcp-server

fuzz: add DHCP server fuzzer

6 years agofuzz: simplify oss-fuzz build instructions in HACKING 7936/head
Jonathan Rudenberg [Sat, 20 Jan 2018 01:10:51 +0000 (20:10 -0500)] 
fuzz: simplify oss-fuzz build instructions in HACKING

6 years agofuzz: add DHCP server fuzzer
Jonathan Rudenberg [Sat, 20 Jan 2018 00:44:56 +0000 (19:44 -0500)] 
fuzz: add DHCP server fuzzer

6 years agoman: fix typo (#7937)
Yu Watanabe [Sat, 20 Jan 2018 02:22:57 +0000 (11:22 +0900)] 
man: fix typo (#7937)

Reported by Дилян Палаузов (https://github.com/dilyanpalauzov) in #7870.

6 years agoMerge pull request #7934 from keszybz/man-improvements
Yu Watanabe [Sat, 20 Jan 2018 02:15:52 +0000 (11:15 +0900)] 
Merge pull request #7934 from keszybz/man-improvements

Man page improvements

6 years agonetworkd: add quickack option to route (#7896)
Susant Sahani [Fri, 19 Jan 2018 23:49:15 +0000 (05:19 +0530)] 
networkd: add quickack option to  route (#7896)

This patch adds quickack option to enable/disable TCP quick ack
mode for per-route.

6 years agoman: make clear that accessing network and mounting filesystems is not supported...
Michal Sekletar [Fri, 19 Jan 2018 23:47:27 +0000 (00:47 +0100)] 
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.

6 years agoman: clarify that Requires stop propagation only applies to explit requests 7934/head
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 23:45:02 +0000 (10:45 +1100)] 
man: clarify that Requires stop propagation only applies to explit requests

Follow-up for e79eabdb1becc93cf4afc909aa18dc40c931eab5. 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.

6 years agonetworkd: ignore Static Routes option when Classless Static Routes is given (#7807)
Susant Sahani [Fri, 19 Jan 2018 23:42:45 +0000 (05:12 +0530)] 
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

6 years agoman: alphabetize and move targets to proper sections in systemd.special
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 23:38:09 +0000 (10:38 +1100)] 
man: alphabetize and move targets to proper sections in systemd.special

6 years agoman: fix example formatting in systemd.preset
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 23:33:50 +0000 (10:33 +1100)] 
man: fix example formatting in systemd.preset

Repeating "example" everywhere was not useful, so remove
that and improve the formatting a bit.

6 years agoman: document default for WakeOnLan
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 23:33:15 +0000 (10:33 +1100)] 
man: document default for WakeOnLan

6 years agoman: add a note where coredump default values are
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 23:27:46 +0000 (10:27 +1100)] 
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…

6 years agoman: fix _STREAM_ID, _LINE_BREAK descriptions
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 23:15:06 +0000 (10:15 +1100)] 
man: fix _STREAM_ID, _LINE_BREAK descriptions

Pointed out by Дилян Палаузов (https://github.com/dilyanpalauzov).
Fixes #7870.

6 years agoMerge pull request #7675 from shawnl/unaligned
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 23:00:14 +0000 (10:00 +1100)] 
Merge pull request #7675 from shawnl/unaligned

Issue #7654 (unaligned loads on sparc64)

6 years agofuzz: add a note on reporting security bugs to HACKING
Jonathan Rudenberg [Thu, 18 Jan 2018 03:41:57 +0000 (22:41 -0500)] 
fuzz: add a note on reporting security bugs to HACKING

6 years agotest: add regression test for oss-fuzz issue 5465
Jonathan Rudenberg [Thu, 18 Jan 2018 14:40:37 +0000 (09:40 -0500)] 
test: add regression test for oss-fuzz issue 5465

Fixed in #7923

6 years agotest: add regression test for #7888
Jonathan Rudenberg [Thu, 18 Jan 2018 03:39:05 +0000 (22:39 -0500)] 
test: add regression test for #7888

6 years agofs-util: chase_symlinks(): support empty root
Yu Watanabe [Fri, 19 Jan 2018 09:05:28 +0000 (18:05 +0900)] 
fs-util: chase_symlinks(): support empty root

The commit b1bfb848046e457f3cd623286b8cc1a5e5440023 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.

6 years agoMerge pull request #7923 from keszybz/resolved-generic-packet
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 06:42:29 +0000 (17:42 +1100)] 
Merge pull request #7923 from keszybz/resolved-generic-packet

Resolved generic packet