HNHacker News
TopNewBestAskShowJobs

dezgeg

2,900 karma · joined August 7, 2013

[ my public key: https://keybase.io/dezgeg; my proof: https://keybase.io/dezgeg/sigs/T97m4HN4fIeKVsJzfbIsXEgnHunf6ut9z2hZbtMU3BM ]
submissionscomments
dezgeg··on LKML discusses merging Rust access to filesystem APIs
Let's have a concrete example, link() in struct inode_operations is defined as:

    int (*link) (struct dentry *,struct inode *,struct dentry *);
Let's then look at the ext4 implementation of the link() operation:

    static int ext4_link(struct dentry *old_dentry,
           struct inode *dir, struct dentry *dentry)
    {
    ...
       if ((ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) &&
     (!projid_eq(EXT4_I(dir)->i_projid,
   EXT4_I(old_dentry->d_inode)->i_projid)))
  return -EXDEV;
    ....

In particular that calls EXT4_I():

    static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
    {
        return container_of(inode, struct ext4_inode_info, vfs_inode);
    }
Which is basically just direct unchecked pointer type conversion. So, calling ext4_link() on any non-ext4 created struct inode will blow up badly.
dezgeg··on Systemd by Example (2021)
> I need to change the mode of a wifi driver (which I do via modprobe)

Is that something that could be added to modprobe.conf to have it work right without any modprobe calls?

> Huh, onehsot services are listed as stopped even though they've run. Do some research, find out I need the `RemainAfterExit` keyword yet. Sure, dependencies are working.

Yeah I've also been burned not having RemainAfterExit=y in a oneshot unit. What's worse, such an unit can get started multiple times.

> Well looking around at dmesg it looks like the problem is that networkmanager is trying to do something with the device at the same time I am. Looks like it's enumerating device capabilities at the same time I'm trying to create a new device?

To be fair such race condition could have happened in any init system.

> Oh well, I'll just add the retry keyword to my service.

Perhaps having a dependency to start your service before network-manager would have solved this.

> Long story short I ended up just writing a traditional shell-script based init script. Maybe I'm thinking about systemd wrong or something.

It's perfectly fine IMO to have small shell script services for such stuff.

Probably some of the problems are due to network-manager being mostly designed/used for desktop use cases. It also likes to take complete control of all the interfaces so calling iw/ifconfig behind it's back will cause tears (as you found out).

I do agree that race conditions caused by parallel service startup really suck in embedded devices. Systemd really could use a "please be as deterministic as possible" mode for embedded (if it already doesn't have).

dezgeg··on Wind River Linux
The main problem of buildroot is the fact you need to rebuild from scratch all the time. Yocto has properly working incremental builds.

Yocto is definitely more flexible, which can be a curse as it gives architecture astronauts more chances to split up all the stuff it several repos and dozens of files.

dezgeg··on SQLite: Wal2 Mode
Even the mechanism predating WALv1 (rollback journal) uses two files. I don't think there is any way of using SQLite crash-proof with just a single file.

Besides, even if the database is single-file it's still necessary to use filesystem snapshotting for live backup, or it's likely to get an inconsistent copy.

dezgeg··on The mysterious second parameter to the x86 ENTER instruction
Yeah, I assume it's similar how ARM errata are often worked around - set some bit in an undocumented MSR to disable some microarchitectural optimization.

A silicon vendor I worked at called them CYA (Cover Your Ass) bits :)

dezgeg··on The Case for Memory Safe Roadmaps
Unbounded/large offsets are the critical part. Minimum unit where memory protection can be set is one page (4096 bytes on x86), so compiler could reasonably assume that offsets 0-4095 are always safe to dereference (in the sense that SIGSEGV is guaranteed, which can be then turned into a NullPointerException in the SIGSEGV signal handler) without a NULL check. For anything larger or array accesses, add a explicit check for NULL before dereference.
dezgeg··on The Case for Memory Safe Roadmaps
Try something like this with optimization on:

  int would_increment_overflow(int a) {
      if (a + 1 < a) {
          return -1;
      return 0;
  }
This gets turned to a function that always returns 0.

  0000000000000000 <would_increment_overflow>:
     0:   f3 0f 1e fa             endbr64
     4:   31 c0                   xor    %eax,%eax
     6:   c3                      retq
Using unsigned int gives the wrapping semantics.
dezgeg··on The Case for Memory Safe Roadmaps
In huge number of cases the null dereference is not from accessing 0x0 but some offset to it (ie. accessing a struct member or array element that's not the first one). Of course in practice most of the offsets are below the limit where nothing is ever mapped (on Linux vm.mmap_min_addr and seems 64k by default for me) but it's still very possible to have such dereference to not segfault in C. That should not be possible in Go/Java (if it is, it would almost certainly be considered a bug in the compiler/VM).
dezgeg··on The mysterious second parameter to the x86 ENTER instruction
I'd think it matters for the purposes of what behaviour can be changed by microcode updates, no?
dezgeg··on PC GEOS: the multitasking DOS-based GUI OS that evolved from a C64 desktop
It seems to be in several files, e.g. UI/uiDrawApplication.asm is 1000 lines of asm
dezgeg··on A Matter of Millimeters: The story of Qantas flight 32
https://fearoflanding.com/
dezgeg··on Linux: Ext4 data corruption in 6.1.64-1
Distros like Arch and NixOS use the vanilla kernel with very small amount (single digits) of patches on top. For the purposes of ext4, it's very likely to be as-is with vanilla. (I am counting the official linux-stable releases from kernel.org as 'vanilla' here.)
dezgeg··on Is RISC-V ready for HPC? Evaluating the 64-core Sophon SG2042 RISC-V CPU
Yeah, no. I have a bad feeling that fragmentation will become a mess in RISC-V world. Just few month ago Qualcomm threatened to not support the existing C extension and proposed their own 16-bit instruction set. Also another example of such mess from a sibling post by davidlt (https://news.ycombinator.com/item?id=38591977):

> SG2042 itself is T-HEAD C920 design which is a mess, and might not be even called a RISC-V compliant design. [...] There are other design issues discovered IIRC (atomic might not work properly [at least on the kernel side workarounds required]; floating point failures in glibc testsuite because FP not being compliant)

Guess what in the above T-HEAD C920 situation would be to best way to achieve "code once"? Add the workaround for the buggy instructions in the compiler and then recompile, with no changes.

dezgeg··on Tesla shares 48V architecture with other automakers
Ethernet is already used to transmit radio signal over fiber which requires extremely tight variation in latency (probably more strict than automotive).
dezgeg··on For processing strings, streams in C++ can be slow
fscanf() is also pretty slow because of thread safety so each call involves a mutex (which goes unused 99% of the time). I wonder do the new C++ libraries have faster non-threadsafe options?
dezgeg··on Unveiling secrets of the ESP32: creating an open-source MAC layer
I would guess most 32-bit microcontrollers and any SoCs capable of running Linux have some sort of boot ROM, at least for the flash programming mode (especially if it's over USB).
dezgeg··on Clang now makes binaries an original Pi B+ can't run
Doesn't really help when the VC firmware is loaded from the SD card anyways
dezgeg··on Is Ada safer than Rust?
Can't you segfault in Java via stuff in sun.misc.Unsafe?
dezgeg··on Hybrid beamforming receiver dynamic range theory to practice
I guess there the digital beamforming is enough for many use cases.
dezgeg··on Ask HN: Keep binaries in system memory never removed till manually done so
I think you could make a program to mmap() all the files you want and then call mlockall() and never exit.
dezgeg··on Raspberry Pi receives strategic investment from Arm
That's not what they meant. Yes, anybody can write bare metal alternative to Linux ( at the very least by looking at the Linux codebase). But still that Pi 1541 depends on the bootcode.bin, fixup.dat and start.elf binary blobs, which the OP was complaining about.
dezgeg··on C++23: Removing garbage collection support
What would be your solution with regard to iterator invalidation?
dezgeg··on Why ACPI?
That was the original dream for DT that so far hasn't been very successful.

In practice the kernel only wants to add support for DTs that conform to a reviewed and approved schema, but most/no manufacturer wants to do the effort of having every single thing on their DT schema bikeshedded to death on the device tree mailing list before the device is manufactured. So the vendor just makes up whatever kind of unapproved DT schema that only their own vendor kernel fork supports, and if mainline support is ever added it will have its own DT.

dezgeg··on Why ACPI?
Yes, DT is mainly meant to describe non-discoverable hw blocks inside the SoC and the chips soldered to the motherboard. Discoverable devices like PCIE cards or USB devices aren't added to DT (except under very rare circumstances)

Nowadays there is also an overlay mechanism that is used for example on the Raspberry Pi expansion hats, so DT is not always limited to soldered-on things.

dezgeg··on Not knowing the /proc file system
In practice signals don't seem to be a problem for (most?) proc files as the seq_file infrastructure doesn't bother to check for pending signals and terminate the read if so.

Naturally, only source reading will answer whether the proc file you're interested in is vulnerable to this or not.

dezgeg··on Not knowing the /proc file system
Because for some reason many C programmers still insist on 80-character line length limit and 8-wide tab indentation, so something has to give to fit all on the screen
dezgeg··on The risk of RISC-V: What's going on at SiFive?
I doubt many people would consider it easy. How many people running their stuff on EC2 would like to hear at some point that to upgrade the newest instance type you need to remake your VMs/containers?
dezgeg··on The risk of RISC-V: What's going on at SiFive?
Debian has already started compiling it, and even more will be by the time this new incompatible ISA would hit the shelves.

The time to 'get it right' has already passed IMO. If a hard ISA compatibility break happens at this stage, who is going to trust that it won't happen again?

dezgeg··on Google opens Falcon, a reliable low-latency hardware transport, to the ecosystem
eCPRI, or essentially radio signal over ethernet (ie. from base station indoors to radio module at top of the tower/roof) is another interesting use case (with even stricter latency requirements than audio).
dezgeg··on How I Made a Heap Overflow in Curl
Anybody using the standard embedded build solutions like Buildroot or Yocto will get Rust support without doing anything. It's already there and implemented.
← PreviousPage 6 of 14Next →