| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
It also detects e.g. glusterfs or mounts with "_netdev" option.
|
|
|
|
| |
for a given path
|
|\
| |
| | |
Fixes https://github.com/systemd/systemd/issues/34758
|
| |
| |
| |
| |
| |
| | |
TransactionAddFlags
No functional change. Preparation for later commits.
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This makes use of the new TIOCGPTPEER pty ioctl() for directly opening a
PTY peer, without going via path names. This is nice because it closes a
race around allocating and opening the peer. And also has the nice
benefit that if we acquired an fd originating from some other
namespace/container, we can directly derive the peer fd from it, without
having to reenter the namespace again.
|
| | |
| | |
| | |
| | |
| | | |
This opens a pty peer in one go, and uses the new race-free TIOCGPTPEER
ioctl() to do so – if it is available.
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes: #34604
Prompted by that I realized we do not correctly recognize both "ST"
sequences we want to recognize, fix that.
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Rework of #30109 to deal with changes in #30840 and discussed changes to
behavior
Depends on and includes #30840
Fixes https://github.com/systemd/systemd/issues/34268
|
| |/ / / |
|
|\ \ \ \ |
|
| | | | | |
|
| |/ / /
|/| | | |
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Let's make sure that sd_varlink_error() always returns an error code, so
that we can use it in a style "return sd_varlink_error(…);" everywhere,
which has two effects: return a good error reply to clients, and exit
the current stack frame with a failure code.
Interestingly sd_varlink_error_invalid_parameter() already worked like
this in some cases, but sd_varlink_error() itself didn't.
This is an alternative to the error handling tweak proposed in #34882,
but I think is a lot more generically useful, since it establishes a
pattern.
I checked our codebase, and this change should generally be OK without
breaking callsites, since the current callers (with exception of the
machined case from #34882) called sd_varlink_error() in the outermost
varlink method call dispatch stack frame, where this behaviour change
does not alter anything.
This is similar btw, how sd_bus_error_setf() and friends always return
error codes too, synthesized from its parameters.
|
|\ \ \
| |/ /
|/| | |
|
| |/
| |
| |
| | |
This makes it easier to diagnose why colors are disabled.
|
| |
| |
| |
| |
| | |
We often format the prefix string via asprintf() before, let's hence add
a helper for that.
|
|/
|
|
|
| |
It will finish on its own always and cleanly, and running it always
should increase test coverage.
|
|
|
|
| |
(#34893)
|
|
|
|
|
| |
This makes use of the infra introduced in 229d4a980607e9478cf1935793652ddd9a14618b to indicate visually on each prompt that we are in superuser mode temporarily.
pick ad5de3222f userdbctl: add some basic client-side filtering
|
| |
|
|\
| |
| | |
test: update permission of credstore
|
| |
| |
| |
| | |
Follow-up for 40fb9eebbc075ce1e63100386d2c5f177ad7d738.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
dangling symlink
One of the big mistakes of Linux is that when you create a file with
open() and O_CREAT and the file already exists as dangling symlink that
the symlink will be followed and the file created that it points to.
This has resulted in many vulnerabilities, and triggered the creation of
the O_MOFOLLOW flag, addressing the problem.
O_NOFOLLOW is less than ideal in many ways, but in particular one: when
actually creating a file it makes sense to set, because it is a problem
to follow final symlinks in that case. But if the file is already
existing, it actually does make sense to follow the symlinks. With
openat_report_new() we distinguish these two cases anyway (the whole
function exists only to distinguish the create and the exists-already
case after all), hence let's do something about this: let's simply never
create files "through symlinks".
This can be implemented very easily: just pass O_NOFOLLOW to the 2nd
openat() call, where we actually create files.
And then basically remove 0dd82dab91eaac5e7b17bd5e9a1e07c6d2b78dca
again, because we don't need to care anymore, we already will see ELOOP
when we touch a symlink.
Note that this change means that openat_report_new() will thus start to
deviate from plain openat() behaviour in this one small detail: when
actually creating files we will *never* follow the symlink. That should
be a systematic improvement of security.
Fixes: #34088
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
We have two distinct implementations of the post hook.
1. For SELinux we just reset the selinux label we told the kernel
earlier to use for new inodes.
2. For SMACK we might apply an xattr to the specified file.
The two calls are quite different: the first call we want to call in all
cases (failure or success), the latter only if we actually managed to
create an inode, in which case it is called on the inode.
|
|\
| |
| | |
RFC9463: Discovery of Network-designated Resolvers
|
| |
| |
| |
| |
| | |
This is implemented in various places, but it is better to share this
code.
|
| |
| |
| |
| |
| | |
The links moved to the legacy dataset so they won't be available by
default, so stop using them and just use the city ones instead
|
| |
| |
| |
| |
| | |
Follow-up for 60ae3b86fb52d545b279e3927d2214462385e734.
Fixes CID#1563782.
|
| |
| |
| |
| |
| |
| |
| | |
serializations
Now that we have a way to recognize "remoteness" of a PidRef, let's make
sure when we decode a JSON pidref we initialize things that way.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This PidRef just track some data, but cannot be used for any active
operation.
Background: for https://github.com/systemd/systemd/pull/34703 it makes
sense to track explicitly if some PidRef is not a local one, so that we
never attempt to for example "kill a remote process" and thus
acccidentally hit the wrong process (i.e. a local one by the same PID).
|
|\ \
| | |
| | | |
userdb: handle userbd replies indicating invalid user/group names like record not found
|
| | | |
|
|\ \ \
| |/ /
|/| | |
busctl: dump passed fd info
|
| | |
| | |
| | |
| | | |
Currently this is not used, but will be used later.
|
| | | |
|
|/ /
| |
| |
| |
| | |
Follow-up for fb0ea6a6a36b5fa97e6c57d608bb9f7acb63c8b2.
Fixes #34772.
|
|\ \
| | |
| | | |
machined: switch remaining Varlink overs over to use json_dispatch_pidref() and friends
|
| | |
| | |
| | |
| | |
| | |
| | | |
The PID_AUTOMATIC value is now properly recognized by the PidRef logic
too. This needed some massaging of header includes, to ensure pidref.h
can access process-util.h's definitions and vice versa.
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
fundamental: Add SHA1
|
| | | |
|
|/ /
| |
| |
| |
| | |
The function is also used in other source files. Hence, not internal.
No functional change, just refactoring.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
So far, at the one place we sent a PID over Varlink we did so as a
simple numeric pid_t value. That's of course is racy, since classic PIDs
are recycled too eagerly.
Let's address that, by passing around JSON objects distantly resembling our
PidRef structure. Note that this JSON object does *not* contain the
pidfd, however, but just the pidfd inode number if known.
I originally planned to include the pidfd in some direct form, but I
figured that's not really the best idea, since we always need a
side-channel of some form for that (i.e. AF_UNIX/SCM_RIGHTS), but we
should be able to report about PIDs even without that.
Moreover, while sending the pid number and pidfd id around should always
be OK to do, it's a lot more problematic to always send a pidfd around,
since that implies that fd passing is on and it is OK to install fds
remotely in some IPC peers fd table. For example, when doing a wild dump
of service manager service state we really shouldn't end up with a bunch
of fds installed in our client's fd table.
Hence, all in all I think it is cleaner to define a structure carrying
pid number and pidfd inode id, wich is passed directly as JSON. And then
optionally, in a separate field also pass around a pidfd where it makes
sense.
Note that sending around pidfds is not that beneficial anymore if we
have the pidfd inode id, because we can always securely and reliably get
a pidfd back from a pair of pid + inode id: first we do pidfd_open() on
the pid, and then we check if it is really the right one by comparing
.st_ino after fstat().
This logic is implemented gracefully: if for some reason pidfd/pidfd
inode nrs are not available (too old kernel), we'll fall back to plain
PID numbers.
The dispatching logic knows two distinct levels of validation of the
provided PID data: if SD_JSON_STRICT is specified we'll acquire a pidfd
for the PID, thus verifying it currently exists and failing if it
doesn't. If the flag is not set, well just store the provided info
as-is, will try to acquire a pidfd for it, but not fail if we cannot.
Both modes are important in different contexts.
Also note that in addition to the pidfd inode nr we always store the
current boot ID of the system in the JSON object, since only the
combination of pidfd inode nr and boot ID of the system really is a
world-wide unique reference to a process.
When dispatching a JSON pid field we operate somewhat gracefully: we
either support the triplet structure of pid, pid inode nr, boot id, or
we accept a simple classic UNIX pid.
|
| | |
|
|\ \
| | |
| | | |
fd-util: use F_DUPFD_QUERY for same_fd()
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Catch up with the nice little toys the kernel fs developers have added
for us. Preferably, let's make use of the new F_DUPFD_QUERY fcntl() call
that checks whether two fds are just duplicates of each other
(duplicates as in dup(), not as in open() of the same inode, i.e.
whether they share a single file offset and so on).
This API is much nicer, since it is a core kernel feature, unlike the
kcmp() call we so far used, which is part of the (optional)
checkpoint/restore stuff.
F_DUPFD_QUERY is available since kernel 6.10.
|
| | |
| | |
| | |
| | |
| | | |
It just uses F_GETFD to validate an fd. it's a bit easier to read
though, and handles the < 0 case internally.
|