HNHacker News
TopNewBestAskShowJobs

gens

503 karma · joined April 2, 2016

submissionscomments
gens··on Pwn2Own Vancouver 2019: Tesla, VMWare, Microsoft, and more
I was reading the LKML(linux kernel mailing list) back when some.. people were pushing DBus (a message transport protocol) into the kernel (in a slightly different form, as kdbus). Main reasons were performance (dbus sucks there) and.. i think security or something. Many comments in and the main reasoning for the performance improvement (of moving it into the kernel) was context switching (going from a userspace program into the kernel and/or back). At least two senior RedHat engineers, the top kernel maintainer, and a bunch of other engineers. Out of all of them NOBODY bothered to check out why dbus is slow. Until Linus himself ran a simple test and found that the user-space dbus daemon is not optimized at all. Context switches were something like 1% of the actual performance cost. Well.. saying that nobody bothered to check is just my wishful thinking, thinking that it is incompetence or just them just being jaded by fancy technology rather then malice (there's more to the story).

Anyway. One of the mails was an infotainment engineer at some car company. Before that I, for some reason, thought that such a big and serious industry is very serious when it comes to software. But right then it clicked that car software makers are just as any other software writers (maybe a bit more serious). This was before two hackers hacked a Toyota. And later a Range Rover (or something) over bluetooth. Bout those companies are much older and much more serious then Tesla, and probably have plenty of world class coders at their disposal.

As for the first part of what I wrote above (that i forgot by now). Teslas are not the first commercially viable electric car. They may be among the first to have nice range (over 300km). And Teslas are not the most affordable, that goes to the Nissan Leaf (2017 and above). Granted the Nissan is not a big car, closer to a Clio.

On another though, they could just hire a security company to do a deep audit. Maybe they have. Maybe that's why they are incentivizing crackers. I do not and probably can not know.

edited for readability

EDIT: I'd maybe trust Rolls Royce. But i don't have money for that so it doesn't matter.

gens··on Pwn2Own Vancouver 2019: Tesla, VMWare, Microsoft, and more
What about Nissan?

That aside, i don't trust any car maker to make good software. Especially infotainment. Especially if it has bluetooth/wifi. And especially if there's internet involved. Let's just say i'm holding back words here.

Grand majority of software development is not very strict on best security practices. But a two ton object that can easily move at speeds over 100kmh demands insane security measures. That's my opinion, at least. I know people will sooner buy a car with spotify. And i know people won't just hack other peoples cars and make them crash. But still, it weights two tons and moves at two hundred kilometers per hour.

As a side note; someone else wrote how Teslas are advanced in terms of computer technology then other cars and how many computers they have in their cars. Lots of other cars have a ton of computers in them. It's nothing new.

gens··on An Explanation of the Rendering Equation [video]
I learned it from a paper "Spherical Harmonic Lighting: The Gritty Details" (link below), where the author uses a different form of the equation.

I like the 3D in this one.

http://silviojemma.com/public/papers/lighting/spherical-harm...

gens··on Ubuntu 17.10 corrupting BIOS of many Lenovo laptop models
It's all during boot or shutdown...

>I like how people somehow breathlessly say "systemd developers prove they don't know shit, of course its their fault!!!" and then immediately follow it up with a bunch of fairly basic questions and just admit "oh by the way i don't know what i'm talking about, can anyone tell me otherwise???"

I like how stating to a bunch of people who don't know anything about you that you are not all knowledgeable, and asking questions to better inform yourself and to put things into perspective (for everyone involved) is looked at as a weakness/sign of ignorance.

For the record i know a lot about how computers, and linux, work. From the basic transistors and gates, to high level programming constructs. It's just that this particular topic does not interest me, nor will knowing it help me in any way, shape, or form in my life.

As for "systemd developers prove they don't know shit, of course its their fault!!!". It is. Shit has happened and their response was "Not my problem"... numerous times. If the people that declared themselves "the grand arch-mages of.. everything", and are forcing their "arch-mag-iness" as "the standard of all and forever", then they are responsible for the problems of "everything". As they say "with great power comes great force times distance over time", or something like that.

gens··on Ubuntu 17.10 corrupting BIOS of many Lenovo laptop models
>Yes, except that none of the tools in question have any support for doing that and so mounting the filesystem read-only rather than read/write would break them.

All 4 of the tools (that can even be wrapped in a shell script until they are, as systemd devs say, "fixed").

>And congratulations, now you've still got a window where something can still break everything while the filesystem is mounted read/write (what happens if the tool crashes during that phase?).

Better to open a window in the morning then to tear down the whole wall forever.

gens··on Ubuntu 17.10 corrupting BIOS of many Lenovo laptop models
So read/write efi is needed to set what happens when the computer boots and to see what state it was/is (relating to boot stuff).

To see the state you don't need write permission, obviously.

When things are set, they are set by a few very specialized tools.

Those are the facts everybody can agree on, right ? Can we also agree that mounting and unmounting the efi filesystem is really easy ? I assume it can be mounted on multiple points.

So is there a problem in re/mounting it read/write only when needed ?

>At the time this issue was raised, nobody knew shit. We had no idea that removing certain variables might prevent a machine from booting. If we had done, I'd have written the filesystem differently.

That's the difference between systemd devs and people capable of critical thinking. You'r a good programmer, if you ask me. (edit: just to be clear, i don't see you as a systemd dev; even if you are (idk), you are not the one making high level design decisions (of which this is, kind of, one))

gens··on Ubuntu 17.10 corrupting BIOS of many Lenovo laptop models
What userland is it ? And why is it a problem for that userland to mount it itself ?

Why would you even write to efi ? Maybe at boot, i don't know, but certainly not while running ? Not all the time ? Oh i hope there isn't a single program that continuously writes to efi.

In my opinion systemd is at fault, as they aim to be the "system" and yet every once in a while prove that they don't know shit.

EDIT: A program that changes the boot order is all i can think of. (I'm not the one who knows best, on this topic)

gens··on It’s time to kill the web app
Not as secure, but nowhere near the death traps as some(many?) describe them.

Things that are written in C these days are usually written in C for performance reasons. FFMPEG would not have even close to the performance it has if it was written in a memory safe language instead of C and assembly. I doubt that a magical compiler (and/or language) will appear in my lifetime that can compile high level code into performant machine code, especially when it comes to memory management. (note that C also has advantages other then performance)

JS doesn't even have a proper specification, let alone a bug-free interpreter/compiler.

EDIT: AFAIK verifying memory access is part of a formal verification, where memory is also modeled mathematically.

gens··on Fresh IDE
amd64 is just an extension on x86. I took the (64bit) syscalls from a kernel header, that i can't find now, so you can take from that header you found.

C calling convention for x86 is to push everything on the stack (and use call, that is short for "push instruction pointer and jmp", ret being the reverse), while the linux kernel uses a variant of fastcall (aka put stuff in registers (then use int 80)).

When i was learning i found a lot of x86 examples and tutorials (and a book, can't remember the name (is free)), and not much on amd64.

Just play with it, it'l get easy when you go over the wall.

With "normal" C calling convention you have to care about the stack pointer (esp) (i think it's the callee's responsibility (of the called function)), maybe even the bottom pointer (ebp) (i remember the wikipedia page on calling conventions explains it). The other difference between x86 and amd64 is floating point math, where sse is the default on amd64 and x87 on x86 (x87 works on stacks of numbers, the reverse-polish using a stack way IIRC).

Useful tools are: objdump -d ("-M intel" for the intel notation), strace to trace system calls, and fdbg since GDB can't make sense of a valid ELF file. You can also join the flat assembler and/or nasm forums. I like fasm better then nasm for no strong reason, but nasm is a bit easier.

glhf

gens··on It’s time to kill the web app
> Programs in the 90s were written in C and C++. C is impossible to secure. C++ is impossible to secure.

Back then the compilers sucked. They would take complete crap of code and still it would work. They were like browsers are today. (from my experience from going through one old MUD code)

Today the song is different. Not only will the compilers warn you of many things, there's even tools for static analysis (and dynamic). So the argument that C (and even the more complex C++) is inherently insecure holds much less weight (just go run old code through a static analyzer, or a normal compiler for that matter).

That said there's only one way to write a "secure program", and that is formal verification.

People that talk with a serious tone should back up their claims, at least that's my opinion.

gens··on Fresh IDE
The official fasm tar comes with a few hello world examples. One shows you how to say hello with libc, other with the kernel (then there's x86 and amd64 versions of bout).

http://chamilo2.grenet.fr/inp/courses/ENSIMAG3MM1LDB/documen... is the official spec for the amd64 calling convention (aka ABI) on unices. http://www.logix.cz/michal/devel/amd64-regs/ is a nice table showing what goes in what register (still amd64) when calling a C library or the kernel. X86 library calling convention is just putting everything on the stack, while the kernel convention.. i don't remember (int 80 and syscall in eax, but arguments..). There's a syscall table https://filippo.io/linux-syscall-table/ and i made a fasm to include https://pastebin.com/nnrMVF8u (amd64; i made from the kernel source headers, that i can't find now).

That's about all there is linux specific.

gens··on As Electric Motors Impove, More Things Are Being Electrified
> In recent years, motors have started to be designed for the non sinusoidal waveforms that come out of chopper power supplies.

From what i remember, square waves are better for a motor. Thinking about it i see no benefit of it being sine (*with many poles, that is, as a square would shake the mechanical parts too much otherwise).

The trams here have 3-phase engines.

gens··on Some Were Meant for C: The Endurance of an Unmanageable Language [pdf]
No, he did not. Not as far as i remember.

I am not British, and i did want to dramatize it a bit. In my defense, words are to convey meaning as much as to describe action. (you don't literally "beat a dead horse" or "fart in your general direction")

EDIT: In bluejekyll's defense, we here are a bit chafed (hehe) by extreme fans of certain programming languages (IMO even some functional programming fans get a tad too.. unrealistic in their talks)

gens··on Some Were Meant for C: The Endurance of an Unmanageable Language [pdf]
I don't know why it is not common knowledge that different people have different priorities, different ways of thinking about things and, well, that they are different. Not only that but people can even have opinions that contradict their other opinions. I write C, its powerful and that it stays out of the way. I also like assembly for the same reasons. But i also like scheme, that is the most opposite language to C that i know of.

Another reason i like these three languages in particular is that they are simple. There are no added features that would make me look them up, if, for example, i was reading somebody elses code or if i didn't code in a few months.

I like my data to be laid out how i want it and process it how i want it. You can say "but rust lets you do it with this", when in C i "just do it".

The whole memory safety argument is.. i want to say "fine" as people do make mistakes, but tools like static analyzers (aka linters) and valgrind exist.

As for the higher social aspect;

> I don't "tell" people, what language to use.

But you do. If you say to a newbie that their C project is "bad" because it is written in C, be it directly or indirectly, they will take it as if you are telling them to use another language (and when you say that that language is Rust, then.. well..). When the truth is that programming languages don't matter in most cases.

> But I do encourage them to look at new languages, especially ones that fit in the same place as one that they like.

I couldn't agree more, with the first part at least. I like imperative programming more then pure functional, but i did learn a lot by programming functionally in scheme (and by playing with some other languages that i will never use), and now the C that i write is better for it. edit: assembly is a good example of a language to learn just for the sake of knowing it.

Let us mention that learning abstract theory things also influences how we write things in a specific language. Things like the million forms of data structures and various.. ways of doing things (graph theory (that is surprisingly relevant to concurrency), touring machines vs lamda calculus, various ways of sharing state between parts of code, and.. i can't think of more now). In addition to that, how a computer works can also shape how we program. We have limitations, for example it is very important for performance to not trash the cpu cache all the time.

Now to go back to "reality"; Software is (usually) written to be used. Things that matter are what it does and its cpu/memory usage. For a program that is used to, idk, process some text once a month it doesn't matter what it is written in. But if the program is to be used daily on thousands of computers it starts to be more important that it performs well. That is my opinion at least, as the general opinion seems to be "modern computers have so much processing power and gigabytes of memory". Personally it pisses me of when a vital part of a system is hacked together so it "works", where examples are Glib usage in NetworkManager (and many others), and python (i rewrote phwmon in C because it uses too much memory and cpu, maybe some day i'l clean it and post it on github). If something is vital for day-to-day usage of a computer, then it better well not use hundreds of megabytes of memory and 100 times more cpu then it should (note that 100 times more cpu usage for many "system" things is still a tiny amount, but regardless). To paraphrase a quote that i can't find anymore "the best daemon/program is one that does its job but you don't know it is running", where an example would be dhcpcd (currently uses 196kB of memory and it used a total of 0.05 seconds of a cpu core (klogd is even better with 80kB of memory and 0.02sec cpu time)).

Then there are domain specific languages..

EDIT: I would also like to add that as much as we are different from each other, we are also much the same. And that we can change the ways we think, for better or worse (not that anything is either black or white).

gens··on Some Were Meant for C: The Endurance of an Unmanageable Language [pdf]
I don't like to be told what programming language i should use. You can scoff all you want, but i will be using C for most of my projects.
gens··on Hey Synaptics, Can You Please Stop Polling
And some Fedora developers want to bring this kind of shit to linux.
gens··on Comparing C and C++ usage and performance with a real world project
> .. which is written in plain C using GLib ..

That's about as "C" as C++ is. Why not Gneural or libpng or even GNU make ?

http://git.savannah.gnu.org/cgit/gneuralnetwork.git https://github.com/glennrp/libpng http://git.savannah.gnu.org/cgit/make.git/tree/

gens··on “Holy Grail” Bugs in Emulation, Part 2
Interesting talk: "The Ultimate Game Boy Talk" at CCC https://media.ccc.de/v/33c3-8029-the_ultimate_game_boy_talk
gens··on Erlang Garbage Collection Details and Why It Matters
> awk, bc not production level languages. I think you're being disingenuous there.

First of all, we are talking about programming languages here, not about how widely they are used in "production". I know that awk is used in one giant company to do an important thing (aka dealing with money). It wouldn't surprise me to find that bc is also used in "the industry".

On that note, the TIOBE index lists Java, C, C++ and C# as being the most widely used languages. Awk is number 33, just below Ada, Prolog and Erlang. Rust is not even on the list, a list where assembly of all things holds the 14'th place. (bc is in the same group as rust there)

Erlang is also used for plenty of "heavy" things, notably in the telecommunication and banking industries. Haskell is used by facebook for their spam filter. WhatsUp is written in erlang. https://www.youtube.com/watch?v=LnX3B9oaKzw

> If you know anything about both languages that's at the top of their features list, which I mentioned.

Not everything is about "features".

> If concurrency units (threads, co-routines) share a heap they are not memory safe.

If you want to talk about concurrency you should mention "Communicating sequential processes", where from Rust did take some wisdom, but Go (as a popular example) went full in. Functional programming (lamda calculus) also lends itself extremely well to "threading", intrinsically so.

I think that discussions are about learning things, clarifying things and such "nonsense". But this discussion seems to be all about "winning at any cost". So.. goodbye.

gens··on Erlang Garbage Collection Details and Why It Matters
I also mentioned FORTRAN.

A 10min investigation would bring fruit to your curiosity. But wth..

Lisp, scheme, closure, modula and smalltalk are the ones that come to my mind now that offer ONLY safe data access (modula3 has "unsafe" keyword, but only when talking to outside code). Actually R, awk, bc, shell and such are also like that, but not really general purpose. Languages that are "memory safe" by default, but include "unsafe" memory access (that come to my mind now) are C#, F#, C++ and such (Rust goes into this "category").

All functional languages are, AFAIK, "memory safe" by default (well.. you could make a functional language that lets you go out of bounds, but that wouldn't be a "pure" functional language).

In fact, as far as i know, there are more programming languages that ARE "memory safe" then ones that are not. One could just go over the wikipedia list [0] and.. list them out.

[0] https://en.wikipedia.org/wiki/List_of_programming_languages

While somewhat on the topic of functional vs "Turing" languages, here's a couple of videos. https://www.youtube.com/watch?v=eis11j_iGMs https://www.youtube.com/watch?v=RPQD7-AOjMI

So.. the only thing that prompted you to talk about Rust is memory safety ?

EDIT:

> Why bring syntax as the first thing? What does that have todo with memory safety.

Because the question i asked was "Can i ask why do you mention rust ? By that i mean what prompted you to write about rust here and now." and your answer was (paraphrased) "they bout emphasize memory safety", as if that was the only defining factor of a programming language.

gens··on Erlang Garbage Collection Details and Why It Matters
If i went into every thread about rust and mentioned how Ada is great (or any other language, including C), id' get downvoted. Why is that ? "Hyper-sensitivity" ?
gens··on Erlang Garbage Collection Details and Why It Matters
It is COMPLETELY different from rust. Not only in the syntax, but also in the things it does and how it does them.

http://learnyousomeerlang.com/content

A lot of languages "emphasize safety at the top of their feature lists". By a lot i mean A LOT. If you have to compare, Erlang is similar to Haskell. Rust is nothing like erlang.

gens··on Erlang Garbage Collection Details and Why It Matters
Erlang is completely different then rust (or C, Ada, FORTRAN).

Why, on a topic about (an amazing language that is) erlang would you talk about other languages. Especially when they are nothing like erlang.

gens··on Erlang Garbage Collection Details and Why It Matters
Can i ask why do you mention rust ? By that i mean what prompted you to write about rust here and now.
gens··on Water Found Deep Inside the Moon
The biggest problem is getting into orbit.

https://api.media.ccc.de/v/31c3_-_6180_-_en_-_saal_2_-_20141... Around 19'th minute.

Then again, Mars is far so it would take some time to get there. Then again again, most of the ships wouldn't have to have people aboard. Edit: It helps that Mars has an atmosphere of sorts.

gens··on Ask HN: What is your favorite CS paper?
"Communicating Sequential Processes" by Tony Hoare

http://www.usingcsp.com/

I read it multiple times and still don't quite understand it all.

There are more great papers i read but this one comes back to mind more often then others.

gens··on A straight talk about btrfs
Most of the things by freedesktop.org in the last.. idk 5-10 years. Console-kit/logind, AppData, dbus being used for the lower parts of user-space, and probably many more that i don't recall now. Oh, and pulseaudio.

EDIT: How could i forget polkit.

gens··on A straight talk about btrfs
Linux has lately gotten a lot of bad standards.
gens··on Writing parsers like it is 2017
I would like to apologize for calling people idiots. It is not a nice thing to say.
gens··on Writing parsers like it is 2017
You did not address the actual points i made.

>Ragel is still better then a generic programming language for writing parsers, by a long shot.

>That said, THIS ARTICLE DOES NOT SAY ANYTHING ABOUT HOW TO ACTUALLY WRITE A PARSER !

And, if i can dare to comment on your statement..

>As for simplicity leading to security, this isn't a supported argument. But as for encoding semantic security issues into your program (security issues outside of memory safety), I would argue a strong type system is the right way to go here, something Rust certainly provides.

This is, for one, a bastardization of what i stated, that was that a DOMAIN SPECIFIC LANGUAGE IS (usually) BETTER FOR A DOMAIN THAT IT IS SPECIFIC TOO THEN A LANGUAGE THAT IT IS NOT SPECIFIC TO THAT DOMAIN. This is particularly evident in parsing, and to say otherwise is dishonest.

As for simplicity being related to security, that should also be self evident. If not from common sense, then from examples of more complex (needlessly complex or otherwise) programs having more faults (on average).

>blah blah blah, literally just vapor at this point, not worth addressing.

Your post is exactly what a fanboy would write. A post that goes point by point, "bashing" them for being "wrong", "imprecise", or "not strong enough of an argument", all the while ignoring the actual "meat" of the argument (the meat being that A LANGUAGE FOR WRITING PARSERS IS BETTER FOR WRITING PARSERS THEN A GENERIC LANGUAGE). It is the equivalent of "link plz" (meaning "scientific paper of GTFO", as if actually using your own brain is a bad thing). In short, you sir are a fanboy.

← PreviousPage 3 of 10Next →