Commit Graph

23955 Commits

Author SHA1 Message Date
Anders Jonsson
4b2d9f509f Update Swedish translation 2022-01-22 10:30:57 +00:00
Daniel Mustieles
0c000b97f0 Updated Spanish translation 2022-01-21 10:26:53 +01:00
Hugo Carvalho
9e1fabd601 Update Portuguese translation 2022-01-19 15:31:17 +00:00
Sebastian Dröge
2bc689268a Merge branch 'backport-2435-spawn-close-range-glib-2-70' into 'glib-2-70'
Backport !2435 “gspawn: Report errors with closing file descriptors between fork/exec” to glib-2-70

See merge request GNOME/glib!2444
2022-01-19 13:46:37 +00:00
Philip Withnall
9dabc7c5ac gspawn: Report errors with closing file descriptors between fork/exec
If a seccomp policy is set up incorrectly so that it returns `EPERM` for
`close_range()` rather than `ENOSYS` due to it not being recognised, no
error would previously be reported from GLib, but some file descriptors
wouldn’t be closed, and that would cause a hung zombie process. The
zombie process would be waiting for one half of a socket to be closed.

Fix that by correctly propagating errors from `close_range()` back to the
parent process so they can be reported correctly.

Distributions which aren’t yet carrying the Docker fix to correctly
return `ENOSYS` from unrecognised syscalls may want to temporarily carry
an additional patch to fall back to `safe_fdwalk()` if `close_range()`
fails with `EPERM`. This change will not be accepted upstream as `EPERM`
is not the right error for `close_range()` to be returning.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2580
2022-01-19 13:12:52 +00:00
Sebastian Dröge
dfc43aedec Merge branch 'backport-2425-btrfs-optimisation-glib-2-70' into 'glib-2-70'
Backport !2425 “gfileutils: Remove outdated BTRFS fsync optimization from set_contents” to glib-2-70

See merge request GNOME/glib!2437
2022-01-18 08:51:32 +00:00
Sebastian Keller
fa4b0e431e gfileutils: Remove outdated BTRFS fsync optimization from set_contents
This code was skipping fsync on BTRFS because of an old guarantee about
the overwrite-by-rename behavior that no longer holds true. This has
been confirmed by the BTRFS developers to no longer be guaranteed since
Kernel 3.17 (August 2014), but it was guaranteed when this optimization
was first introduced in 2010.

This could result in empty files after crashes in applications using
g_file_set_contents(). Most prominently this might have been the cause
of dconf settings getting lost on BTRFS after crashes due to the
frequency with which such writes can happen in dconf.

See: https://gitlab.gnome.org/GNOME/dconf/-/issues/73
2022-01-17 20:08:54 +00:00
Marek Černocký
9404a7b5d3 Updated Czech translation 2022-01-14 12:03:42 +01:00
Sebastian Dröge
e1bbfdbcd5 Merge branch 'backport-2412-paramspec-annotation-glib-2-70' into 'glib-2-70'
Backport !2412 “paramspec: fix unref annotation” to glib-2-70

See merge request GNOME/glib!2415
2022-01-05 13:45:24 +00:00
Bilal Elmoussaoui
2812798347 paramspec: fix unref annotation 2022-01-05 13:13:03 +00:00
Мирослав Николић
12d77beb94 Update Serbian translation 2021-12-29 17:57:25 +00:00
Matej Urbančič
19badb2434 Update Slovenian translation 2021-12-19 21:27:53 +00:00
Emin Tufan Çetin
b787683dcc Update Turkish translation 2021-12-17 14:59:22 +00:00
Philip Withnall
8c6b44d40c Merge branch 'backport-1968-spawn-fds-fix-glib-2-70' into 'glib-2-70'
Backport !1968 “gspawn: Fix file descriptor conflation issues” to glib-2-70

