Jail uname spoofing / misc

Previous thread: Re: panic: assertion: hammer_btree_cmp(cursor->left_bound, &cursor->node->ondisk->elms[0].leaf.base) <= 0 in btree_split_leaf by Matthew Dillon on Friday, March 21, 2008 - 10:12 pm. (1 message)

Next thread: HAMMER update 23-Mar-08 by Matthew Dillon on Sunday, March 23, 2008 - 10:57 pm. (3 messages)
To: <kernel@...>
Date: Sunday, March 23, 2008 - 12:36 pm

I'm finally getting around to doing 1.12 upgrades, and have setup a
separate machine to do my bulk package builds / upgrades etc,
so as not to disrupt my 'dev server' while things are being
built / tested

However, this seems kind of wasteful - the only purpose of this machine
is to build packages against a specific release..

And since building packages for a particular release generally requires
only the userland, appropriate headers and correct 'uname' output - so:

it seems like if spoofing uname is configured inside a jail,
the next (or previous..) release can be installed into a jail and
used for building / testing packages without the overhead of a VM or
maintaining a separate physical host

I did a quick scan of the tree to see what this would take, and, high
level, it seems like only the following changes would need to be made:

- update struct jail to add a 'osrelease' string
(implies bumping 'jail api' to 2?)
- update jail(8) to actually pass this information along
- update sys_uname to test ucred for jailed processes, and
use the struct jail osrelease if appropriate
- similarly update sysctl kern.osrelease to support jail spoofing
(if possible - didn't get this far in the research yet)
could be less of a problem for builds, as I think most things use
uname(1) ... but good to keep the environment consistent I suppose..

I'm still a bit confused as to how 'osrelease' is defined - everything
I'm finding is showing up as extern char[] .. perhaps this is something
in the build I'm not familiar with?

also,

is the so-called 'stupid hackery' in sys_uname needed still?

Before I start any coding, does this:

- sound like something useful
- sound like the right approach

Thinking this could have wider useful implications e.g. for pkgbox
& so on - for example setting up automated bulks w/various combinations
of pkgsrc and releases, etc.

Cheers,

- Chris

To: <kernel@...>
Date: Sunday, March 23, 2008 - 11:04 pm

If you don't need a jail to spoof uname, as others posted, you can
installworld into a chroot and build everything you want there using
Joerg's spiffy pbulk. That's what I'm doing on pkgbox now; I can hand you
my somewhat terse notes if you want. It would be relatively easy to set
up the configuration you're talking about.

To: <kernel@...>
Date: Monday, March 24, 2008 - 7:21 am

cheers - I guess I thought incorrectly that something 'special' was
needed to get the uname to change .. have been using the legacy bulks in
chroots / jails (for 'same os' builds) as I haven't quite migrated to
pbulk yet ..

thanks for the help offer - I'll ask if I run into trouble.

To: <kernel@...>
Date: Sunday, March 23, 2008 - 12:59 pm

brave investigation. but you could also simply set UNAME_r :)

sweatshorts % uname -r
1.13.0-DEVELOPMENT
sweatshorts % UNAME_r=1.12-RELEASE uname -r
1.12-RELEASE

I think that's good enough :D

cheers
simon

--
Serve - BSD +++ RENT this banner advert +++ ASCII Ribbon /"\
Work - Mac +++ space for low €€€ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \

To: <kernel@...>
Date: Sunday, March 23, 2008 - 1:41 pm

Doh! Thanks for the tip!

they should change the phrase from RTFM to 'Carefully RTFM' :)

well.. scratch that change then. 1 less patch to write.

- Chris

To: <kernel@...>
Date: Sunday, March 23, 2008 - 2:14 pm

RTFMAI -- Read The Fine Manual Again, Idiot.

Joerg

To: <kernel@...>
Date: Sunday, March 23, 2008 - 11:12 pm

On Mon, Mar 24, 2008 at 2:14 AM, Joerg Sonnenberger

--
Live Free or Die

To: <kernel@...>
Date: Sunday, March 23, 2008 - 2:07 pm

for the record - if anyone's interested - adding a line e.g.:

ALL_ENV+= UNAME_r=1.12-RELEASE

to mk.conf looks like it -might- work ..

(unless wants to chime in & verify)

Previous thread: Re: panic: assertion: hammer_btree_cmp(cursor->left_bound, &cursor->node->ondisk->elms[0].leaf.base) <= 0 in btree_split_leaf by Matthew Dillon on Friday, March 21, 2008 - 10:12 pm. (1 message)

Next thread: HAMMER update 23-Mar-08 by Matthew Dillon on Sunday, March 23, 2008 - 10:57 pm. (3 messages)