]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agoadd test for ExecStopPost
David Tardon [Thu, 3 Oct 2019 17:05:06 +0000 (19:05 +0200)] 
add test for ExecStopPost

This is a follow-up to #4843.

4 years agosystemd-fsck: fix systemd-fsck/fsck pipe bad closure
Benjamin Bouvier [Tue, 1 Oct 2019 09:12:10 +0000 (12:12 +0300)] 
systemd-fsck: fix systemd-fsck/fsck pipe bad closure

Currently, when console is disabled but progress is tracked, pipe opened
for communication between systemd-fsck and fsck may be closed
inadvertently (when opening of /dev/console return in error). That lead
to finish fsck prematurely (because it receives a SIGPIPE) and so fsck
may not check correctly filesystems and do not have time to fix memory
corruptions.

This commit changes the opening of /dev/console to be done previously to
pipe creation and so fix the bug described just above.

4 years agocoredump: Include module offsets in stack traces
Aaron Plattner [Thu, 17 Oct 2019 19:56:15 +0000 (12:56 -0700)] 
coredump: Include module offsets in stack traces

These offsets can be useful to decode stack traces through modules that don't
have symbol names. For example, with a simple test that crashes after calling
through several static functions, systemd-coredump reports this:

 Oct 17 : Process 640333 (a.out) of user 1000 dumped core.

          Stack trace of thread 640333:
          #0  0x00005562c2b9f11d n/a (/tmp/a.out)
          #1  0x00005562c2b9f12d n/a (/tmp/a.out)
          #2  0x00005562c2b9f139 n/a (/tmp/a.out)
          #3  0x00005562c2b9f145 n/a (/tmp/a.out)
          #4  0x00007fc768b39153 __libc_start_main (libc.so.6)
          #5  0x00005562c2b9f04e n/a (/tmp/a.out)

With this change:

          Stack trace of thread 666897:
          #0  0x0000555668fbe11d n/a (/tmp/a.out + 0x111d)
          #1  0x0000555668fbe12d n/a (/tmp/a.out + 0x112d)
          #2  0x0000555668fbe139 n/a (/tmp/a.out + 0x1139)
          #3  0x0000555668fbe145 n/a (/tmp/a.out + 0x1145)
          #4  0x00007f7b5c828153 __libc_start_main (libc.so.6 + 0x27153)
          #5  0x0000555668fbe04e n/a (/tmp/a.out + 0x104e)

Disassembling the test binary shows that these offsets line up:

 0000000000001119 <crash>:
     1119:      55                      push   %rbp
     111a:      48 89 e5                mov    %rsp,%rbp
     111d:      0f 0b                   ud2                 <---- #0

 000000000000111f <b>:
     111f:      55                      push   %rbp
     1120:      48 89 e5                mov    %rsp,%rbp
     1123:      b8 00 00 00 00          mov    $0x0,%eax
     1128:      e8 ec ff ff ff          callq  1119 <crash>
     112d:      90                      nop                 <---- #1
     112e:      5d                      pop    %rbp
     112f:      c3                      retq

 0000000000001130 <a>:
     1130:      55                      push   %rbp
     1131:      48 89 e5                mov    %rsp,%rbp
     1134:      e8 e6 ff ff ff          callq  111f <b>
     1139:      90                      nop                 <---- #2
     113a:      5d                      pop    %rbp
     113b:      c3                      retq

 000000000000113c <main>:
     113c:      55                      push   %rbp
     113d:      48 89 e5                mov    %rsp,%rbp
     1140:      e8 eb ff ff ff          callq  1130 <a>
     1145:      b8 00 00 00 00          mov    $0x0,%eax    <---- #3
     114a:      5d                      pop    %rbp
     114b:      c3                      retq
     114c:      0f 1f 40 00             nopl   0x0(%rax)

 (from libc.so.6)
 0000000000027060 <__libc_start_main>:
   27060: f3 0f 1e fa           endbr64
   27064: 41 56                 push   %r14
   27066: 31 c0                 xor    %eax,%eax
   [...]
   2714c: 48 8b 44 24 18        mov    0x18(%rsp),%rax
   27151: ff d0                 callq  *%rax
   27153: 89 c7                 mov    %eax,%edi    <---- #4
   27155: e8 e6 76 01 00        callq  3e840 <exit>

4 years agotest: blacklist TEST-41 on Ubuntu CI
Dan Streetman [Thu, 17 Oct 2019 18:06:43 +0000 (14:06 -0400)] 
test: blacklist TEST-41 on Ubuntu CI

This test has been failing on Ubuntu CI since introduced, let's
blacklist it until we can debug what's causing it to fail.

4 years agoceph is a network filesystem
Jonas Jelten [Thu, 17 Oct 2019 10:10:13 +0000 (12:10 +0200)] 
ceph is a network filesystem

4 years agorule-syntax-check: add CONST
Jan Synacek [Thu, 17 Oct 2019 08:52:38 +0000 (10:52 +0200)] 
rule-syntax-check: add CONST

4 years agoMerge pull request #13743 from anitazha/dropin_all_the_things
Chris Down [Thu, 17 Oct 2019 03:10:05 +0000 (23:10 -0400)] 
Merge pull request #13743 from anitazha/dropin_all_the_things

core: support top level drop-ins through -.service.d for service units

4 years agoMerge pull request #13784 from keszybz/constify-unit-pointers
Yu Watanabe [Thu, 17 Oct 2019 00:41:36 +0000 (09:41 +0900)] 
Merge pull request #13784 from keszybz/constify-unit-pointers

Constify unit pointers

4 years agoMerge pull request #13754 from claudiozz/master
Anita Zhang [Wed, 16 Oct 2019 21:21:59 +0000 (14:21 -0700)] 
Merge pull request #13754 from claudiozz/master

Allow restart for oneshot units

4 years agoMerge pull request #13786 from keszybz/systemctl-start-glob-warning
Anita Zhang [Wed, 16 Oct 2019 20:50:10 +0000 (13:50 -0700)] 
Merge pull request #13786 from keszybz/systemctl-start-glob-warning

systemctl: emit warning if start is used with globs

4 years agoAllow restart for oneshot units 13754/head
Claudio Zumbo [Tue, 8 Oct 2019 22:04:29 +0000 (15:04 -0700)] 
Allow restart for oneshot units

Picked up from https://github.com/systemd/systemd/pull/7474 , so
coauthored by @robermorales.

4 years agosystemctl: emit warning if start is used with globs 13786/head
Zbigniew Jędrzejewski-Szmek [Wed, 16 Oct 2019 15:33:32 +0000 (17:33 +0200)] 
systemctl: emit warning if start is used with globs

Fixes #6379.

4 years agocore/load-fragment: remove unnecessary intialization 13784/head
Zbigniew Jędrzejewski-Szmek [Wed, 16 Oct 2019 14:33:54 +0000 (16:33 +0200)] 
core/load-fragment: remove unnecessary intialization

