Commit graph

35852 commits

Author SHA1 Message Date
Lennart Poettering 2214cfbf50 sd-boot: simplify memory management in processing of unified kernel image a bit 2018-10-16 16:44:34 +02:00
Lennart Poettering 42cf81c26f sd-boot: properly free all config entry fields 2018-10-16 16:44:34 +02:00
Lennart Poettering 081cc95fec sd-boot: rename ConfigEntry field 'file' to 'id'
The field derives from a file name only in very specific cases, for
many cases it's a fixed string (for example, all "auto-" items are like
this). Also, even when it derives from a file name, it is processed a
bit, as suffixes are removed and the string is converted to lower case.

hence, let's name this field "id" instead, because that's what it is
used for: as general identification token.
2018-10-16 16:44:34 +02:00
Lennart Poettering 580fe4df59 sd-boot: break overly long function argument lists following our usual coding style 2018-10-16 16:44:34 +02:00
Lennart Poettering 1336bb9864 sd-boot: drop initialization of 'line' which we override in the next line anyway 2018-10-16 16:44:34 +02:00
Lennart Poettering 2880e665ab efi: explicity check for NULL in FreePoolp()
Firmware implementations are generally pretty bad, hence let's better
add an explicit check for NULL before invokin FreePool(), in particular
is it doesn't appear to be documented whether FreePool() is supposed to
be happy with NULL.
2018-10-16 16:44:34 +02:00
Lennart Poettering 3aaa95e0a0 efi: add cleanup handler for closing file descriptors 2018-10-16 16:44:34 +02:00
Lennart Poettering b73acaed42 efi: add poor man's offsetof() implementation 2018-10-16 16:44:34 +02:00
Lennart Poettering d10ba83a1b mkosi: update the boot loader from our freshly built one 2018-10-16 16:44:34 +02:00
Lennart Poettering 52d363e32e mkosi: make kmsg work in our mkosi builds at least 2018-10-16 16:33:55 +02:00
Lennart Poettering 0972c1aefa NEWS: explain the RLIMIT_NOFILE bump 2018-10-16 16:33:55 +02:00
Lennart Poettering 0bbee2c226 rlimit-util: don't call setrlimit() needlessly if it wouldn't change anything
Just a tiny tweak to avoid generating an error if there's no need to.
2018-10-16 16:33:55 +02:00
Lennart Poettering a17c17122c core: bump RLIMIT_NOFILE soft+hard limit for systemd itself in all cases
Previously we'd do this for PID 1 only. Let's do this when running in
user mode too, because we know we can handle it.
2018-10-16 16:33:55 +02:00
Lennart Poettering c35ee02c61 units: bump the RLIMIT_NOFILE soft limit for all services that access the journal
This updates the unit files of all our serviecs that deal with journal
stuff to use a higher RLIMIT_NOFILE soft limit by default. The new value
is the same as used for the new HIGH_RLIMIT_NOFILE we just added.

With this we ensure all code that access the journal has higher
RLIMIT_NOFILE. The code that runs as daemon via the unit files, the code
that is run from the user's command line via C code internal to the
relevant tools. In some cases this means we'll redundantly bump the
limits as there are tools run both from the command line and as service.
2018-10-16 16:33:55 +02:00
Lennart Poettering 52d6207578 core: raise the RLIMIT_NOFILE hard limit for all services by default
Following the discussions with the kernel folks, let's substantially
increase the hard limit (but not the soft limit) of RLIMIT_NOFILE to
256K for all services we start.

Note that PID 1 itself bumps the limit even further, to the max the
kernel allows. We can deal with that after all.
2018-10-16 16:33:55 +02:00
Lennart Poettering 1abaf4887d tree-wide: uniformly bump RLIMIT_NOFILE in all our tools that access the journal
This makes use of rlimit_nofile_bump() in all tools that access the
journal. In some cases this replaces older code to achieve this, and
others we add it in where it was missing.
2018-10-16 16:33:55 +02:00
Lennart Poettering 99ab6fdf8c core: add a new call for bumping RLIMIT_NOFILE to "high" values
Following discussions with some kernel folks at All Systems Go! it
appears that file descriptors are not really as expensive as they used
to be (both memory and performance-wise) and it should thus be OK to allow
programs (including unprivileged ones) to have more of them without ill
effects.

Unfortunately we can't just raise the RLIMIT_NOFILE soft limit
globally for all processes, as select() and friends can't handle fds
>= 1024, and thus unexpecting programs might fail if they accidently get
an fd outside of that range. We can however raise the hard limit, so
that programs that need a lot of fds can opt-in into getting fds beyond
the 1024 boundary, simply by bumping the soft limit to the now higher
hard limit.

This is useful for all our client code that accesses the journal, as the
journal merging logic might need a lot of fds. Let's add a unified
function for bumping the limit in a robust way.
2018-10-16 16:33:55 +02:00
Lennart Poettering d6e069f412 def: add a "high" limit for RLIMIT_NOFILE
This simply adds a new constant we can use for bumping RLIMIT_NOFILE to
a "high" value. It default to 256K for now, which is pretty high, but
smaller than the kernel built-in limit of 1M.