See merge request GNOME/glib!2394
2021-12-15 14:21:39 +00:00
Michael Catanzaro
75dd51b86f gspawn: fix fd remapping conflation issue
We currently dup all source fds to avoid possible conflation with the
target fds, but fail to consider that the result of a dup might itself
conflict with one of the target fds. Solve this the easy way by duping
all source_fds to values that are greater than the largest fd in
target_fds.

Fixes #2503
2021-12-15 08:21:07 +00:00
Michael Catanzaro
28fde86522 gspawn: fix hangs when duping child_err_report_fd
In case child_err_report_fd conflicts with one of the target_fds, the
code here is careful to dup child_err_report_fd in order to avoid
conflating the two. It was a good idea, but evidently was not tested,
because the newly-created fd is not created with CLOEXEC set. This means
it stays open in the child process, causing the parent to hang forever
waiting to read from the other end of the pipe. Oops!

The fix is simple: just set CLOEXEC. This removes our only usage of the
safe_dup() function, so it can be dropped.

Fixes #2506
2021-12-15 08:21:07 +00:00
Michael Catanzaro
7663664c0a gspawn: use close_and_invalidate more 2021-12-15 08:21:07 +00:00
Aurimas Černius
134da2a55b Updated Lithuanian translation 2021-12-11 21:08:28 +02:00
Daniel Șerbănescu
409326e1d4 Update Romanian translation 2021-12-10 10:19:36 +00:00
Andika Triwidada
ad3fc660ea Update Indonesian translation 2021-12-05 04:07:24 +00:00
Philip Withnall
979da1da48 2.70.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-03 09:59:15 +00:00
Sebastian Dröge
c72917b37f Merge branch 'backport-2382-ossfuzz-41563-canonical-triple-slash-dot-dot-glib-2-70' into 'glib-2-70'
Backport !2382 “gfileutils: Correctly reset start value when canonicalising paths” to glib-2-70

See merge request GNOME/glib!2383
2021-12-02 19:49:54 +00:00
Philip Withnall
149e5c5159 gfileutils: Correctly reset start value when canonicalising paths
If a path starts with more than two slashes, the `start` value was
previously incorrect:
 1. As per the `g_path_skip_root()` call, `start` was set to point to
    after the final initial slash. For a path with three initial
    slashes, this is the character after the third slash.
 2. The canonicalisation loop to find the first dir separator sets
    `output` to point to the character after the first slash (and it
    overwrites the first slash to be `G_DIR_SEPARATOR`).
 3. At this point, with a string `///usr`, `output` points to the second
    `/`; and `start` points to the `u`. This is incorrect, as `start`
    should point to the starting character for output, as per the
    original call to `g_path_skip_root()`.
 4. For paths which subsequently include a `..`, this results in the
    `output > start` check in the `..` loop below not skipping all the
    characters of a preceding path component, which is then caught by
    the `G_IS_DIR_SEPARATOR (output[-1])` assertion.

Fix this by resetting `start` to `output` after finding the final slash
to keep in the output, but before starting the main parsing loop.

Relatedly, split `start` into two variables: `after_root` and
`output_start`, since the variable actually has two roles in the two
parts of the function.

Includes a test.

This commit is heavily based on suggestions by Sebastian Wilhemi and
Sebastian Dröge.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

oss-fuzz#41563
2021-12-02 18:47:39 +00:00
Philip Withnall
96bccb89df gfileutils: Add a comment in g_canonicalize_filename()
Clarify the code a little. This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-02 18:47:39 +00:00
Quentin PAGÈS
711efa507b Update Occitan translation 2021-12-02 15:05:45 +00:00
Sebastian Dröge
541114846d Merge branch 'backport-2265-unregistration-race-glib-2-70' into 'glib-2-70'
Backport !2265 “gdbusconnection: Fix race between method calls and object unregistration” to glib-2-70

See merge request GNOME/glib!2312
2021-12-02 10:12:20 +00:00
Philip Withnall
e8228314e1 Merge branch 'backport-2374-canonicalize-filename-glib-2-70' into 'glib-2-70'
Backport !2374 “gfileutils: Improve performance of g_canonicalize_filename()” to glib-2-70