manager_load_unit() better set it on success, and unit_set_slice() asserts
that the argument is not NULL, so initializing it to NULL is not useful.

4 years agocore/load-fragment: constify Unit* arguments where possible
Zbigniew Jędrzejewski-Szmek [Wed, 16 Oct 2019 14:32:45 +0000 (16:32 +0200)] 
core/load-fragment: constify Unit* arguments where possible

This makes it easy to tell that the function only uses the Unit* for
reporting, and only makes changes to the other argument (which most likely
also points at the same Unit structure) for modifications.

4 years agocore: mark unit_*_printf() functions as taking a const Unit*
Zbigniew Jędrzejewski-Szmek [Wed, 16 Oct 2019 14:21:56 +0000 (16:21 +0200)] 
core: mark unit_*_printf() functions as taking a const Unit*

They should never modify the unit argument, let's make this clear.
Also see 303ee60151.

4 years agoMerge pull request #13663 from ssahani/dhcp-send-option-data
Zbigniew Jędrzejewski-Szmek [Wed, 16 Oct 2019 09:31:22 +0000 (11:31 +0200)] 
Merge pull request #13663 from ssahani/dhcp-send-option-data

network: DHCPv4 client- add support to send arbitary option and data

4 years agoAdd Acer Switch SW312-31 to sensor hwdb
RoadrunnerWMC [Tue, 15 Oct 2019 21:43:36 +0000 (14:43 -0700)] 
Add Acer Switch SW312-31 to sensor hwdb

See issue #13732

4 years agologind: make session_prepare_vt() static
Franck Bui [Tue, 15 Oct 2019 14:43:17 +0000 (16:43 +0200)] 
logind: make session_prepare_vt() static

4 years agoMerge pull request #13726 from bluca/portable_detach_symlink
Anita Zhang [Wed, 16 Oct 2019 00:16:51 +0000 (17:16 -0700)] 
Merge pull request #13726 from bluca/portable_detach_symlink

portabled: allow to detach an image with a unit in linked-runtime state

4 years agoshared/dropin: support -.service.d/ top level drop-in for service units 13743/head
Anita Zhang [Sat, 5 Oct 2019 00:39:34 +0000 (17:39 -0700)] 
shared/dropin: support -.service.d/ top level drop-in for service units

Closes #12830

4 years agotest-network: disable IPv6AcceptRA= to speed up tests 13663/head
Yu Watanabe [Mon, 14 Oct 2019 13:51:51 +0000 (22:51 +0900)] 
test-network: disable IPv6AcceptRA= to speed up tests

4 years agonetwork: DHCPv4 client: add support to send arbitary option and data
Susant Sahani [Thu, 26 Sep 2019 18:06:02 +0000 (20:06 +0200)] 
network: DHCPv4 client: add support to send arbitary option and data

4 years agoMerge pull request #13760 from keszybz/unit-loading-unification
Yu Watanabe [Mon, 14 Oct 2019 14:35:54 +0000 (23:35 +0900)] 
Merge pull request #13760 from keszybz/unit-loading-unification

Unit loading unification

4 years agoMerge pull request #13735 from ssahani/ip-nexthop
Yu Watanabe [Mon, 14 Oct 2019 14:25:23 +0000 (23:25 +0900)] 
Merge pull request #13735 from ssahani/ip-nexthop

network: introduce ip nexthop routing

4 years agoudev: introduce CONST key name
Jan Synacek [Mon, 7 Oct 2019 08:03:07 +0000 (10:03 +0200)] 
udev: introduce CONST key name

Currently, there is no way to match against system-wide constants, such
as architecture or virtualization type, without forking helper binaries.
That potentially results in a huge number of spawned processes which
output always the same answer.

This patch introduces a special CONST keyword which takes a hard-coded
string as its key and returns a value assigned to that key. Currently
implemented are CONST{arch} and CONST{virt}, which can be used to match
against the system's architecture and virtualization type.

4 years agotest-network: add a test case for nexthop 13735/head
Yu Watanabe [Mon, 14 Oct 2019 12:18:01 +0000 (21:18 +0900)] 
test-network: add a test case for nexthop

4 years agonetwork: update comment as DHCP is deprecated now
Yu Watanabe [Mon, 14 Oct 2019 12:19:04 +0000 (21:19 +0900)] 
network: update comment as DHCP is deprecated now

4 years agonetwork: introduce ip nexthop routing
Susant Sahani [Fri, 4 Oct 2019 19:40:51 +0000 (21:40 +0200)] 
network: introduce ip nexthop routing

Used to manipulate entries in the kernel's nexthop tables.
Example:
```
[NextHop]
Id=3
Gateway=192.168.5.1
```

4 years agonetwork: ndisc: do not drop all prefixes when a prefix matches a blacklist
Yu Watanabe [Sun, 13 Oct 2019 17:00:47 +0000 (02:00 +0900)] 
network: ndisc: do not drop all prefixes when a prefix matches a blacklist

Fixes #13767.

4 years agoMerge pull request #13761 from dtardon/program-name
Yu Watanabe [Mon, 14 Oct 2019 11:17:28 +0000 (20:17 +0900)] 
Merge pull request #13761 from dtardon/program-name

udev: do not hardcode program name

4 years agoMerge pull request #13765 from yuwata/udev-memleak-13764
Yu Watanabe [Mon, 14 Oct 2019 11:16:58 +0000 (20:16 +0900)] 
Merge pull request #13765 from yuwata/udev-memleak-13764

udev,systemctl: fix memleak caused by wrong cleanup function

4 years agosystemctl: fix memleak caused by wrong cleanup func 13765/head
Yu Watanabe [Sat, 12 Oct 2019 15:54:34 +0000 (00:54 +0900)] 
systemctl: fix memleak caused by wrong cleanup func

4 years agoudev: fix memleak caused by wrong cleanup function
Yu Watanabe [Sat, 12 Oct 2019 15:35:49 +0000 (00:35 +0900)] 
udev: fix memleak caused by wrong cleanup function

Fixes #13764.

4 years agoudev: do not hardcode program name 13761/head
David Tardon [Fri, 11 Oct 2019 12:41:58 +0000 (14:41 +0200)] 
udev: do not hardcode program name

4 years agoudev/fido_id: fix program name in usage output
David Tardon [Fri, 11 Oct 2019 12:39:56 +0000 (14:39 +0200)] 
udev/fido_id: fix program name in usage output

4 years agocore: pass around pointer, not struct 13760/head
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2019 09:43:32 +0000 (11:43 +0200)] 
core: pass around pointer, not struct

Since this is a static function, the compiler is likely to optimize it away
anyway, but let's do the normal thing here.

4 years agoshared/bus-unit-util: remove some empty lines
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2019 10:53:31 +0000 (12:53 +0200)] 
shared/bus-unit-util: remove some empty lines

We generally don't add empty lines after if. It looks especially strange
when the block has is just a single line without braces.

4 years agocore: adjust load functions for other unit types to be more like service
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2019 10:48:33 +0000 (12:48 +0200)] 
core: adjust load functions for other unit types to be more like service

