News for hackers. Stuff that matters.
Re:Let's Embed a Go Program into the Linux Kernel by ranger_danger on Saturday April 27, 2024 @09:10PM (#40185093)
Malware writers would love to do this.
Re:Let's Embed a Go Program into the Linux Kernel by throwing_away on Saturday April 27, 2024 @10:56PM (#40185638)
I used to think these kind of comments were harmless and I normally ignore them.

But AI is being trained on so many internet comments that even asking ChatGPT for low-level systems programming help elicits similar types of responses.

Frustrating.

Re:Let's Embed a Go Program into the Linux Kernel by szundi on Sunday April 28, 2024 @03:11AM (#40186659)
Hard to make it recognize sarcasm. For the reason why half the time it is not even sarcasm.
Re:Let's Embed a Go Program into the Linux Kernel by daghamm on Sunday April 28, 2024 @08:05AM (#40187987)
Is it really our problem that AI companies harvest forums for data they have no ownership of?
Re:Let's Embed a Go Program into the Linux Kernel by bigfishrunning on Sunday April 28, 2024 @09:06AM (#40188303)
Asking chatgpt for low-level systems programming in the first place is problematic. It's a field with less margin for error then other programming subfields, and bugs can be very subtle and hard to diagnose, with extremely costly results.

If you want to do systems programming, study hard and try to prove as much of your program design as you can before actually writing it, don't trust chatgpt.

Re:Let's Embed a Go Program into the Linux Kernel by 8372049 on Saturday April 27, 2024 @11:44PM (#40185814)
Malware writers love code that is inconspicuous, generic, hard to attribute and hard to reverse.

As far as I can tell, this doesn't check any of those boxes.

Re:Let's Embed a Go Program into the Linux Kernel by yjftsjthsd-h on Saturday April 27, 2024 @11:12PM (#40185714)
Malware writers who are compiling a kernel and have the power to install and execute it? When would that be useful?
Re:Let's Embed a Go Program into the Linux Kernel by j_m_b on Sunday April 28, 2024 @12:46AM (#40186081)
Yah I am not following the parent comment, either. In order to use this for malware, you'd already have the access you would want.

Otherwise this would need to make it into the main branch of Linux. That isn't going to happen. Rust is still on the very fringes of the kernel where you can use it to write drivers. No way they will replace anything with Go.

It's a neat hack, but it's not something that is exploitable.

Re:Let's Embed a Go Program into the Linux Kernel by superb_dev on Saturday April 27, 2024 @09:39PM (#40185262)
Would they? The Go process is still running in userspace, and required already having kernel access to start it
Re:Let's Embed a Go Program into the Linux Kernel by panzi on Saturday April 27, 2024 @09:40PM (#40185267)
You can also use objcopy to generate a object file from a resource file.
Re:Let's Embed a Go Program into the Linux Kernel by slowhadoken on Saturday April 27, 2024 @11:55PM (#40185857)
Is it a good idea to embed a proprietary language into a open source os?
Re:Let's Embed a Go Program into the Linux Kernel by eurleif on Saturday April 27, 2024 @11:59PM (#40185873)
Proprietary? Go is under the BSD license.
Re:Let's Embed a Go Program into the Linux Kernel by JetSetIlly on Sunday April 28, 2024 @04:01AM (#40186888)
Yes. The Go implementation from Google is under the BSD licence.

There's also the GNU implementation in GCC that's under the GNU GPL 3 licence. Moreover, the specification itself doesn't seem to have any licencing requirements at all.

So you're absolutely right: Go is the very opposite of proprietary.

Re:Let's Embed a Go Program into the Linux Kernel by neonsunset on Sunday April 28, 2024 @06:14AM (#40187442)
In the same way .NET is proprietary under MIT license.

Welcome to the club :)

Re:Let's Embed a Go Program into the Linux Kernel by slowhadoken on Sunday April 28, 2024 @03:25PM (#40191111)
Golang is trademarked by Google. It’s a corporate faux open source project. FAANG is co-opting free labor. Even open source platforms like GitHub are a wolf in sheep’s clothing. What Microsoft or Google can’t defeat they acquire.
Re:Let's Embed a Go Program into the Linux Kernel by eurleif on Sunday April 28, 2024 @04:32PM (#40191565)
FOSSmarks (hosted by FSF, and writers include people affiliated with FSF)[0]:

>Trademarks and FOSS are not incompatible; instead, trademarks are legal tools strongly aligned with FOSS principles. A trademark is an assurance that the recipient of the goods or services is receiving a product of known source and qualities. Controlling how a FOSS project trademark is used protects the community and its software, by preventing use of the trademark in ways that are harmful to the reputation of the community or the software.