See merge request GNOME/glib!2375
2021-11-30 10:08:11 +00:00
Sebastian Wilhelmi
28a15f95c4 gfileutils: Improve performance of g_canonicalize_filename()
Improve the performance of canonicalising filenames with many `..` or
`.` components, by modifying the path inline rather than calling
`memmove()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2541
2021-11-30 09:42:38 +00:00
Aleksandr Melman
b7cec3d9f0 Update Russian translation 2021-11-28 15:20:58 +00:00
Piotr Drąg
816d4c3000 Update Polish translation 2021-11-28 13:54:06 +00:00
Enrico Nicoletto
399b88ee12 Update Brazilian Portuguese translation 2021-11-26 10:16:14 +00:00
Hugo Carvalho
4b4f6119c3 Update Portuguese translation 2021-11-25 13:44:39 +00:00
Anders Jonsson
b3a333814d Update Swedish translation 2021-11-24 16:24:14 +00:00
Sebastian Dröge
12b613b582 Merge branch 'backport-2364-freebsd-objcopy-glib-2-70' into 'glib-2-70'
Backport !2364 “tests: Allow `objcopy --help` to fail, because it fails on FreeBSD” to glib-2-70

See merge request GNOME/glib!2366
2021-11-24 15:50:52 +00:00
Philip Withnall
05340ad8b4 tests: Allow objcopy --help to fail, because it fails on FreeBSD
This is a partial revert of b248f3481c. Eventually, this commit can be
dropped once `objcopy --help` doesn’t exit with a non-zero status on
FreeBSD.

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2360#note_1318608

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-24 15:20:25 +00:00
Sebastian Dröge
3562c9e16d Merge branch 'backport-2360-meson-check-glib-2-70' into 'glib-2-70'
Backport !2360 “meson: specify when commands need to succeed in run_command” to glib-2-70

See merge request GNOME/glib!2363
2021-11-24 10:53:59 +00:00
Eli Schwartz
f80da352c9 meson: specify when commands need to succeed in run_command
meson in git master now warns about a missing `check:` kwarg, and may
eventually change the default from false to true.

Take the opportunity to require `objcopy --help` to succeed -- it is
unlikely to fail, but if it does something insane happened.
2021-11-24 10:32:30 +00:00
Philip Withnall
485dd16dc1 Merge branch 'improve-win32-version-2-70' into 'glib-2-70'
gutils.c: Improve g_get_os_info() for Windows 10/Server 2019+

See merge request GNOME/glib!2359
2021-11-24 10:29:27 +00:00
Yuri Chornoivan
0b021116b9 Update Ukrainian translation 2021-11-24 10:27:12 +00:00
Sebastian Dröge
a911cf837a Merge branch 'backport-2354-test-dbus-glib-2-70' into 'glib-2-70'
Backport !2354 “gtestdbus: Print the dbus address on a specific FD intead of stdout” to glib-2-70

See merge request GNOME/glib!2361
2021-11-24 10:24:28 +00:00
Marco Trevisan (Treviño)
5afc7d5b77 gtestdbus: Print the dbus address on a specific FD intead of stdout
We used to use a pipe for the dbus daemon stdout to read the defined
address, but that was already requiring a workaround to ensure that dbus
daemon children were then able to write to stdout.
However the current implementation is still causing troubles in some
cases in which the daemon is very verbose, leading to hangs when writing
to stdout.

As per this, just don't handle stdout ourself, but use instead a
specific pipe to get the address address. That can now be safely closed
once we've received the data we need.

This reverts commit d80adeaa96.

Fixes: #2537
2021-11-24 09:54:25 +00:00
Chun-wei Fan
e5917c67ba gutils.c: Improve Windows 10/Server 2019 20H2+ detection
This improves how we obtain the Windows release versions in
get_windows_version(), in turn g_get_os_info() for Windows 10/Server
2019 20H2 (2009) and later and Windows 11, by doing the following:

*  Check the build number for non-server versions of Windows.
   For Windows 11, the build number is 22000+, so we now correctly
   indicate on Windows 11 that we are indeed running Windows 11.
*  Check the DisplayVersion entry in the registry under
   SOFTWARE\Microsoft\Windows NT\CurrentVersion if we obtained "2009"
   from the ReleaseId entry, since DisplayVersion replaces ReleaseId
   after Windows 10/Server 2019 20H2 (2009).  This makes things more
   clear for Windows releases after 20H2, where previously 20H2
   and 21H1 were all identified as Windows 10 [Server] 2009.

This should fix issue #2443.
2021-11-24 10:44:16 +08:00
Chun-wei Fan
2e99a15291 gwin32.c: Split out call to RtlGetVersion()
Unfortunately, we may well be likely to need to call RtlGetVersion() via
GetModuleHandle() + GetProcAddress(), so split out the call to RtlGetVersion()
into a private function of its own, so that we can reuse the same code in other
parts of GLib, so that we can:

*  Determine better in a more fine-tuned way to determine whether we are on
   Windows 10/11 and/or Server 2016/2019/2022, since we need to rely on the
   build number.

*  Just call RtlGetVersion() once, when needed, as that is all that is needed.
   We could re-use the same function once to compare what we got when we
   called RtlGetVersion() and do what is necessary there.
2021-11-24 10:44:01 +08:00
Philip Withnall
0926864f6f Merge branch 'backport-2355-dbus-message-truncation-glib-2-70' into 'glib-2-70'
Backport !2355 “gdbusmessage: Add more bounds checking when parsing D-Bus messages” to glib-2-70

See merge request GNOME/glib!2356
2021-11-23 13:26:00 +00:00
Philip Withnall
a5f53c7d00 gdbusmessage: Remove arbitrary restriction on minimum D-Bus blob length
The code in `g_dbus_message_new_from_blob()` has now been fixed to
correctly error out on all truncated messages, so there’s no need for an
arbitrary programmer error if the input is too short to contain a valid
D-Bus message header.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2528
2021-11-23 12:59:20 +00:00
Sebastian Wilhelmi
0956ef613a tests: Add test cases for truncated D-Bus messages
(Minor code formatting tweaks and leak fixes by Philip Withnall.)

Helps: #2528
2021-11-23 12:59:20 +00:00
Sebastian Wilhelmi
a7f7880b86 gdbusmessage: Add more bounds checking when parsing D-Bus messages
Perform strict bounds checking when reading data from the D-Bus message,
and propagate errors to the callers.

Previously, truncated D-Bus messages could cause out-of-bounds reads.

This is a security issue, but one which is only exploitable when
communicating with an untrusted peer (who might send malicious
messages). Almost all D-Bus traffic is with a session or system bus,
where the dbus-daemon or dbus-broker is trusted, and is known to have
already rejected malformed (malicious) messages.

Accordingly, this is only exploitable with peer-to-peer D-Bus
conversations with an untrusted peer.

(Includes some minor cleanups from Philip Withnall.)

oss-fuzz#17408
Fixes: #2528
2021-11-23 12:59:20 +00:00
Sebastian Dröge
eba304f9ca Merge branch 'backport-2327-uri-normalization-glib-2-70' into 'glib-2-70'
Backport !2327 “guri: Improve performance of remove_dot_segments() algorithm” to glib-2-70

See merge request GNOME/glib!2344
2021-11-22 13:57:58 +00:00
Sebastian Wilhelmi
d4ef27b3ba guri: Improve performance of remove_dot_segments() algorithm 2021-11-17 15:22:48 +00:00
Sebastian Dröge
ae0a0d0dd5 Merge branch 'backport-2338-journald-namespaced-glib-2-70' into 'glib-2-70'
Backport !2338 “gmessages: Support namespaced journals” to glib-2-70

See merge request GNOME/glib!2340
2021-11-16 16:26:49 +00:00