No functional change, just adjusting code to follow the same pattern
everywhere. In particular, never call _verify() on an already loaded unit,
but return early from the caller instead. This makes the code a bit easier
to follow.

4 years agocore: simplify unit_load() a bit
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2019 09:10:50 +0000 (11:10 +0200)] 
core: simplify unit_load() a bit

Now all unit types define .load. But even if it wasn't defined, we'd need
to call unit_load_fragment_and_dropin() anyway, so this code would not have
worked correctly.

Also, unit_load_fragment_and_dropin() either returns -ENOENT or changes
UNIT_STUB to UNIT_LOADED, so we don't need to repeat this here.

4 years agocore/service: use common implementation of unit_load_fragment_and_dropin()
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2019 08:53:54 +0000 (10:53 +0200)] 
core/service: use common implementation of unit_load_fragment_and_dropin()

There is a slight functional change when load_state == UNIT_MERGED. Before,
we would not call unit_load_dropin(), but now we do. I'm not sure if this
causes an actual difference in behaviour, but since all other unit types do
this, I think it's better to do the same thing here too.

4 years agocore: turn unit_load_fragment_and_dropin_optional() into a flag
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2019 08:41:44 +0000 (10:41 +0200)] 
core: turn unit_load_fragment_and_dropin_optional() into a flag

unit_load_fragment_and_dropin() and unit_load_fragment_and_dropin_optional()
are really the same, with one minor difference in behaviour. Let's drop
the second function.

"_optional" in the name suggests that it's the "dropin" part that is optional.
(Which it is, but in this case, we mean the fragment to be optional.)
I think the new version with a flag is easier to understand.

4 years agoMerge pull request #13749 from keszybz/pyparsing-2.4
Yu Watanabe [Thu, 10 Oct 2019 23:43:10 +0000 (08:43 +0900)] 
Merge pull request #13749 from keszybz/pyparsing-2.4

Compatibility with pyparsing 2.4

4 years agoparse_hwdb: fix compatibility with pyparsing 2.4.* 13749/head
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 12:44:35 +0000 (14:44 +0200)] 
parse_hwdb: fix compatibility with pyparsing 2.4.*

pyparsing 2.3.1/2.4.0 had some changes to grouping of And matches, and as a
result we'd report 0 properties and 0 matches, and not really do any checks.

With this change we get identical behaviour for pyparsing 2.3.1, 2.4.0, 2.4.2:

$ hwdb/parse_hwdb.py
hwdb/60-evdev.hwdb: 72 match groups, 94 matches, 262 properties
hwdb/60-input-id.hwdb: 3 match groups, 3 matches, 4 properties
hwdb/60-keyboard.hwdb: 173 match groups, 256 matches, 872 properties
Keycode KBD_LCD_MENU1 unknown
Keycode KBD_LCD_MENU4 unknown
Keycode KBD_LCD_MENU2 unknown
Keycode KBD_LCD_MENU3 unknown
hwdb/60-sensor.hwdb: 101 match groups, 120 matches, 105 properties
hwdb/70-joystick.hwdb: 2 match groups, 3 matches, 2 properties
hwdb/70-mouse.hwdb: 104 match groups, 119 matches, 123 properties
hwdb/70-pointingstick.hwdb: 8 match groups, 30 matches, 11 properties
hwdb/70-touchpad.hwdb: 6 match groups, 9 matches, 6 properties

4 years agoparse_hwdb: process files in order
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 12:22:17 +0000 (14:22 +0200)] 
parse_hwdb: process files in order

Also, make the pattern more general. There are some plans to add more files
there, let's make sure we don't miss them.

4 years agoparse_hwdb: bail with an error if no matches or groups are detected
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 12:21:26 +0000 (14:21 +0200)] 
parse_hwdb: bail with an error if no matches or groups are detected

pyparsing sometimes changes behaviour and stops giving matches. This should
allow us to detect such scenario. With this change, parse_hwdb fails with
pyparsing 2.4 on F31.

4 years agoRename udev's hwdb/ to hwdb.d/
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 14:52:10 +0000 (16:52 +0200)] 
Rename udev's hwdb/ to hwdb.d/

As in the parent commit, this makes the name consistent with the
rest of the source tree and the actuall installation path.

4 years agoRename udev's rules/ to rules.d/
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 14:43:18 +0000 (16:43 +0200)] 
Rename udev's rules/ to rules.d/

This change is only about the source tree. We have tmpfiles.d/, modprobe.d/,
sysctl.d/, and sysusers.d/, but for historical reasons, rules/ didn't fit this
pattern. We also *install* it as rules.d/. Let's rename to be consistent.

4 years agotest: Pass personality test even when i686 userland runs on x86_64 kernel
Balint Reczey [Tue, 8 Oct 2019 14:41:24 +0000 (16:41 +0200)] 
test: Pass personality test even when i686 userland runs on x86_64 kernel

4 years agoMerge pull request #13568 from ddstreet/ubuntu-ci-blacklists
Zbigniew Jędrzejewski-Szmek [Wed, 9 Oct 2019 10:04:42 +0000 (12:04 +0200)] 
Merge pull request #13568 from ddstreet/ubuntu-ci-blacklists

test: add temporarily blacklisted tests

4 years agoMerge pull request #13727 from keszybz/pstore-greedy-realloc
Yu Watanabe [Wed, 9 Oct 2019 06:01:45 +0000 (15:01 +0900)] 
Merge pull request #13727 from keszybz/pstore-greedy-realloc

Use greedy realloc in pstore

4 years agoMerge pull request #13753 from keszybz/change-man-ordering
Yu Watanabe [Wed, 9 Oct 2019 05:51:06 +0000 (14:51 +0900)] 
Merge pull request #13753 from keszybz/change-man-ordering

Change section ordering to have commands above options

4 years agohwdb: Update Primebook C11B sensor entry to also work with older BIOS versions
Hans de Goede [Mon, 23 Sep 2019 09:00:50 +0000 (11:00 +0200)] 
hwdb: Update Primebook C11B sensor entry to also work with older BIOS versions

Older Primebook C11B BIOS versions use "Primebook C11B" as product name
instead of "PRIMEBOOK C11B", update the Primebook C11B 60-sensor.hwdb entries
to match on both spellings.

4 years agoHighlight the synopsis and summary in --help 13753/head
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 16:19:59 +0000 (18:19 +0200)] 
Highlight the synopsis and summary in --help

This doesn't cover all the binaries, but I don't know how to script
this, and I run out of steam ;)

4 years agonetworkctl: add missing dots in --help
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 16:00:45 +0000 (18:00 +0200)] 
networkctl: add missing dots in --help

4 years agoMove the Commands section above Options section
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 15:58:44 +0000 (17:58 +0200)] 
Move the Commands section above Options section

For executables which take a verb, we should list the verbs first, and
then options which modify those verbs second. The general layout of
the man page is from general description to specific details, usually
Overview, Commands, Options, Return Value, Examples, References.

