Live data from Hacker News

Using Landlock to Sandbox GNU Make

justine.lol

31–40 of 80 posts

Re: Using Landlock to Sandbox GNU Make

#31
post #26

Very interesting and impressive technically but the post took a dive towards the end with the anti-Java rant. We can celebrate our work without having to stand on a platform made by bashing the work of others.

That was no rant or bashing, it was short, accurate, and directly relevant to the primary topic of the article.

Re: Using Landlock to Sandbox GNU Make

#32
post #27
post #23

Earlier quoted context omitted.

What interpreter? Why do you assert that it's "not how Bazel would want to do it"? No, it's not chroot -- it uses a tree of symlinks, created specifically for each process being run, that assumes the process isn't trying to escape the 'sandbox' too much. At the end of the day, a _strong_ sandbox is going to require some OS-specific support, and this could be seen as a kind of graceful degradation when there's not a b…

Why do my comments seem combative? All I said was basically good job, but it will unfortunately not be used much. Why is that combative? With regards to chroot, I stand corrected. I knew it was a tree of symlinks, but I thought it was also more than that because symlinks alone don't seem like a sandbox. Honestly, Cosmopolitan's system appears to be more of a sandbox than that. I agree that a strong sandbox is going t…

> but my point is that it could do more, including checks.

Could you explain more how you see this working?

For example: the build system is running a build step. It has determined the inputs and the outputs for that build step. It is going to execute a subprocess for that build step (say, GCC). It wants to ensure that GCC doesn't accidentally depend on files other than thaie that the build system knows about. How can that functionality be implemented with checks in the build system interpreter?

I suppose it could run the process with something strace-like and monitor which files it accesses but isn't that just a way of implementing a sandbox? I'm not sure what you mean exactly.

Re: Using Landlock to Sandbox GNU Make

#33
One of the downsides of Blaze/Bazel is that the symlink tree adds indirection that makes debugging broken builds that much harder. This approach, while not very portable, seems like a win from an ease of use standpoint.

(Also, at least internally, Blaze pretty much required Linux for the longest time anyway.)

Re: Using Landlock to Sandbox GNU Make

#34
This comment is a plug.

I've tried many alternative to make over the years, and eventually, doit (pydoit.org/) was the one I sticked with.

It's declarative yet dynamic, it's simple yet powerful, you get to use shell command or a custom function, and it deals with all the things you need like deps and targets, creating a dag, caching, etc.

It's the sweat spot for me.

Re: Using Landlock to Sandbox GNU Make

#35
post #21

Earlier quoted context omitted.

> What I'd recommend for anyone really, is to just do what Google did. For the first decade and a half of Google's company lifecycle, they got along just fine with GNU Make. Then they switched to the huge scalable thing once they actually reached that inflection point. Hopefully as a community we can build things that are scalable and as-simple-as Make. I think please.build is a step in the right direction but still…

Eh Make is not good for most problems -- see experiences here by dwheeler, me, frankohn: https://news.ycombinator.com/item?id=32301606 And this other thread I linked there, with feedback from FreeBSD engineers: https://lobste.rs/s/7svvkz/using_bsd_make#c_bfwcyc --- Ninja basically gives you the parts of GNU make that are good, without the cruft and slowness. And you can learn it in 20 minutes, unlike GNU make

(Opinions are my own)

> Eh Make is not good for most problems

Agreed. I spend a lot of time advocating for Bazel for this reason.

> Ninja basically gives you the parts of GNU make that are good, without the cruft and slowness. And you can learn it in 20 minutes, unlike GNU make

Ninja seems more like a side-grade than a wholesale improvement. It does not fix all the problems that need to be addressed. Compare the two:

* https://ninja-build.org/manual.html#_philosophical_overview

* https://bazel.build/start/bazel-intro

Right now Bazel's biggest issues are:

1. Getting started is difficult: There is a lot of impedance mismatch across various language toolchains. This can be fixed over time by improving the tooling/libraries/docs. If JetBrains had a "New Bazel Project" and had a way to 1-click-add Java/Python/Ruby/golang/Rust/etc source into //third_party with BUILD files and a version of build_cleaner Bazel would win. Just making it easy to vendor libraries and build software from the IDE is I think all it would take to get popular.