Previously, some tools that needed a higher RLIMIT_NOFILE bumped it to
16K. This new define goes substantially higher than this, following the
discussion with the kernel folks.
2018-10-16 16:33:55 +02:00
Lennart Poettering d3aeddb8d1 update TODO 2018-10-16 16:33:55 +02:00
Lennart Poettering a53f90ca24 siphash24: add helper for calculating the hash value for a string
Let's shorten some code.
2018-10-16 16:27:15 +02:00
Lennart Poettering 43d3c94e64
Merge pull request #10416 from poettering/udev-coverity
three simple coverity fixes
2018-10-16 16:26:44 +02:00
Yu Watanabe cd86deefa1 util: fix segfault in prioq_remove() with empty Prioq object 2018-10-16 22:27:30 +09:00
Yu Watanabe d13b5f5a85 util,test: introduce cleanup function prioq_freep()
This also simplifies test-prioq.c.
2018-10-16 22:17:08 +09:00
Yu Watanabe bbddd2b8d9 test: use CMP() macro at one more place 2018-10-16 21:56:46 +09:00
Lennart Poettering cb542e8488 udev: (void)ify calls to kill() where we knowingly ignore the return values
CID 1368231
CID 1368229
2018-10-16 13:52:21 +02:00
Lennart Poettering eb276e9841 udev: don't use devname before we acquired it
CID 1396107
2018-10-16 13:52:21 +02:00
Lennart Poettering cdc2af3e15 core: log about unit_watch_pid() failing
CID 1237509
2018-10-16 13:52:21 +02:00
Lennart Poettering 2011149a3c
Merge pull request #10327 from yuwata/test-sd-device-enumerator-subsystem
sd-device-enumerator: dedup enumerated devices and add test for subsystem filtering
2018-10-16 12:48:01 +02:00
Yu Watanabe 7a223c2e38 update TODO 2018-10-16 19:21:15 +09:00
Yu Watanabe 915375ed3b test: add tests for sd_netlink_slot_set_*() 2018-10-16 18:49:42 +09:00
Yu Watanabe c940a2310a test: add tests for sd_netlink_slot_get_*() 2018-10-16 18:42:42 +09:00
Yu Watanabe 8190a388a6 sd-netlink: make sd_netlink_slot take its description 2018-10-16 18:42:23 +09:00
Lennart Poettering 14d0a740b5 Set theme jekyll-theme-cayman 2018-10-16 11:32:09 +02:00
Zbigniew Jędrzejewski-Szmek 65d51875c2 catalog: fix name of variable
All the messages would (literally) say "The start-up result is RESULT."
because @RESULT@ was not defined.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1639482
and the first part of #8005.

Fixup for 646cc98dc8.
2018-10-16 10:21:08 +02:00
Harry Mallon 2c4370d66c rules: Add ID_REVISION environment var for NVMe devices 2018-10-16 10:20:31 +02:00
Zbigniew Jędrzejewski-Szmek 0919b554c6
Merge pull request #9824 from poettering/login-unit-fixes
many logind improvements
2018-10-16 09:34:27 +02:00
Zbigniew Jędrzejewski-Szmek 43debabc8b
Merge pull request #10391 from poettering/systemctl-exit-code-fixes
systemctl exit code fixes
2018-10-16 08:42:34 +02:00
Lennart Poettering 271f518f35 nspawn: TAKE_FD() is your friend 2018-10-15 19:45:37 +02:00
Lennart Poettering fbda85b078 tree-wide: use sockaddr_un_unlink() at two more places where appropriate 2018-10-15 19:44:34 +02:00
Lennart Poettering a4209121d7 udev: use safe_close() where we can 2018-10-15 19:40:51 +02:00
Lennart Poettering 6d5e65f645 tree-wide: add a single version of "static const int one = 1"
All over the place we define local variables for the various sockopts
that take a bool-like "int" value. Sometimes they are const, sometimes
static, sometimes both, sometimes neither.

Let's clean this up, introduce a common const variable "const_int_one"
(as well as one matching "const_int_zero") and use it everywhere, all
acorss the codebase.
2018-10-15 19:40:51 +02:00
Lennart Poettering 8e8132c6b8 socket-util: tighten socket_address_verify() checks a bit 2018-10-15 19:40:51 +02:00
Lennart Poettering 48e6a2dc84 socket-util: tweak commenting in socket_address_get_path()
Let's make clear explicitly that there's always a NUL byte following the
path, and how.
2018-10-15 19:40:51 +02:00
Lennart Poettering 69995bffb7 socket-util: include trailing NUL byte in SOCKADDR_UN_LEN() count for fs sockets
This is what unix(7) recommends, hence do so.
2018-10-15 19:40:51 +02:00
Lennart Poettering 95cb14b068 sd-bus: rework how we initialize struct sockaddr_un
Let's use structured initialization, but more importantly, let's
increase salen by 1, if we reference AF_UNIX sockets in the file system,
so that they also contain the trailing NUL byte. This is what unix(7)
suggests to do, hence follow it.
2018-10-15 19:40:51 +02:00
Lennart Poettering 1d261418e2 sd-bus: make parsing of AF_UNIX socket addresses more strict
Insist on NUL termination, just to be safe rather than sorry. The kernel
doesn't require it, but it's really annoying if people rely on this,
hence refuse this early.
2018-10-15 19:40:51 +02:00
Lennart Poettering 15a3e96f92 tree-wide: port various users over to sockaddr_un_set_path()
CID 1396140
CID 1396141
2018-10-15 19:40:51 +02:00
Lennart Poettering 5cf91ea9c8 socket-util: add sockaddr_un_set_path() helper
Properly initializing sun_path from foreign data is not easy, given the
size constraints, and NUL confusion. Let's add a helper function for
this.
2018-10-15 19:35:00 +02:00
Lennart Poettering 44ed5214ad tree-wide: use structured initialization for sockaddr_un 2018-10-15 19:35:00 +02:00
Lennart Poettering ececf6c082 core: be more specific in error message 2018-10-15 19:35:00 +02:00