4 years agoMerge pull request #13746 from keszybz/tests-reduce-boilerplate
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 13:39:28 +0000 (15:39 +0200)] 
Merge pull request #13746 from keszybz/tests-reduce-boilerplate

Reduce test boilerplate

4 years agotest/TEST-31-DEVICE-ENUMERATION: do not use -x to avoid grep loop 13746/head
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 09:11:49 +0000 (11:11 +0200)] 
test/TEST-31-DEVICE-ENUMERATION: do not use -x to avoid grep loop

https://github.com/systemd/systemd/pull/13746#issuecomment-539410752:
> [grep] now matches the grep command itself, as it's logged into journal as well, thanks to set -x.

Also, use journalctl --grep and -t to make things a bit quicker.

4 years agoMerge pull request #13632 from fbuihuu/ask-password-some-reworks
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 07:20:40 +0000 (09:20 +0200)] 
Merge pull request #13632 from fbuihuu/ask-password-some-reworks

Ask password some reworks

4 years agotest: add function to reduce copied setup boilerplate
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 07:10:12 +0000 (09:10 +0200)] 
test: add function to reduce copied setup boilerplate

Many tests were also masking systemd-machined.service. But machined
should only start when activated, so having it not masked shouldn't be
noticable. TEST-25-IMPORT needs it.

4 years agotest: drop redirection to tty in integration tests
Zbigniew Jędrzejewski-Szmek [Tue, 8 Oct 2019 06:45:12 +0000 (08:45 +0200)] 
test: drop redirection to tty in integration tests

I *think* this was originally added to make it easier to see what was happening
in tests. Later we added the functionality to print the journal on failure, so
this redirection has stopped being useful.

In https://github.com/systemd/systemd/pull/13719#issuecomment-539292650
@filbranden shows that grep tries to write to stdout and fails. In general,
we should not assume that writing to the console it always possible. We have
special code to handle this in pid1 after all:

