Urgent.News

What's breaking now, across thousands of outlets.

Tech

Debugging Type-Based Alias Analysis optimizations in BPF

During a routine update to a BPF program, internal integration tests began failing due to packet drops. After some investigation, the issue was traced back to bad L3 checksums. The update involved switching to BTF generated vmlinux.h definitions instead of relying on specific kernel headers. It was discovered that the only change was an update to the Type of Service (ToS) field, which was immediately re-computed.

However, the checksum calculation required incrementally updating the checksum based on the difference between the old and new 16-bit words.

Upon further inspection, it was found that the code was not re-calculating the ToS value after writing the new value to the IP header. Instead, it was simply assigning the old value to the new one. This suggests that the issue might be due to Clang's Strict Aliasing Rules. Since uint16_t * and struct iphdr * are different types, Clang assumes that modifying iph- tos does not affect the memory referenced by ((uint16_t *)iph).

As a result, Clang aggressively optimizes away the second memory read and reuses the cached value of the old ToS value.

To verify this, the -fno-strict-aliasing flag was passed to Clang when compiling, which disabled these optimizations and allowed the correct L3 checksum to be recomputed. However, the team did not want to turn off all optimizations as some were useful. Instead, they used READ_ONCE, a wrapper around the barrier macro, to tell the compiler to reread the memory.

The investigation revealed that the issue was related to LLVM's Alias Analysis. The difference between the original and CO-RE generated versions of the struct iphdr led to incorrect alias analysis, causing the compiler to optimize away the necessary memory read. By using the llvm.bpf.preserve.struct.access.index intrinsic function, the alias analysis correctly identified the offset overlap, ensuring the checksum was recalculated accurately.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at loshz.com →

More in Tech

7 Common Flow Designer Challenges in ServiceNow and How to Handle Them

Introduction: Flow Designer is one of the easiest ways to build workflow automation in ServiceNow without writing everything as custom code.

  • Separate complex logic into subflows or reusable custom actions
  • Verify data types when using data pills in Flow Designer
  • Minimize unnecessary record lookups, especially within loops

A Delivery Label Is Not a Fulfillment Model

Digital products are often sold with one short promise: instant delivery . That label is convenient until the product behind it changes.

  • Digital products promise instant delivery but can have changing underlying processes
  • Order management requires separating offer details, current state, and fulfillment workflow
  • Structured fulfillment types enable accurate buyer communication and operational flexibility

Prevention Over Reporting: What Scrum Can Learn From Linters

Linters catch mistakes the moment you make them. Most agile tools wait until after the sprint to tell you. Introduction Your sprint failed three days ago, and the tool knew it the whole time.

  • Linters act as preventing tools, catching errors instantly
  • Scrum often only notices issues during sprint reviews
  • Implementing linter-like principles shifts Scrum to proactive stance

Read any BetterStack status page as JSON

Status pages are built for humans: a page per vendor, each with its own markup. If you want the same data as JSON — which components exist, what state each one is in, when it last changed — you end up…

  • BetterStack status pages offer JSON data format
  • BetterStack Status Page Scraper simplifies JSON extraction
  • Scraper returns consistent dataset across methods

More from Sunday 30 August →