2. The JVM: I am a huge fan of Java (I've build multiple company's backends in it) but it is not a great choice for CLI tooling (even with a daemon). A no-dependency, small, build system executable would go a long way to making it easy to get people started.

3. The cruft: A lot of things in Bazel are the way they are because someone had to get a feature out ASAP to support $BIG_USER to do $BIG_THING and it would be too difficult to migrate away/to something at Google. If we drop the cruft and redesign things from the ground up we can get a nice abstraction for the world. For example, please.build's proto_library is VERY easy to use (way easier than even the Google internal versions imo).

4. The tooling: You can get massive CI improvements, free mutation testing, frameworks for build (integration tests, e2e tests, etc), and much more by building things against the Bazel API. Unfortunately not much outside of Google supports this API. Example of things you can do with this API: https://kythe.io/examples/#extracting-compilations-using-baz...

We could live in a world where people can build langauge-agnostic tooling that automatically works so long as you pass it a `*_binary` target that transparently builds for all major platforms (zig's or APE's as crosstool) which would allow platform vendors to define macros to completely automate deployment and development for their systems. For example we could have:

``` from aws import lambda

lambda.package( name = "my_api", deps = [":api_handler"], ) ```

And just by running `build :my_api` you could have a zip file which packages your code (from any language) into a lambda.

Re: Using Landlock to Sandbox GNU Make

#36
post #20
post #8

Earlier quoted context omitted.

One of the nice things about Bazel that the article didn't get a chance to go into is it uses SHA hashes of files, rather than file timestamps, to determine when an artifact has changed and therefore needs to be updated. It's slightly more costly to compute hashes, but it's necessary if you want to have something like a global cache of build artifacts, since synchronizing time across machines is hard. What I'd recomm…

For the first decade and a half of Google's company lifecycle, they got along just fine with GNU Make ??? Google was started in 1998, and Bazel was created ~2006 as a replacement for Python + GNU Make ("gconfig"). I was on that team, though I only worked on Blaze a tiny bit. The "google3" build migration was sometime around 2003 or 2004. So at most there were 6 years of using Make only, i.e. "google2". Importantly, p…

I like the speed of Ninja, and the flexibility of having a stage that generates the ninja (or make) files. But it's a bit unclear to me what the best practice is for when to generate the ninja files. It feels like the programmer is expected to do this stage manually and there's no great automatic way to generate the ninja files when they need to be generated. How do good build systems solve this?

Re: Using Landlock to Sandbox GNU Make

#37
post #32
post #27

Earlier quoted context omitted.

Why do my comments seem combative? All I said was basically good job, but it will unfortunately not be used much. Why is that combative? With regards to chroot, I stand corrected. I knew it was a tree of symlinks, but I thought it was also more than that because symlinks alone don't seem like a sandbox. Honestly, Cosmopolitan's system appears to be more of a sandbox than that. I agree that a strong sandbox is going t…

> but my point is that it could do more, including checks. Could you explain more how you see this working? For example: the build system is running a build step. It has determined the inputs and the outputs for that build step. It is going to execute a subprocess for that build step (say, GCC). It wants to ensure that GCC doesn't accidentally depend on files other than thaie that the build system knows about. How ca…

The best way to do this is best described in the thesis that Eelco Dolstra wrote describing Nix. I suggest you read that.

tl;dr: Clear the environment, know where all of the system headers are, control the build environment of the dependencies. Basically, knowing dependencies means controlling them.

But to expand on that, an interpreter could do some basic checking like:

* Does the command reference a path that the build system doesn't know about?

* Does the build system know where the executable is for the command, and is it well-known?

Things like that.

It won't be perfect, but it would be better. And it can get better with time.

Re: Using Landlock to Sandbox GNU Make

#38
Justine is one of my fav contemporary hackers. Whenever I see her stuff posted on here, not only am I amazed that anyone did what was done, but even more amazed that one person did it all on their own.

Justine, if you're reading this, keep up the amazing work!

Re: Using Landlock to Sandbox GNU Make

#40
The only thing I’m really missing for my usecase with make is the ability to specify goals/targets other than files. E.g., I want a docker image to be present in the daemon. Basically, calling out to a function. (Probably somebody is going to correct me and say there is something there in the form of conditionals or something..)
Post reply on HN