Linux is a registered trademark of Linus Torvalds[1]. GNU is a registered trademark of the FSF[2]. Your definition of "proprietary" isn't shared by virtually anyone, and would make virtually everything "faux open source", including the "open source os" project you originally worried about Go being integrated into.

[0] https://static.fsf.org/nosvn/licensing/2020/FOSSmarksv2.pdf

[1] https://tsdr.uspto.gov/#caseNumber=74560867&caseSearchType=U...

[2] https://tsdr.uspto.gov/#caseNumber=85380218&caseSearchType=U...

Re:Let's Embed a Go Program into the Linux Kernel by slowhadoken on Monday April 29, 2024 @12:03AM (#40194285)
Meredith Whittaker and Elon Musk share similar opinions as me on the subject. I assume you’re a captain of industry?
Re:Let's Embed a Go Program into the Linux Kernel by pjmlp on Sunday April 28, 2024 @02:28AM (#40186465)
The C language requires paying a 216 CHF by anyone that actually wants to understand how the language works, and not how their compiler deals with the source.

Plenty of times they aren't the same.

https://www.iso.org/standard/74528.html

Re:Let's Embed a Go Program into the Linux Kernel by PhilipRoman on Sunday April 28, 2024 @02:39AM (#40186515)
That's not really fair, the working drafts are freely available and (if you take the latest one before official standardization) are the same as the official releases. https://port70.net/~nsz/c/c23/n3220.pdf

To be honest, I've never met a single professional who actually bought any IEEE or ISO standard.

Re:Let's Embed a Go Program into the Linux Kernel by pjmlp on Sunday April 28, 2024 @02:42AM (#40186532)
They are drafts for a reason.

Plus who seats at WG14 table?

Big corporations selling compilers and OSes.

Re:Let's Embed a Go Program into the Linux Kernel by jimjimjim on Sunday April 28, 2024 @05:55AM (#40187366)
Hi. I've paid for access to ISO standards for PDF related work.
Re:Let's Embed a Go Program into the Linux Kernel by nicce on Sunday April 28, 2024 @09:24AM (#40188410)
But are you professional in their eyes? :’D
Re:Let's Embed a Go Program into the Linux Kernel by eru on Sunday April 28, 2024 @03:21AM (#40186707)
> The C language requires paying a 216 CHF by anyone that actually wants to understand how the language works, and not how their compiler deals with the source.

The binary you are actually executing is made with your compiler, not with the standard; which is just a static human readable document after all.

Though I'm not sure what your point is.

Re:Let's Embed a Go Program into the Linux Kernel by pjmlp on Sunday April 28, 2024 @05:12AM (#40187176)
How did that compiler sprung into existence, magic digital pixie dust?
Re:Let's Embed a Go Program into the Linux Kernel by eru on Sunday April 28, 2024 @06:25AM (#40187472)
You know that especially for C, compilers predate the language spec?
Re:Let's Embed a Go Program into the Linux Kernel by pjmlp on Sunday April 28, 2024 @10:28AM (#40188835)
Ever heard of a book called K&R C, and another book called The Annotated Reference of UNIX, aka Lion's Book?

Also lots of AT&T and Bell Labs money poured into employees salaries.

Re:Let's Embed a Go Program into the Linux Kernel by eru on Sunday April 28, 2024 @11:04PM (#40193992)
What about that book? K&R C is more of an introduction and perhaps a manual. It ain't a spec.

And that book was very much written to describe existing implementation(s) of C.

Re:Let's Embed a Go Program into the Linux Kernel by exe34 on Sunday April 28, 2024 @05:50AM (#40187339)
No, somebody wrote it.
Re:Let's Embed a Go Program into the Linux Kernel by eru on Sunday April 28, 2024 @06:25AM (#40187475)
Yes, indeed.

What a strange question..

Re:Let's Embed a Go Program into the Linux Kernel by abenga on Sunday April 28, 2024 @05:56AM (#40187369)
How is Go proprietary?
Re:Let's Embed a Go Program into the Linux Kernel by drycabinet on Sunday April 28, 2024 @12:01AM (#40185878)
Might sound surprising until you remember there used to be Lisp Machines.
Re:Let's Embed a Go Program into the Linux Kernel by dwattttt on Sunday April 28, 2024 @12:40AM (#40186061)
I was really hoping it would be executing Go in kernel.
Re:Let's Embed a Go Program into the Linux Kernel by nikolayasdf123 on Sunday April 28, 2024 @04:46AM (#40187043)
reminds me of go unikernel: https://github.com/icexin/eggos
[dead]
Re:Let's Embed a Go Program into the Linux Kernel by atombender on Sunday April 28, 2024 @05:22AM (#40187218)
"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."

https://news.ycombinator.com/newsguidelines.html

