Commit Graph

32408 Commits

Author SHA1 Message Date
Lennart Poettering f09eb7688e doc: add a new doc/ directory, and move two markdown docs into them
I figure sooneror later we'll have more of these docs, hence let's give
them a clean place to be.

This leaves NEWS and README/README.md as well as the LICENSE texts in
the root directory of the project since that appears to be customary for
Free Software projects.
2018-02-27 19:59:09 +01:00
Zbigniew Jędrzejewski-Szmek 033c836647 missing_syscall: add pkey_mprotect for ppc (#8292)
Accurate for both ppc and ppc64 according to https://fedora.juszkiewicz.com.pl/syscalls.html.
2018-02-27 13:33:00 +01:00
Evgeny Vereshchagin b8eded40be
Merge pull request #8282 from poettering/khash-enokey
deal with borked ENOKEY on centos kernel's AF_ALG support
2018-02-27 12:34:41 +03:00
Robert Antoni Buj Gelonch 294924c336 po: update Catalan translation (#8267) 2018-02-27 09:20:40 +01:00
Yu Watanabe e568a92d99 man: suggests TemporaryFileSystem= when people want to nest bind mounts inside InaccessiblePaths= (#8288)
Suggested by @sourcejedi in #8242.
Closes #7895, #7153, and #2780.
2018-02-27 08:59:03 +01:00
Zbigniew Jędrzejewski-Szmek ed762da2e3
Merge pull request #8285 from poettering/logind-close-fixes
various smaller logind fixes
2018-02-27 08:55:40 +01:00
Lennart Poettering f1a2c7584d fstab-generator: downgrade message when we can't canonicalize fstab entries (#8281)
Let's make this LOG_DEBUG, as this didn't used to be an issue, and
shouldn't really be still.

Replaces: #8132
2018-02-27 07:58:19 +01:00
Lennart Poettering 84df74c6f0
Merge pull request #8284 from keszybz/gcc-warning-fixes
Gcc warning fixes
2018-02-26 21:20:13 +01:00
Zbigniew Jędrzejewski-Szmek aa484f3561 tree-wide: use reallocarray instead of our home-grown realloc_multiply (#8279)
There isn't much difference, but in general we prefer to use the standard
functions. glibc provides reallocarray since version 2.26.

I moved explicit_bzero is configure test to the bottom, so that the two stdlib
functions are at the bottom.
2018-02-26 21:20:00 +01:00
Lennart Poettering 4cbbc2a2a4 sd-login: make use of _cleanup_close_ where possible 2018-02-26 18:45:45 +01:00
Lennart Poettering 3ccf323dfd journal-upload: make use of safe_close() where appropriate 2018-02-26 18:45:28 +01:00
Lennart Poettering 4d219f5343 logind: make sure we don't trip up on half-initialized session devices
Fixes: #8035
2018-02-26 18:39:32 +01:00
Lennart Poettering 51ead3e377 logind: check file is device node before using .st_rdev 2018-02-26 18:39:32 +01:00
Lennart Poettering 0410444446 logind: let's pack a few struct fields we can pack 2018-02-26 18:39:32 +01:00
Lennart Poettering 4c9cb12c05 logind: fd 0 is a valid fd 2018-02-26 18:39:32 +01:00
Lennart Poettering d7ba71f4b4 logind: let's reduce one level of indentation 2018-02-26 18:33:20 +01:00
Lennart Poettering e38aa66426 logind: propagate the right error, don't make up ENOMEM 2018-02-26 18:33:05 +01:00
Lennart Poettering 5d5330a8e4 logind: rework sd_eviocrevoke()
Let's initialize static variables properly and get rid of redundant
variables.
2018-02-26 18:32:07 +01:00
Lennart Poettering 864fe630a7 logind: trivial improvements
Just some addition whitespace, some additional assert()s, and removal of
redundant variables.
2018-02-26 18:31:06 +01:00
Lennart Poettering 09b9348e82 khash: try to detect broken AF_ALG support in centos kernels
Fixes: #8278
2018-02-26 15:52:16 +01:00
Zbigniew Jędrzejewski-Szmek bea28c5adb core/unit: voidify one snprintf statement
One more follow-up for f810b631cd.
2018-02-26 15:49:27 +01:00
Zbigniew Jędrzejewski-Szmek 8012712791 core/path: add one more assert 2018-02-26 15:49:27 +01:00
Zbigniew Jędrzejewski-Szmek e4de62591b basic/xattr-util: do not cast ssize_t to int
gcc warns about unitialized memory access because it notices that ssize_t which
is < 0 could be cast to positive int value. We know that this can't really
happen because only -1 can be returned, but OTOH, in principle a large
*positive* value cannot be cast properly. This is unlikely too, since xattrs
cannot be too large, but it seems cleaner to just use a size_t to return the
value and avoid the cast altoghter. This makes the code simpler and gcc is
happy too.

The following warning goes away:
[113/1502] Compiling C object 'src/basic/basic@sta/xattr-util.c.o'.
In file included from ../src/basic/alloc-util.h:28:0,
                 from ../src/basic/xattr-util.c:30:
../src/basic/xattr-util.c: In function ‘fd_getcrtime_at’:
../src/basic/macro.h:207:60: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                 UNIQ_T(A,aq) < UNIQ_T(B,bq) ? UNIQ_T(A,aq) : UNIQ_T(B,bq); \
                                                            ^
../src/basic/xattr-util.c:155:19: note: ‘b’ was declared here
         usec_t a, b;
                   ^
2018-02-26 15:49:18 +01:00
Zbigniew Jędrzejewski-Szmek 3554ef5177 basic/exec-util: use _exit() to return from child 2018-02-26 15:47:12 +01:00
Zbigniew Jędrzejewski-Szmek 00d4b1e684 basic: shorten the code a bit in two places
gcc complains that len might be used unitialized, but afaict, this is not true.
2018-02-26 15:47:12 +01:00
Zbigniew Jędrzejewski-Szmek f2e3f36950
Merge pull request #8270 from dmedri/master
po: updates and basic notes for translators
2018-02-26 15:42:27 +01:00
Zbigniew Jędrzejewski-Szmek 332b090837
Merge pull request #8273 from yuwata/fix-test-execute
test: cleanups for test-execute
2018-02-26 12:31:08 +01:00
Yu Watanabe 4c40f267c7 test: use "$$" to pass a literal dollar sign
Follow-up for 9323298657.
2018-02-26 12:50:07 +09:00
Yu Watanabe ac1f08b92b test: use setup_fake_runtime_dir() in test-execute 2018-02-26 12:50:03 +09:00
Daniele Medri 69a653b64d Some notes for translators 2018-02-23 20:33:48 +01:00
Zbigniew Jędrzejewski-Szmek 3153ded003 systemd-sysv-install: avoid using ROOT variable from the environment
Fixes #8180.
2018-02-23 20:05:35 +01:00
Zbigniew Jędrzejewski-Szmek ef2a48aa01 basic/virt: provide a nicer message is /proc/cpuinfo is not available
$ sudo systemd-run -p RootDirectory=/usr -E LD_LIBRARY_PATH=/lib/systemd/ -E SYSTEMD_LOG_LEVEL=debug /bin/systemd-detect-virt

Before
systemd-detect-virt[18498]: No virtualization found in DMI
systemd-detect-virt[18498]: No virtualization found in CPUID
systemd-detect-virt[18498]: Virtualization XEN not found, /proc/xen does not exist
systemd-detect-virt[18498]: This platform does not support /proc/device-tree
systemd-detect-virt[18498]: Failed to check for virtualization: No such file or directory

The first four lines are at debug level, so the user would only see that last
one usually, which is not very enlightening.

This now becomes:
systemd-detect-virt[21172]: No virtualization found in DMI
systemd-detect-virt[21172]: No virtualization found in CPUID
systemd-detect-virt[21172]: Virtualization XEN not found, /proc/xen does not exist
systemd-detect-virt[21172]: This platform does not support /proc/device-tree
systemd-detect-virt[21172]: /proc/cpuinfo not found, assuming no UML virtualization.
systemd-detect-virt[21172]: This platform does not support /proc/sysinfo
systemd-detect-virt[21172]: Found VM virtualization none
systemd-detect-virt[21172]: none

We do more checks, which is good too.
2018-02-23 20:04:29 +01:00
Giacomo Longo a2896612a3 hwdb: Fix Chuwi Hi12 orientation sensor (#8266)
hwdb: Fix Chuwi Hi12 orientation sensor
2018-02-23 19:57:13 +01:00
Lennart Poettering 15eac526e0
Merge pull request #8258 from keszybz/log-issues
Fix some logging issues
2018-02-23 19:54:32 +01:00
Zbigniew Jędrzejewski-Szmek 780747da75 basic/log: add an assert that does not recurse into logging functions
Then it can be used in the asserts in logging functions without causing
infinite recursion. The error is just printed to stderr, it should be
good enough for the common case.
2018-02-23 13:29:03 +01:00
Lennart Poettering 6084c4efa8
Merge pull request #8252 from keszybz/set-property-man
set-property man-page adjust-ments
2018-02-23 12:20:38 +01:00
Zbigniew Jędrzejewski-Szmek 73fc96c8ac udev/net-id: check all snprintf return values
gcc-8 throws an error if it knows snprintf might truncate output and the
return value is ignored:
../src/udev/udev-builtin-net_id.c: In function 'dev_pci_slot':
../src/udev/udev-builtin-net_id.c:297:47: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-truncation=]
                 snprintf(str, sizeof str, "%s/%s/address", slots, dent->d_name);
                                               ^~
../src/udev/udev-builtin-net_id.c:297:17: note: 'snprintf' output between 10 and 4360 bytes into a destination of size 4096
                 snprintf(str, sizeof str, "%s/%s/address", slots, dent->d_name);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Let's check all return values. This actually makes the code better, because there's
no point in trying to open a file when the name has been truncated, etc.
2018-02-23 11:15:42 +01:00
Zbigniew Jędrzejewski-Szmek cc5bbdb274 udev/net-id: use _cleanup_
This fixes a minor memleak of 'address' if the file could not be read.
2018-02-23 11:15:16 +01:00
Zbigniew Jędrzejewski-Szmek 5b464a18e7 systemctl: do not hint logs when a unit cannot be reloaded
The logs don't contain any additional information.
2018-02-23 11:13:42 +01:00
Zbigniew Jędrzejewski-Szmek f8e6f4aaed basic/log: make sure header is printed correctly, add test
If log_do_header() was called with overly long parameters, it'd generate
improper output. Essentially, it'd be truncated at random point, in particular
missing a newline at the end, so it'd run with the next field, usually MESSAGE=.

log_do_header is called with parameters from compiled code (file name, lien
nubmer, etc), so in practice this was unlikely to ever be a problem, but it is
possible. In particular, if systemd was compiled from sources in some deeply
nested directory (which happens for example in mock and other build roots), the
filename could be very long.

As a safety measure, let's truncate all parameters to 256 bytes. So we have
5 fields which are 256 bytes (plus the field name prefix), and a few other
fields with fixed width. This must always fit in the 2048 byte buffer.
I don't think there's much gain in calculating the required length precisely,
since it's a lot of fields and a few bytes allocated on the stack don't matter.
2018-02-23 11:13:42 +01:00
Zbigniew Jędrzejewski-Szmek 4dd09c6a1f basic/log: fix confusion with parameters to log_dispatch_internal
log_dispatch_internal has only one caller where the extra_field/extra
params are not null: log_unit_full. When log_unit_full() was called,
when we got to log_dispatch_internal, our header would look like this:
PRIORITY=7
SYSLOG_FACILITY=3
CODE_FILE=../src/core/manager.c
CODE_LINE=2145
CODE_FUNC=manager_invoke_sigchld_event
USER_UNIT=gnome-terminal-server.service
65dffa7a3b984a6d9a46f0b8fb57710bUSER_INVOCATION_ID=
SYSLOG_IDENTIFIER=systemd

It took me a while to understand why I'm not seeing mangled messages in the
journal (after all, "" is a valid rvalue for log messages). The answer is that
journald rejects any field name which starts with a digit, and the MESSAGE_ID
that was used here starts with a digit. Hence, those lines would be silently
filtered out.
2018-02-23 11:13:24 +01:00
Daniele Medri 398141b930 po: update Italian translation 2018-02-23 10:49:07 +01:00
Peter Hutterer 774ff9ba69 udev: don't assign INPUT_ID_MOUSE to a touchpad/joystick/touchscreen (#8259)
If a touchpad has MT axes only but not ABS_X/ABS_Y (DualShock 4 controller),
then we hit both the conditions is_touchpad and the later check for
!has_abs_axes here, assigning is_mouse and ID_INPUT_MOUSE later.

This is a bug, we historically only assigned either of of the pointing device
tags ID_INPUT_MOUSE/TOUCHPAD/JOYSTICK/TOUCHSCREEN, never multiple of them.

Note that we cannot just check for has_abs_axes and has_mt_coordinates because
the apple touch mouse has both. We really need to check if the device has
already been assigned something else.

https://bugs.freedesktop.org/show_bug.cgi?id=105050
2018-02-23 09:36:45 +01:00
antizealot1337 6719ca7211 Add missing double quote from log message (#8257) 2018-02-23 00:18:29 +01:00
Zbigniew Jędrzejewski-Szmek 2af42b9a78 journal: drop left-over header line
Fixup for 53978b98f9.
2018-02-23 00:13:52 +01:00
Zbigniew Jędrzejewski-Szmek a3bf71378e basic/log: make log_object_internalv static
It makes the code easier to read, because it's obvious that the function
cannot be called from elsewhere.
2018-02-23 00:13:52 +01:00
Zbigniew Jędrzejewski-Szmek 4ad2b562ce basic/log: voidify snprintf statements
The buffers are fixed size, so the message may not fit, but we don't
particularly care.
2018-02-23 00:13:52 +01:00
Zbigniew Jędrzejewski-Szmek f810b631cd Revert "Replace use of snprintf with xsprintf"
This reverts commit a7419dbc59.

_All_ changes in that commit were wrong.

Fixes #8211.
2018-02-23 00:13:52 +01:00
Alan Jenkins e8a3144ec4 login: fix user@.service case, so we don't allow nested sessions (#8051)
> logind sessions are mostly bound to the audit session concept, and audit
> sessions remain unaffected by "su", in fact they are defined to be
> "sealed off", i.e. in a way that if a process entered a session once, it
> will always stay with it, and so will its children, i.e. the only way to
> get a new session is by forking off something off PID 1 (or something
> similar) that never has been part of a session.

The code had a gap.  user@.service is a special case PAM session which does
not create a logind session.  Let's remember to check for it.

Fixes #8021
2018-02-22 21:38:44 +01:00
Patrick Uiterwijk 5547c12503 Fix format-truncation compile failure by typecasting USB IDs (#8250)
This patch adds safe_atoux16 for parsing an unsigned hexadecimal 16bit int, and
uses that for parsing USB device and vendor IDs.

This fixes a compile error with gcc-8 because while we know that USB IDs are 2 bytes,
the compiler does not know that.

../src/udev/udev-builtin-hwdb.c:80:38: error: '%04X' directive output may be
truncated writing between 4 and 8 bytes into a region of size between 2 and 6
[-Werror=format-truncation=]

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2018-02-22 19:41:30 +01:00