Live data from Hacker News

Xz: Can you spot the single character that disabled Linux landlock?

git.tukaani.org

71–80 of 322 posts

Re: Xz: Can you spot the single character that disabled Linux landlock?

#71
post #64

Earlier quoted context omitted.

I feel like my version control system is better about highlighting the changed characters than these solid green or red strings.

It's git, so it can show a vastly better diff, just not from a URL with hardcoded diff settings.

Yeah, but I’m wondering where the code review was done. In a different context, would this be easier to spot?

Re: Xz: Can you spot the single character that disabled Linux landlock?

#72
post #64
post #2

Answer: https://git.tukaani.org/?p=xz.git;a=commitdiff;h=f9cf4c05edd... Description of Linux's Landlock access control system if you are not familiar with it: https://docs.kernel.org/userspace-api/landlock.html xz official (maybe...) incident response page: https://tukaani.org/xz-backdoor/

I feel like my version control system is better about highlighting the changed characters than these solid green or red strings.

I don't love unified diffs as a rule either. They're very noisy to read in general.

A side by side in something like "meld" will highlight changes but also means you're reading the full context as it will exist in the code base.

My number one complaint about "code review" is the number of people who simply run their eyes over the diff (in private orgs) because management says "code review" and that's as far as they ever take that in terms of defining outcomes.

Re: Xz: Can you spot the single character that disabled Linux landlock?

#73
post #42

Earlier quoted context omitted.

Is this by design, or by legacy? I mean, is there a better way to do this? Seems really flawed to me.

It’s by “design”, in the sense that C and C++ provide no better way to really know for sure that the functions you want to call really exist. In more modern languages we rely on metadata and semver, but none of that exists for C and C++.

Hey, leave C++ out of this. This is a C problem.

https://en.cppreference.com/w/cpp/feature_test

Re: Xz: Can you spot the single character that disabled Linux landlock?

#74
post #2

Answer: https://git.tukaani.org/?p=xz.git;a=commitdiff;h=f9cf4c05edd... Description of Linux's Landlock access control system if you are not familiar with it: https://docs.kernel.org/userspace-api/landlock.html xz official (maybe...) incident response page: https://tukaani.org/xz-backdoor/

It seems like Lasse Collin is back on the scene and maybe pissed?

If he is innocent and a victim as much as everyone else in all this, I won't blame him for wanting blood.

Most of us are humans after all, and being social creatures we tend to take violations of trust quite deeply.

Re: Xz: Can you spot the single character that disabled Linux landlock?

#75
post #46

Earlier quoted context omitted.

Ah yes but thanks to C being cursed due to includes and macros this is harder to do

Huh, the code with a dot is not legal C. It is CMake issue that the test breaks here.

That’s what makes this so clever: these systems were born in the era where you couldn’t trust anything - compilers sometimes emitted buggy code, operating systems would claim to be Unix but had weird inconsistencies on everything from system calls to command line tool arguments, etc. - so they just try to compile a test script and if it fails assume that the feature isn’t supported. This is extremely easy to miss since the tool is working as it’s designed and since it’s running tons of stuff there’s a ton of noise to sort through to realize that something which failed was supposed to have worked.

Re: Xz: Can you spot the single character that disabled Linux landlock?

#76
post #67

Earlier quoted context omitted.

It’s by design. The job of autotools is to find “ground truth” about whatever environment you’re compiling against. It’s meant to discover if you can use a feature by actually seeing whether it works, not just by allow-listing a known set of compiler or library versions. This is because the whole point is to allow porting code to any environment where it’ll work , even on compilers you don’t know about. Think back to…

I don’t know. In my code I’d always compile and check at runtime?

Some of the checks are there to tell whether or not the compiler even supports your code. You may not be able to compile your code at all, and the job of the build system is sometimes to just emit useful errors to help the person building the code to understand that they need a compiler which supports [language feature X].

Again, this is intended to be portable software. It is designed to work on lots of OS’s, with lots of compilers, in a lot of future environments that don’t even exist yet.

If you have a security feature for example, which uses the pledge() syscall on OpenBSD, but you can only use that feature on OpenBSD systems, you have two choices:

- Conditionally compile it based on whether you’ve detected that this is an OpenBSD target at build time, or,

- Conditionally compile it based on whether some sample code that uses pledge() builds successfully.

You can’t defer this decision until runtime, because it would require linking to pledge() symbols even though they may not exist on this system, which would cause the executable to fail to link at runtime, unless you completely rearchitected to use a plugin model, which is overkill.

So given the above are your main two options, the latter is preferred mainly because it allows new systems to come in and be compatible with old ones (maybe someone adds pledge() support to Linux one day) without having to fudge the uname command or something. This was super important in the early Unix days… perhaps less so now, but it’s still a good way to write portable software that still can take advantage of platform-specific features.

Re: Xz: Can you spot the single character that disabled Linux landlock?

#77
post #67

Earlier quoted context omitted.

It’s by design. The job of autotools is to find “ground truth” about whatever environment you’re compiling against. It’s meant to discover if you can use a feature by actually seeing whether it works, not just by allow-listing a known set of compiler or library versions. This is because the whole point is to allow porting code to any environment where it’ll work , even on compilers you don’t know about. Think back to…

I don’t know. In my code I’d always compile and check at runtime?

You'll never make it to runtime if you try to include headers that don't exist. You'll never make it to runtime if you try to link in libraries that don't exist.

Re: Xz: Can you spot the single character that disabled Linux landlock?

#78
post #74

Earlier quoted context omitted.

It seems like Lasse Collin is back on the scene and maybe pissed?

If he is innocent and a victim as much as everyone else in all this, I won't blame him for wanting blood. Most of us are humans after all, and being social creatures we tend to take violations of trust quite deeply.

Truly seems that way currently. He said he'd really dig in starting next week and just checked his email on vacation and saw this whole mess.

Re: Xz: Can you spot the single character that disabled Linux landlock?

#79

I can't believe that system security is dependent on such a loose chain of correctness. Any number of things could have stopped this. + # A compile check is done here because some systems have + # linux/landlock.h, but do not have the syscalls defined + # in order to actually use Linux Landlock. Fix those headers on those systems to explicitly opt-out. What's the point of headers if they don't declare their capabilit…

You are quoting Jia Tan [1]. The malicious actor wrote that comment when deliberately breaking the check in the first place.

Fixing headers or extra tests would not have prevented this, as there is no indication the headers were broken in the first place, and extra tests could have been compromised (or ignored for release tarball) some other way.

[1] https://git.tukaani.org/?p=xz.git;a=commit;h=328c52da8a2bbb8...

Re: Xz: Can you spot the single character that disabled Linux landlock?

#80
post #74

Earlier quoted context omitted.

If he is innocent and a victim as much as everyone else in all this, I won't blame him for wanting blood. Most of us are humans after all, and being social creatures we tend to take violations of trust quite deeply.

Truly seems that way currently. He said he'd really dig in starting next week and just checked his email on vacation and saw this whole mess.

It may be hard for him to re-establish trust. Maintaining xz for more than a decade then doing this would be quite a "long con" but if HN threads are any indication, many will still be suspicious.

His commits on these links look legit to me. It's a sad situation for him if he wasn't involved.

Post reply on HN