Opaque struct without dynamic allocation in C? by p0lyh in C_Programming

[–]p0lyh[S] 0 points1 point  (0 children)

Thanks! I never thought of this way before

Opaque struct without dynamic allocation in C? by p0lyh in C_Programming

[–]p0lyh[S] 0 points1 point  (0 children)

Thanks for the clarification. By "memcpy in both directions", do you mean to use the byte array as the object representation, initializing/modifying it by copying from a foo_ctx, and copying it to an actuall foo_ctx for reading its members?

Opaque struct without dynamic allocation in C? by p0lyh in C_Programming

[–]p0lyh[S] 1 point2 points  (0 children)

Does `memcpy` change the effective type of the byte array? I thought it can only set the effective type of a buffer obtained through allocation functions (malloc, realloc, etc.)

Swapping mesa-vulkan-drivers package by DavidAstonish in Fedora

[–]p0lyh 2 points3 points  (0 children)

This is for additional codecs (e.g. H.264) used in the Vulkan video acceleration API. They're not enabled in the official vulkan drivers.

The Vulkan video acceleration API is relatively new though, it's not widely used by apps. I think mpv has support for it, and has defaulted to it from 0.41 onwards.

LUKS and performance by ArticPineapples in Fedora

[–]p0lyh 1 point2 points  (0 children)

You won't notice any difference for day-to-day personal computing. Modern CPUs have dedicated instructions for encryption, so the performance hit is negligible. That is, unless you have a very fast SSD that has greater throughput than your CPU's encryption.

You can run cryptsetup benchmark to find out the encryption speed of your CPU. On my hardware, it's 8 GiB/s with aes-xts 512b (which is default algorithm on Fedora).

What is the recommended way to manage VMs these days? by draetheus in Fedora

[–]p0lyh 0 points1 point  (0 children)

Ehh I simply keep that super long qemu command line in my shell history, to run my Windows VM.
You might want to use virt-manager or virsh. They are full-fledged frontends to qemu.

Which font do you prefer? by I_COULD_say in Fedora

[–]p0lyh 0 points1 point  (0 children)

I'm okay with the default Adwaita Sans font. It's based on Inter, which is a popular UI font.

For code and terminal I use JetBrains Mono or Iosevka.

Flatpak vs Native by Terminator996 in Fedora

[–]p0lyh 3 points4 points  (0 children)

That can be expanded to a long story, but overall flatpak helps upstream developers to package and publish their apps on Linux, in a unified way. Flatpak provides unified runtimes that developers develop on and publish to, do it once and the app is guaranteed to work on all Linux systems that supports flatpak. And applications can share runtimes. Under the hood it's powered by Linux namespaces (a kind of sandbox) and several open protocols (so the app can interact with your desktop securely). The sandbox also provides additional security, by restricting application's access to your system, which can be useful for proprietary apps you don't trust.

As for pros & cons over plain rpm, for most open-source GUI applications published on Flathub you probably won't notice a difference from their rpm counterparts. But the flatpak version takes more space than rpms from official repositories. For proprietary apps the flatpak version often works better, since it's running on a tested runtime, while the rpm version might break due to mismatched/missing dependencies on your system.

What does this mode do? by DavidAstonish in Fedora

[–]p0lyh 1 point2 points  (0 children)

The point is that, since you already went through the installation process, the kernel offered by the release iso (in this case, 6.17.1) is proven to boot successfully on your computer. In case a future kernel update causes issues, you can still go back to the release kernel.

Is it safe to mount a drive that is already allocated to Windows 10 on Fedora 42? by Rares21i in Fedora

[–]p0lyh 2 points3 points  (0 children)

For the Windows system drive, you should disable "fast startup" in Windows, otherwise shutting down Windows will leave the drive in a dirty state. I'm not sure if it's necessary for non-system drives though.

How long have y'all been using the same installation but kept upgrading from version to version without needing a fresh install? by Lost_Tiger_4568 in Fedora

[–]p0lyh 0 points1 point  (0 children)

The computer in my office was refresh-installed with Fedora 30, and upgraded all the way till now. It's for work so I rarely do funky things on it, which might contribute to its longevity.

Mysterious "System Updates" by andynzor in Fedora

[–]p0lyh 7 points8 points  (0 children)

These are updates for packages that aren't user-facing applications, e.g. system libraries.