Re:Let's Embed a Go Program into the Linux Kernel by st_goliath on Sunday April 28, 2024 @05:12AM (#40187169)
I'm a bit surprised the bulk of the comments here seem to fixate onto Go specifically, seemingly missing the actual point of the article:

The article demonstrates the Usermode Driver API, showing how a Linux driver can offload work into userspace (with or without access to a working filesystem).

I mentioned this yesterday in the context of the in-kernel codec discussion[1], where the questions "can't this be done in userspace" or "why not sandboxing" were dismissed pretty quickly.

[1] https://news.ycombinator.com/item?id=40174516#40184307

Re:Let's Embed a Go Program into the Linux Kernel by unnouinceput on Sunday April 28, 2024 @09:28AM (#40188436)
Exactly!. It can be written in any language, Cobol if you want, it does not matter. Once compiled the "gas" does the actual magic, not Go.
Re:Let's Embed a Go Program into the Linux Kernel by deepsun on Sunday April 28, 2024 @09:29AM (#40188445)
So why not Java? It has way more software written in it. :)
Re:Let's Embed a Go Program into the Linux Kernel by hu3 on Sunday April 28, 2024 @10:13AM (#40188730)
Their rationale for Go is explained in the article.

> Strictly speaking, any program will do, but we need to ensure that the program in question has no dependencies on the file system. Linking it statically provides benefits. Go programs are statically linked by default, and to illustrate that the following approach works with any kind of program, we have chosen to embed a Go program into the kernel.

Please refrain from inciting language flamewars.

Re:Let's Embed a Go Program into the Linux Kernel by pjmlp on Sunday April 28, 2024 @10:31AM (#40188864)
More to the point, Sun did actually play with the idea of having Java in Solaris.

Android Things had drivers in Java, and Android has a few, although only as userspace.

Re:Let's Embed a Go Program into the Linux Kernel by jerf on Sunday April 28, 2024 @12:19PM (#40189662)
There were also some Java CPUs, which directly executed bytecode, in which case a "Java driver" would just be the lowest, system-level language available: https://en.m.wikipedia.org/wiki/Java_processor
Re:Let's Embed a Go Program into the Linux Kernel by fullspectrumdev on Sunday April 28, 2024 @11:22AM (#40189267)
I recall stumbling across this years ago while working on a Solaris project - the possibility of writing drivers in Java.

It seemed so patently absurd at the time!

Re:Let's Embed a Go Program into the Linux Kernel by chrsig on Sunday April 28, 2024 @10:56AM (#40189063)
It's a sophisticated bike shed. Much more of the population has a working knowledge of go than about the linux kernel's Usermode Driver API

...So what color is their gopher?

Re:Let's Embed a Go Program into the Linux Kernel by _pdp_ on Sunday April 28, 2024 @08:23AM (#40188083)
As soon as I read the article I thought a security person must write this and what do you know? It is!
Re:Let's Embed a Go Program into the Linux Kernel by remram on Sunday April 28, 2024 @03:22PM (#40191090)
How does this relate to the initrd? As I understand it, its purpose is also to load programs and modules before the filesystem becomes available, by embedding them in an image loaded with the kernel...
Re:Let's Embed a Go Program into the Linux Kernel by NekkoDroid on Sunday April 28, 2024 @05:47PM (#40192300)
What you as specifically talking about is a Unified Kernel Image, aka UKI (kernel + initrd/initramfs + stub + ...). It can be used as an actual "usable" system, where instead of `switch-root`ing into a mounted filesystem it just stays in the initrd. This is then refered to as a Unified System Image, aka USI.

The easiest way to execute a program in a UKI/USI is just putting it at /init which gets executed first if nothing is specified in the cmdline. So that is a way you can have it execute something. But initrd's are mostly read-only and would need to be extracted and repackaged if you want to add a file and also stops existing (for the most part) once `switch-root`ed, so I honestly am not sure if that could cover the possible intent behind such a mechanism described in the article (tho I also mostly just skimmed the article, so I very well might be wrong on that though).

Re:Let's Embed a Go Program into the Linux Kernel by remram on Sunday April 28, 2024 @09:26PM (#40193471)
> stops existing (for the most part) once `switch-root`ed

I guess that's the difference, yeah. Although "for the most part" might hide another answer?

Re:Let's Embed a Go Program into the Linux Kernel by NekkoDroid on Monday April 29, 2024 @03:21AM (#40195471)
What I meant with it is: there is probably a way to re-create it by extracting it from the UKI and using some form of overlayfs. It's not like the initrd in the UKI gets deleted lol.
Re:Let's Embed a Go Program into the Linux Kernel by az09mugen on Tuesday April 30, 2024 @01:36AM (#40207568)
Please don't put Go with telemetry inside linux kernel.