99    19:22:10.731965 fstat(1,  <unfinished ...>
99    19:22:10.731993 <... fstat resumed>{st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0
99    19:22:10.732070 write(1, "ExecStartPost={ path=/bin/echo ; argv[]=/bin/echo ${4_four_ex} ; ignore_errors=no ; start_time=[Mon 2019-10-07 19:22:10 PDT] ; stop_time=[Mon 209-10-07 19:22:10 PDT] ; pid=97 ; code=exited ; status=0 }\n", 203) = -1 EIO (Input/output error)
99    19:22:10.732174 write(2, "grep: ", 6) = -1 EIO (Input/output error)
99    19:22:10.732226 write(2, "write error", 11) = -1 EIO (Input/output error)
99    19:22:10.732263 write(2, ": Input/output error", 20) = -1 EIO (Input/output error)
99    19:22:10.732298 write(2, "\n", 1 <unfinished ...>
99    19:22:10.732325 <... write resumed>) = -1 EIO (Input/output error)
99    19:22:10.732349 exit_group(2)     = ?
99    19:22:10.732424 +++ exited with 2 +++

Removing the redirection should make the tests less flakey.

Replaces #13719.

While at it, also drop NotifyAccess=all. I think it was added purposefully in
TEST-20-MAINPIDGAMES, and then cargo culted to newer tests.

4 years agobasic/set: const-ify set_first()
Anita Zhang [Sat, 5 Oct 2019 01:14:19 +0000 (18:14 -0700)] 
basic/set: const-ify set_first()

set_steal_first() is the version that modifies Set so this one should be
const.

4 years agocore: disallow using '-.service' as a service name
Anita Zhang [Fri, 4 Oct 2019 23:03:04 +0000 (16:03 -0700)] 
core: disallow using '-.service' as a service name

-.service.d will become a special top level drop in so don't let it be a
usable service name (otherwise the interaction gets complicated).

4 years agotrivial: rename chromeos to chromiumos
Tim Teichmann [Sun, 6 Oct 2019 15:59:53 +0000 (17:59 +0200)] 
trivial: rename chromeos to chromiumos

4 years agodocs: fix inadvertent change in uid range
Zbigniew Jędrzejewski-Szmek [Sun, 6 Oct 2019 17:05:57 +0000 (19:05 +0200)] 
docs: fix inadvertent change in uid range

https://github.com/systemd/systemd/commit/a305eda35f18fbacc771cc1582b688d60890a9d2#r35378755

4 years agotrivial: update tools/chromeos/gen_autosuspend_rules.py
Mario Limonciello [Sat, 5 Oct 2019 01:57:46 +0000 (20:57 -0500)] 
trivial: update tools/chromeos/gen_autosuspend_rules.py

Adds CNP PCH xHCI device PCIID to udev rules

4 years agoAdd missing license file and information for tools/chromeos/gen_autosuspend_rules...
Tim Teichmann [Sat, 5 Oct 2019 13:52:37 +0000 (15:52 +0200)] 
Add missing license file and information for tools/chromeos/gen_autosuspend_rules.py (#13729)

The license file for the python script that was commited with b61d777abeecd8b6c76035e11899aae210633534 was missing. The license was copied from https://chromium.googlesource.com/chromiumos/platform2/+/master/LICENSE.

4 years agotty-ask-pwd-agent: move ask_password_plymouth() in ask-password-api.c 13632/head
Franck Bui [Fri, 20 Sep 2019 13:13:48 +0000 (15:13 +0200)] 
tty-ask-pwd-agent: move ask_password_plymouth() in ask-password-api.c

4 years agotty-ask-pwd-agent: small cleanup in process_one_password_file()
Franck Bui [Fri, 20 Sep 2019 13:07:31 +0000 (15:07 +0200)] 
tty-ask-pwd-agent: small cleanup in process_one_password_file()

Split the part dealing which asks for password on tty in a dedicated function
making process_one_password_file() hopefully easier to read.

No functional changes.

4 years agotty-ask-pwd-agent: add a FIXME
Franck Bui [Thu, 19 Sep 2019 17:01:57 +0000 (19:01 +0200)] 
tty-ask-pwd-agent: add a FIXME

4 years agotty-ask-pwd-agent: share the same init code for --query and --watch
Franck Bui [Thu, 19 Sep 2019 14:38:16 +0000 (16:38 +0200)] 
tty-ask-pwd-agent: share the same init code for --query and --watch

Previously we would have skipped the init code which consists in setting the
signal handling up and the wall tty block thingie.

4 years agotty-ask-pwd-agent: treat SIGINT as a request to exit immediately
Franck Bui [Thu, 19 Sep 2019 13:24:15 +0000 (15:24 +0200)] 
tty-ask-pwd-agent: treat SIGINT as a request to exit immediately

Unlike SIGTERM, SIGINT is now treated as a request to exit as soon as
possible. IOW, if SIGINT is received, the agent wont process all remaining
passwords before exiting.

This allows a more comprehensive behavior when C-c is pressed and when the
agent is spawned by systemctl.

Before that patch, pressing C-c killed systemctl but left the agent waiting
for a password since SIGINT was blocked. The result was pretty clumsy.

4 years agotty-ask-pwd-agent: give the possiblity to skip a password prompt
Franck Bui [Thu, 19 Sep 2019 13:18:18 +0000 (15:18 +0200)] 
tty-ask-pwd-agent: give the possiblity to skip a password prompt

If multiple passwords are waiting the agent will prompt for each of them. Give
the possiblity to the user to skip some of them by pressing 'C-d'.

4 years agotty-ask-pwd-agent: minor simplification by using FOREACH_DIRENT instead of FOREACH_DI...
Franck Bui [Tue, 17 Sep 2019 10:30:31 +0000 (12:30 +0200)] 
tty-ask-pwd-agent: minor simplification by using FOREACH_DIRENT instead of FOREACH_DIRENT_ALL

4 years agofs-util: introduce inotify_add_watch_and_warn() helper
Franck Bui [Tue, 17 Sep 2019 09:16:52 +0000 (11:16 +0200)] 
fs-util: introduce inotify_add_watch_and_warn() helper

The default message for ENOSPC is very misleading: it says that the disk is
filled, but in fact the inotify watch limit is the problem.

So let's introduce and use a wrapper that simply calls inotify_add_watch(2) and
which fixes the error message up in case ENOSPC is returned.

4 years agopstore: rework memory handling for dmesg 13727/head
Zbigniew Jędrzejewski-Szmek [Fri, 4 Oct 2019 14:17:27 +0000 (16:17 +0200)] 
pstore: rework memory handling for dmesg

Semmle Security Reports report:
> The problem occurs on the way realloc is being used. When a size
> bigger than the chunk that wants to be reallocated is passed, realloc
> try to malloc a  bigger size, however in the case that malloc fails
> (for example, by forcing a big allocation)  realloc will return NULL.
>
> According to the man page:
> "The realloc() function returns a pointer to the newly allocated
> memory, which is suitably aligned for any built-in type and may be
> different from ptr,  or  NULL  if  the  request fails.   If size was
> equal to 0, either NULL or a pointer suitable to be passed to free()
> is returned.  If realloc() fails, the original block is left
> untouched; it is  not  freed or moved."
>
> The problem occurs when the memory ptr passed to the first argument of
> realloc is the same as the one used for the result, for example in
> this case:
>
> dmesg = realloc(dmesg, dmesg_size + strlen(pe->dirent.d_name) +
> strlen(":\n") + pe->content_size + 1);
>
> https://lgtm.com/projects/g/systemd/systemd/snapshot/f8bcb81955f9e93a4787627e28f43fffb2a84836/files/src/pstore/pstore.c?sort=name&dir=A
> SC&mode=heatmap#L300
>
> If the malloc inside that realloc fails, then the original memory
> chunk will never be free but since realloc will return NULL, the
> pointer to that memory chunk will be lost and a memory leak will
> occur.
>
> In case you are curious, this is the query we used to find this problem:
> https://lgtm.com/query/8650323308193591473/

Let's use a more standard pattern: allocate memory using greedy_realloc, and
instead of freeing it when we wrote out a chunk, let's just move the cursor
back to the beginning and reuse the memory we allocated previously.

If we fail to allocate the memory for dmesg contents, don't write the dmesg
entry, but let's still process the files to move them out of pstore.

4 years agopstore: allow specifying src and dst dirs are arguments
Zbigniew Jędrzejewski-Szmek [Fri, 4 Oct 2019 14:14:47 +0000 (16:14 +0200)] 
pstore: allow specifying src and dst dirs are arguments

This makes it much easier to debug the program as a normal user, since we
don't need to set up fake input under /sys/fs/pstore/.

Also, let's make the debug output a bit nicer.

4 years agoportabled: allow to detach an image with a unit in linked-runtime state 13726/head
Luca Boccassi [Fri, 4 Oct 2019 13:45:41 +0000 (14:45 +0100)] 
portabled: allow to detach an image with a unit in linked-runtime state

This is necessary when a directory was attached with
--copy=symlink, otherwise detach will always fail.

Fixed #13725

4 years agoata_id: Add check for fixed format sense codes (#13654)
Ryan Attard [Fri, 4 Oct 2019 12:52:49 +0000 (07:52 -0500)] 
ata_id: Add check for fixed format sense codes (#13654)

Original revisions of the SAT (SCSI-ATA Translation) specification
required that all sense data be reported in Descriptor Format (72h).

Later revisions specifcally allow and account for sense data being
reported in Fixed Format (70h).

The current code checks for a Descriptor Format sense structure (0x72),
then looks specifically at the first byte of the first descriptor for the
ATA specific code 0x9, cross referencing it with the first byte which is
just a length field 0x0c (as a sanity check).

In the Fixed Format case(0x70), we can fall back to using the top-level
SCSI Sense data for the Additional Sense code (0x0) and then the
Additional Sense Code Qualifier (0x1d),

That identifies that the sense data is of the format associated with:
 `ATA PASS THROUGH INFORMATION AVAILABLE`.

This fallback mechanism retains support for SATLs compliant with ANSI
INCITS 431-2007, and enables support for Fixed Format Sense data
enabled by SATLs with later revisions.

Glad to do so. This patch allows ata_id to export attributes correctly. I believe that any drive can potentially return information in this format on any SATL using the libata-scsi (the Linux builtin SATL), but in this particular case, it appears it is the SATL itself. Attaching the disk to the AHCI controller changes the behavior impacted here. (Not entirely surprisingly, SATLs are are pretty inconsistent).

Test:
This case specifically is an LSI SATL. I'll illustrate that without the patch, ata_id does not return
any output for a valid SATA drive but after the patch does.

1. Verify the device is ATA, by looking at the vpd page specific to ATA drives

```
root@machine:~# sg_vpd -p ai /dev/sdn
ATA information VPD page:
  SAT Vendor identification: LSI
  SAT Product identification: LSI SATL
  SAT Product revision level: 0008
  Device signature indicates SATA transport
  ATA command IDENTIFY DEVICE response summary:
    model: HGST HUH728080ALE604
    serial number: ZZZZH3VX
    firmware revision: A4GNW7J0
```

2. Look at what udev thinks of the disk, it says ID_BUS=scsi
ATA information says ID_MODEL should be HGST_HUH728080ALE604
udev says it is HGST_HUH728080AL (Missing E604, 4 bytes), and no ATA attributes are
populated.

```
root@machine:~# udevadm info -q all /dev/sdn
P: /devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn
N: sdn
S: disk/by-id/scsi-35000cca23be1dc3c
S: disk/by-id/wwn-0x5000cca23be1dc3c
S: disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0
E: DEVLINKS=/dev/disk/by-id/wwn-0x5000cca23be1dc3c /dev/disk/by-id/scsi-35000cca23be1dc3c /dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0
E: DEVNAME=/dev/sdn
E: DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn
E: DEVTYPE=disk
E: ID_BUS=scsi
E: ID_MODEL=HGST_HUH728080AL
E: ID_MODEL_ENC=HGST\x20HUH728080AL
E: ID_PATH=pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0
E: ID_PATH_TAG=pci-0000_05_00_0-sas-exp0x500605b0000272bf-phy11-lun-0
E: ID_REVISION=W7J0
E: ID_SCSI=1
E: ID_SCSI_SERIAL=ZZZZH3VX
E: ID_SERIAL=35000cca23be1dc3c
E: ID_SERIAL_SHORT=5000cca23be1dc3c
E: ID_TYPE=disk
E: ID_VENDOR=ATA
E: ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20
E: ID_WWN=0x5000cca23be1dc3c
E: ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c
E: MAJOR=8
E: MINOR=208
E: SUBSYSTEM=block
E: TAGS=:systemd:
```

3. Run ata_id (unpatched) (Outputs nothing, RC=2)

```
root@machine:~# strace -e ioctl /lib/udev/ata_id /dev/sdn -x
ioctl(3, SG_IO, {'Q', BSG_PROTOCOL_SCSI, BSG_SUB_PROTOCOL_SCSI_CMD, request[6]=[12, 00, 00, 00, 24, 00], request_tag=0, request_attr=0, request_priority=0, request_extra=0, max_response_len=32, dout_iovec_count=0, dout_xfer_len=0, din_iovec_count=0, din_xfer_len=36, timeout=30000, flags=0, usr_ptr=0, spare_in=0, dout[0]=NULL}) = -1 EINVAL (Invalid argument)
ioctl(3, SG_IO, {'S', SG_DXFER_FROM_DEV, cmd[6]=[12, 00, 00, 00, 24, 00], mx_sb_len=32, iovec_count=0, dxfer_len=36, timeout=30000, flags=0, data[36]=[00, 00, 06, 12, 45, 00, 00, 02, 41, 54, 41, 20, 20, 20, 20, 20, 48, 47, 53, 54, 20, 48, 55, 48, 37, 32, 38, 30, 38, 30, 41, 4c, ...], status=00, masked_status=00, sb[0]=[], host_status=0, driver_status=0, resid=0, duration=1, info=0}) = 0
ioctl(3, SG_IO, {'Q', BSG_PROTOCOL_SCSI, BSG_SUB_PROTOCOL_SCSI_CMD, request[12]=[a1, 08, 2e, 00, 01, 00, 00, 00, 00, ec, 00, 00], request_tag=0, request_attr=0, request_priority=0, request_extra=0, max_response_len=32, dout_iovec_count=0, dout_xfer_len=0, din_iovec_count=0, din_xfer_len=512, timeout=30000, flags=0, usr_ptr=0, spare_in=0, dout[0]=NULL}) = -1 EINVAL (Invalid argument)
ioctl(3, SG_IO, {'S', SG_DXFER_FROM_DEV, cmd[12]=[a1, 08, 2e, 00, 01, 00, 00, 00, 00, ec, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=512, timeout=30000, flags=0, data[0]=[], status=02, masked_status=01, sb[18]=[70, 00, 01, 00, 00, 00, 00, 0a, 00, 00, 00, 00, 00, 1d, 00, 00, 00, 00], host_status=0, driver_status=0x8, resid=512, duration=0, info=0x1}) = 0
ioctl(3, HDIO_GET_IDENTITY, 0x7ffe408f7590) = -1 EINVAL (Invalid argument)
+++ exited with 2 +++
```
Sense buffers visible with the strace:
`sb[18]=[70, 00, 01, 00, 00, 00, 00, 0a, 00, 00, 00, 00, 00, 1d, 00, 00, 00, 00]` is the important bit, see 70, 0a and 1d bytes

4. Run patched version: model is HGST_HUH728080ALE604 as expected, ATA attributes are
correctly populated.
```
root@machine:~# ./ata_id /dev/sdn -x
ID_ATA=1
ID_TYPE=disk
ID_BUS=ata
ID_MODEL=HGST_HUH728080ALE604
ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_REVISION=A4GNW7J0
ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX
ID_SERIAL_SHORT=ZZZZH3VX
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_ENABLED=1
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_ROTATION_RATE_RPM=7200
ID_WWN=0x5000cca23be1dc3c
ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c
```

5. Drop it in place and verify: we see that ata_id does work.
```
root@hw1-b01left-2212a:~# udevadm test /block/sdn
<truncated>
GROUP 6 /lib/udev/rules.d/50-udev-default.rules:55
IMPORT 'ata_id --export /dev/sdn' /lib/udev/rules.d/60-persistent-storage.rules:33
starting 'ata_id --export /dev/sdn'
'ata_id --export /dev/sdn'(out) 'ID_ATA=1'
'ata_id --export /dev/sdn'(out) 'ID_TYPE=disk'
'ata_id --export /dev/sdn'(out) 'ID_BUS=ata'
'ata_id --export /dev/sdn'(out) 'ID_MODEL=HGST_HUH728080ALE604'
'ata_id --export /dev/sdn'(out) 'ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'
'ata_id --export /dev/sdn'(out) 'ID_REVISION=A4GNW7J0'
'ata_id --export /dev/sdn'(out) 'ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX'
'ata_id --export /dev/sdn'(out) 'ID_SERIAL_SHORT=ZZZZH3VX'
'ata_id --export /dev/sdn'(out) 'ID_ATA_WRITE_CACHE=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_WRITE_CACHE_ENABLED=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_HPA=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_HPA_ENABLED=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PM=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PM_ENABLED=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SECURITY=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SECURITY_ENABLED=0'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SMART=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SMART_ENABLED=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PUIS=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PUIS_ENABLED=0'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_APM=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_APM_ENABLED=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254'
'ata_id --export /dev/sdn'(out) 'ID_ATA_DOWNLOAD_MICROCODE=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_SATA=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_SATA_SIGNAL_RATE_GEN2=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_SATA_SIGNAL_RATE_GEN1=1'
'ata_id --export /dev/sdn'(out) 'ID_ATA_ROTATION_RATE_RPM=7200'
'ata_id --export /dev/sdn'(out) 'ID_WWN=0x5000cca23be1dc3c'
'ata_id --export /dev/sdn'(out) 'ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c'
Process 'ata_id --export /dev/sdn' succeeded.
LINK 'disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX' /lib/udev/rules.d/60-persistent-storage.rules:47
IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-storage.rules:65
LINK 'disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0' /lib/udev/rules.d/60-persistent-storage.rules:66
IMPORT builtin 'blkid' /lib/udev/rules.d/60-persistent-storage.rules:81
probe /dev/sdn raid offset=0
LINK 'disk/by-id/wwn-0x5000cca23be1dc3c' /lib/udev/rules.d/60-persistent-storage.rules:88
RUN '/usr/lib/python-dsnet-appliance/hotplug disk udev-disk-add' /etc/udev/rules.d/99-appliance-hotplug.rules:1
update old name, '/dev/disk/by-id/scsi-35000cca23be1dc3c' no longer belonging to '/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn'
no reference left, remove '/dev/disk/by-id/scsi-35000cca23be1dc3c'
handling device node '/dev/sdn', devnum=b8:208, mode=0660, uid=0, gid=6
preserve permissions /dev/sdn, 060660, uid=0, gid=6
preserve already existing symlink '/dev/block/8:208' to '../sdn'
creating link '/dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX' to '/dev/sdn'
creating symlink '/dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX' to '../../sdn'
found 'b8:208' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fwwn-0x5000cca23be1dc3c'
creating link '/dev/disk/by-id/wwn-0x5000cca23be1dc3c' to '/dev/sdn'
preserve already existing symlink '/dev/disk/by-id/wwn-0x5000cca23be1dc3c' to '../../sdn'
found 'b8:208' claiming '/run/udev/links/\x2fdisk\x2fby-path\x2fpci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0'
creating link '/dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0' to '/dev/sdn'
preserve already existing symlink '/dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0' to '../../sdn'
created db file '/run/udev/data/b8:208' for '/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn'
ACTION=add
DEVLINKS=/dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 /dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX /dev/disk/by-id/wwn-0x5000cca23be1dc3c
DEVNAME=/dev/sdn
DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn
DEVTYPE=disk
ID_ATA=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254
ID_ATA_FEATURE_SET_APM_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_ROTATION_RATE_RPM=7200
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_MODEL=HGST_HUH728080ALE604
ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PATH=pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0
ID_PATH_TAG=pci-0000_05_00_0-sas-exp0x500605b0000272bf-phy11-lun-0
ID_REVISION=A4GNW7J0
ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX
ID_SERIAL_SHORT=ZZZZH3VX
ID_TYPE=disk
ID_WWN=0x5000cca23be1dc3c
ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c
MAJOR=8
MINOR=208
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=6055690
run: '/usr/lib/python-dsnet-appliance/hotplug disk udev-disk-add'
Unload module index
Unloaded link configuration context.
```

6. Query just to double check: (ID_BUS=ata, model correct, etc).
```
root@machine:~# udevadm info /dev/sdn
P: /devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn
N: sdn
S: disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX
S: disk/by-id/wwn-0x5000cca23be1dc3c
S: disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0
E: DEVLINKS=/dev/disk/by-id/wwn-0x5000cca23be1dc3c /dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 /dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX
E: DEVNAME=/dev/sdn
E: DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn
E: DEVTYPE=disk
E: ID_ATA=1
E: ID_ATA_DOWNLOAD_MICROCODE=1
E: ID_ATA_FEATURE_SET_APM=1
E: ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254
E: ID_ATA_FEATURE_SET_APM_ENABLED=1
E: ID_ATA_FEATURE_SET_HPA=1
E: ID_ATA_FEATURE_SET_HPA_ENABLED=1
E: ID_ATA_FEATURE_SET_PM=1
E: ID_ATA_FEATURE_SET_PM_ENABLED=1
E: ID_ATA_FEATURE_SET_PUIS=1
E: ID_ATA_FEATURE_SET_PUIS_ENABLED=0
E: ID_ATA_FEATURE_SET_SECURITY=1
E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522
E: ID_ATA_FEATURE_SET_SMART=1
E: ID_ATA_FEATURE_SET_SMART_ENABLED=1
E: ID_ATA_ROTATION_RATE_RPM=7200
E: ID_ATA_SATA=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1
E: ID_ATA_WRITE_CACHE=1
E: ID_ATA_WRITE_CACHE_ENABLED=1
E: ID_BUS=ata
E: ID_MODEL=HGST_HUH728080ALE604
E: ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_PATH=pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0
E: ID_PATH_TAG=pci-0000_05_00_0-sas-exp0x500605b0000272bf-phy11-lun-0
E: ID_REVISION=A4GNW7J0
E: ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX
E: ID_SERIAL_SHORT=ZZZZH3VX
E: ID_TYPE=disk
E: ID_WWN=0x5000cca23be1dc3c
E: ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c
E: MAJOR=8
E: MINOR=208
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=6055690
```

If I install the same disk into a machine using an ATA driver, this behavior changes:
```
root@machine2:~# sg_vpd -p ai /dev/sdb
ATA information VPD page:
  SAT Vendor identification: linux
  SAT Product identification: libata
  SAT Product revision level: 3.00
  Device signature indicates SATA transport
  ATA command IDENTIFY DEVICE response summary:
    model: HGST HUH728080ALE604
    serial number: ZZZZH3VX
    firmware revision: A4GNW7J0
root@machine-2:~# /lib/udev/ata_id -x /dev/sdb
ID_ATA=1
ID_TYPE=disk
ID_BUS=ata
ID_MODEL=HGST_HUH728080ALE604
ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_REVISION=A4GNW7J0
<truncated>
```

4 years agoMerge pull request #13709 from zachsmith/systemd-tmpfiles-allow-append-to-file
Zbigniew Jędrzejewski-Szmek [Fri, 4 Oct 2019 09:59:06 +0000 (11:59 +0200)] 
Merge pull request #13709 from zachsmith/systemd-tmpfiles-allow-append-to-file

systemd-tmpfiles: allow appending content to file

4 years agotest-execute: Filter /dev/.lxc in exec-dynamicuser-statedir.service
Balint Reczey [Fri, 27 Sep 2019 17:56:05 +0000 (19:56 +0200)] 
test-execute: Filter /dev/.lxc in exec-dynamicuser-statedir.service

It appears in nested LXC containers and broke the test in Ubuntu CI.

BugLink: https://bugs.launchpad.net/bugs/1845337
4 years agoadded working volume buttons for medion erazer...
crashfistfight [Thu, 3 Oct 2019 21:53:08 +0000 (23:53 +0200)] 
added working volume buttons for medion erazer...

4 years agoman: document updated newline support
Mark Stosberg [Thu, 3 Oct 2019 20:26:42 +0000 (16:26 -0400)] 
man: document updated newline support

Since v239 newlines have been allowed for PassEnvironment=
and EnvironmentFile=, due to #8471.

This PR documents the behavior change.

4 years agorules: Add automatic suspend udev rules
Mario Limonciello [Mon, 9 Sep 2019 21:49:35 +0000 (22:49 +0100)] 
rules: Add automatic suspend udev rules

The ChromeOS ecosystem has a large amount of testing, both automated
and manual across devices including measurement of power regressions.

It's safe to assume that any of these devices will handle USB
auto-suspend appropriately.  Use the script from ChromeOS
https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
to generate udev rules at build time.

This script in systemd `tools/chromeos/gen_autosuspend_rules.py` should be kept
in sync with the ChromeOS version of the script.

Manually added autosuspend devices should be placed in the new
template `rules/61-autosuspend-manual.rules`

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
4 years agosystemctl: Default suffixes for timer and socket
Kevin Kuehler [Sat, 14 Sep 2019 08:39:28 +0000 (01:39 -0700)] 
systemctl: Default suffixes for timer and socket

* use .timer suffix by default for systemctl list-timers
* use .socket suffix by default for systemctl list-sockets

4 years agotty-ask-pwd-agent: rename watch_passwords() and show_passwords()
Franck Bui [Tue, 17 Sep 2019 09:03:04 +0000 (11:03 +0200)] 
tty-ask-pwd-agent: rename watch_passwords() and show_passwords()

Those names were a bit confusing both functions process password files the
former relies one the later and waits for new files.

Also show_passwords() was not only used to list password files/requests but
also to query the user.

No functional changes.

4 years agosystemd-tmpfiles: allow appending content to file 13709/head
Zach Smith [Fri, 4 Oct 2019 01:19:18 +0000 (18:19 -0700)] 
systemd-tmpfiles: allow appending content to file

Adds support to append to files with w+ type.

 w /tmp/13291.out - - - - first line\n
 w+ /tmp/13291.out - - - - second line\n

4 years agosystemd-tmpfiles: rename force to append_or_force
Zach Smith [Fri, 4 Oct 2019 01:09:35 +0000 (18:09 -0700)] 
systemd-tmpfiles: rename force to append_or_force

The force field of the Item struct is used to indicate
force creation or appending in different context. This
change renames the field to append_or_force to improve
readability.

4 years agoMerge pull request #13690 from cdown/cgroup_rework
Zbigniew Jędrzejewski-Szmek [Thu, 3 Oct 2019 20:09:56 +0000 (22:09 +0200)] 
Merge pull request #13690 from cdown/cgroup_rework

cgroup: Add support to check systemd-internal cgroup limits against the kernel

4 years agonetworkd: split out repeated code to a helper function
Zbigniew Jędrzejewski-Szmek [Thu, 3 Oct 2019 13:46:44 +0000 (15:46 +0200)] 
networkd: split out repeated code to a helper function

Follow-up for 156ddf8df7.

4 years agopid1: restore the original environment passed by the kernel when switching to a new...
Franck Bui [Tue, 1 Oct 2019 12:31:14 +0000 (14:31 +0200)] 
pid1: restore the original environment passed by the kernel when switching to a new system manager

PID1 may modified the environment passed by the kernel when it starts
running. Commit 9d48671c62de133a2b9fe7c31e70c0ff8e68f2db unset $HOME for
example.

In case PID1 is going to switch to a new root and execute a new system manager
which is not systemd, we should restore the original environment as the new
manager might expect some variables to be set by default (more specifically
$HOME).

4 years agotest/README.testsuite: add section for Ubuntu CI blacklist files 13568/head
Dan Streetman [Wed, 2 Oct 2019 08:16:01 +0000 (04:16 -0400)] 
test/README.testsuite: add section for Ubuntu CI blacklist files

Add some docs explaining how blacklist individual test/TEST-*
tests in Ubuntu CI using per-test blacklist files.

4 years agotest: add temporarily blacklisted tests
Dan Streetman [Mon, 16 Sep 2019 16:34:55 +0000 (12:34 -0400)] 
test: add temporarily blacklisted tests

This temporarily blacklists some tests when run under Ubuntu CI.

This is the upstream side of the Debian 'upstream' test MR:
https://salsa.debian.org/systemd-team/systemd/merge_requests/52

The tests blacklisted here should only be temporarily blacklisted
until they can be fixed; the intention is that these blacklist files
will be added and removed over time while debugging/fixing flaky
and/or regressed tests, without causing test failure noise for other
PRs.

4 years agoMerge pull request #13645 from danielstuart14/master
Zbigniew Jędrzejewski-Szmek [Thu, 3 Oct 2019 14:53:54 +0000 (16:53 +0200)] 
Merge pull request #13645 from danielstuart14/master

Add chromebook orientation quirk

4 years agocgroup: analyze: Report memory configurations that deviate from systemd 13690/head
Chris Down [Thu, 3 Oct 2019 12:21:29 +0000 (13:21 +0100)] 
cgroup: analyze: Report memory configurations that deviate from systemd

This is the most basic consumer of the new systemd-vs-kernel checker,
both acting as a reasonable standalone exerciser of the code, and also
as a way for easy inspection of deviations from systemd internal state.

4 years agocgroup: analyze: Match standard dump format
Chris Down [Mon, 30 Sep 2019 15:09:18 +0000 (16:09 +0100)] 
cgroup: analyze: Match standard dump format

We're the only ones left using = as the delimiter, which looks really
weird in `systemd-analyze dump`. Use `: ` like everyone else.

4 years agocgroup: Allow checking systemd-internal limits against the kernel
Chris Down [Mon, 30 Sep 2019 15:13:32 +0000 (16:13 +0100)] 
cgroup: Allow checking systemd-internal limits against the kernel

We currently don't have any mitigations against another privileged user
on the system messing with the cgroup hierarchy, bringing the system out
of line with what we've set in systemd. We also don't have any real way
to surface this to the user (we do have logs, but you have to know to
look in the first place).

There are a few possible solutions:

1. Maintaining our own cgroup tree with the new fsopen API and having a
   read-only copy for everyone else. However, there are some
   complications on this front, and this may be infeasible in some
   environments. I'd rate this as a longer term effort that's tangential
   to this patch.
2. Actively checking for changes with {fa,i}notify and changing them
   back afterwards to match our configuration again. This is also
   possible, but it's also good to have a way to do passive monitoring
   of the situation without taking hard action. Also, currently daemons
   like senpai do actually need to modify the tree behind systemd's
   back (although hopefully this should be more integrated soon).

This patch implements another option, where one can, on demand, monitor
deviations in cgroup memory configuration from systemd's internal state.
Currently the only consumer is `systemd-analyze dump`, but the interface
is generic enough that it can also be exposed elsewhere later (for
example, over D-Bus).

Currently only memory limit style properties are supported, but later I
also plan to expand this out to other properties that systemd should
have ultimate control over.

4 years agoUpdate sd_journal_print.xml
Léonard Gérard [Wed, 2 Oct 2019 23:31:07 +0000 (17:31 -0600)] 
Update sd_journal_print.xml

Fix the documentation part of the current limitation os sd_journal_print reported in #13706.

4 years agocgroup: fix typo in BPF firewall support warning message
Mike Kazantsev [Thu, 3 Oct 2019 13:11:41 +0000 (18:11 +0500)] 
cgroup: fix typo in BPF firewall support warning message

4 years agomemory-util: Add PAGE_ALIGN_DOWN
Chris Down [Thu, 3 Oct 2019 13:41:06 +0000 (14:41 +0100)] 
memory-util: Add PAGE_ALIGN_DOWN

For example, cgroup v2 rounds down to the previous page when returning
memory limits.

4 years agoMerge pull request #12818 from yuwata/network-issue-8726
Zbigniew Jędrzejewski-Szmek [Thu, 3 Oct 2019 13:21:35 +0000 (15:21 +0200)] 
Merge pull request #12818 from yuwata/network-issue-8726

network: disable kernel creating prefix route when RouteTable= is set