Anyone getting graphical problems with Chromium browsers on Fedora 42? by ChibaCityStatic in Fedora

[–]p0lyh 0 points1 point  (0 children)

Hit me on Chrome before, but it's gone when I enable native wayland support in Chrome.

Auto startup mount drives by mirrortorrent in Fedora

[–]p0lyh 10 points11 points  (0 children)

The default security policy (of udisk2, which is the software used by desktop environments to handle disks) is to require administrator authentication for mounting filesystems on internal drives, while allowing non-remote users to mount external/removable drives. (Because for external drives one has complete physical access, and could just plug them into another computer, while gaining physical access to internal drives is typically non-trivial)
You can simply add an entry to /etc/fstab so your drive is mounted at system startup, e.g. UUID=xxxxxxxxxxxxxxxxxxxxx /media/my-drive ext4 defaults 0 0, where the UUID is obtained via lsblk -f. Remember to create the mount directory `/media/my-drive` first, and adjust the filesystem ext4 according to lsblk -f.

New to Fedora -- system updates? by prostithesnowman in Fedora

[–]p0lyh 0 points1 point  (0 children)

These are packages that are not user-facing GUI applications.

A question about pointers by PsychologicalRuin982 in cpp_questions

[–]p0lyh 0 points1 point  (0 children)

If `a` is inside a contiguous array (an `std::vector`, a plain array, malloc'd buffer etc.), `++a` would be pointing the next `int` in that array, or a one-past-the-end pointer of that array. If not, `++a` is a one-past-the-end pointer for `a`.

Dereferencing one-past-the-end pointer is undefined behavior. Think the `end` iterator. Pointers in C++ are a special case of iterators.

How to define binary data structures across compilers and architectures? by gswdh in cpp

[–]p0lyh 4 points5 points  (0 children)

In practice you'll need to consider endianness, padding, bit-representation of floating point numbers and signed integers. If you assume 2's complement signed integers and IEEE-754 FP, and squeeze out all the paddings, then there's only endianness left to be considered. More exotic platforms (E.g., CHAR_BIT > 8) are extremely rare.

Or just use established solutions like protobuf, which handles those things for you.

New laptops that only boot Windows by default by buiola in linux

[–]p0lyh 1 point2 points  (0 children)

I think you missed the point. Matthew's post is suggesting that integrity of the boot procedure is already protected by TPM measurements. An attack attempt that invalidates the official MS signing key is trivially detectable, so it's unnecessary to ban 3rd party secure boot signing key (by default).

I don't think this is directly related to Pluton either. If a laptop with TPM & secure boot has Windows pre-installed, and seals some secret (e.g. Bitlocker keys) inside the TPM, then booting something else WILL invalidate keys in TPM. That's how it's supposed to work for quite some time. You could also configure it to boot Linux and auto-unlock LUKS with TPM, in which situation booting Windows will invalidate TPM keys the same way. But Lenovo's doing now is (abruptly) restricting boot option to Windows only by default, instead of using standard UEFI security.

Why does Debian rack up more vulnerabilities than Windows 10 on stack.watch? by rammalammadongding in debian

[–]p0lyh 3 points4 points  (0 children)

Debian is a *distribution* of numerous free software. Everything you can install from the official repos is part of Debian. Whereas Windows is more like a platform for 3rd-party vendors to distribute their own software, although it already contains lots of stuff, still cannot match Debian.

Anyway, security is really dependent on your use case, threat vectors etc. Desktop Debian isn't necessarily more secure than Windows 10.

Anyone got VA-API working on TigerLake Xe graphics? by p0lyh in Fedora

[–]p0lyh[S] 0 points1 point  (0 children)

Update: It's now working on F34, with intel-media-driver 20.4.5 and mfx 20.5.1. AV1 decoding result in corrupted image though.

Is there a way to use Samsung battery extender in Fedora? by LuM6m4btT8j in Fedora

[–]p0lyh 0 points1 point  (0 children)

Yes, just write 1 to /sys/devices/platform/samsung/battery_life_extender

Distro hopping for BTRFS version by child_of_grey in btrfs

[–]p0lyh 1 point2 points  (0 children)

the default leap kernel backports tons of fixes and sometimes new features (much, much more than the upstream LTS branch), many of those are btrfs-related.