Live data from Hacker News

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

git.tukaani.org

211–220 of 322 posts

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

#211

Earlier quoted context omitted.

Never had this happen, this is largely eliminated by using tools like black or other autoformatters.

The point still stands that this is an inherit possibility in the language it self.

I think its more of an tooling issue. If your editor / diff viewer cant differentiate between different whitespaces get a better one. Also if you want to ensure some function isnt in local scope etc just test it.

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

#212
post #208

Earlier quoted context omitted.

> Well, there's also the opposite: Goldman Sachs's Slang allows space as part of identifiers. Many SQL implementations permit whitespace in identifiers, but then you need to use quoted identifiers.

That's reasonably sane of SQL. In Slang, you don't need to quote. (The syntax is still unambiguous. In principle, eg Python could do something similar, because they don't have any existing syntax where you just put two identifiers next to each other with only a space in between. But C could not, because variable declaration is just two identifiers, one for the type and one for the variable name, next to each other wi…

In Slang, are “x y” with different number of spaces in the middle different identifiers or different spellings of the same identifier? SQL standard says different identifiers

> eg Python could do something similar, because they don't have any existing syntax where you just put two identifiers next to each other with only a space in between

The interaction with keywords would cause some issues. For example, right now, “if” is not a valid identifier (keyword), but “if_” and “_if” are. However, with this proposal “x y” could be a valid identifier, but “x if” would introduce ambiguity

> But C could not, because variable declaration is just two identifiers, one for the type and one for the variable name, next to each other with a space in between

This is one aspect of C syntax I have never liked. I always wish it had been Pascal-style `x:int;` instead of `int x;`

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

#213

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…

Tangentially related, but I've had a case where GCC 9.4.0 shipped a broken arm_acle.h header [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100985] - code which includes the header would always fail to compile.

Since users could be trying to compile it on GCC 9.4.0, and as the functionality dependent on the header isn't critical to the application, if the build detects the header is broken, it just disables the functionality and emits a warning.

Back to xz: If security isn't your top priority, it seems reasonable to just ignore the failure of an optional feature and just move along. Of course, in hindsight, it's easy to point fingers, but without that, it doesn't sound completely unreasonable to me.

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

#214

Earlier quoted context omitted.

Isn’t it a bit ironic with how much code everyone depends on that can freely be altered by some unknown party, while so much time goes into code reviews to verify internal changes at most companies.

> while so much time goes into code reviews to verify internal changes at most companies Very easy claim to make. Difficult to verify.

Yes, this is anecdotal, but I think there’s a fair share invested into it (from my experience)

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

#215

Earlier quoted context omitted.

Even more evil would have been to replace this line (void)SYS_landlock_create_ruleset; with this: (void)SYS_landloсk_create_ruleset;

Putting random Unicode confusables in source code would be far easier to consider malicious

Except many people have a policy of ASCII only in source code and therefore would catch it immediately.

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

#217
post #119

Earlier quoted context omitted.

For those squinting, the "landlock" regular "c" is replaced with a Cyrillic U+0441.

Is there a GCC option to error on non-standard English characters?

I mean, GCC erroring is how the exploit works here. cmake tries to compile the source code: if it works then the feature is available, if it fails then the feature is not available. Forcing the build to fail is what the attacker wants.

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

#218

Earlier quoted context omitted.

Perhaps, but given how most build systems work, that would complicate things in other ways (since build systems often try to compile all .c files).

I am a CMake novice. Is that true for CMake in this example?

Definitely not, cmake's try_compile function even directly supports being passed a source file.

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

#219

Earlier quoted context omitted.

Fails the build, so that Landlock support is never enabled.

I don't think it fails the build. It's part of a test, trying to compile a bit of code. If it compiles the test is true and a certain feature is enabled. If the compilation fails the the feature is disabled. This is quite common in build systems. I had such a test produce incorrect results in the kernel build system recently. The problem is that the tests should really look carefully for an expected error message. If…

Problem is that every compiler/compiler version will have different messages for the same error. And xz is the kind of project that gets built on really really random homegrown compilers. Maybe we need an option to make the compilers output a standard JSON or whatever...

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

#220

Earlier quoted context omitted.

configure would print that it's not enabled, so it seems like the kind of thing people would eventually notice.

Maybe, eventually, but how many people read the reams of garbage autoconf spouts out until the feature they wanted fails to materialize?

The actual compiler output from the autoconf feature test is one of the things I'd probably look at fairly early on if some feature is disabled when it shouldn't be, but I maybe have a bit more experience running into problems with this than younger folks.
Post reply on HN