Page MenuHomeFreeBSD

jamie (James Gritton)
User

Projects

User Details

User Since
Aug 3 2014, 10:29 PM (545 w, 4 d)

Recent Activity

Mon, Jan 6

jamie accepted D47992: jail: Avoid a use-after-free when destroying jails.

No further comments, except sorry for taking so long to mention that.

Mon, Jan 6, 10:40 PM

Dec 17 2024

jamie added a comment to D47992: jail: Avoid a use-after-free when destroying jails.

The new PR_VNET_ROOT flag is unneeded: it's equivalent to PR_VNET, just check
that instead.

Dec 17 2024, 6:02 PM
jamie added inline comments to D47992: jail: Avoid a use-after-free when destroying jails.
Dec 17 2024, 5:54 PM
jamie added a comment to D47668: jail: Add meta and env parameters.

There are currently a wide variety of strings in jail parameters, and for that matter many more elsewhere in the kernel. So far, we have gotten by with counting on administrators putting reasonable values in them.

Dec 17 2024, 5:33 PM

Dec 14 2024

jamie requested changes to D48074: kern: osd: abstract away the math for locating a slot method.
Dec 14 2024, 4:47 AM
jamie accepted D48075: kern: osd: trash a slot's methods upon deregistration.

Accepted with the caveat I mentioned in D48074.

Dec 14 2024, 4:46 AM
jamie accepted D48074: kern: osd: abstract away the math for locating a slot method.

I'd prefer it to take the slot number, and do the "slot - 1" translation in the macro. That came to mind looking at D48075 which passes in slot - 1.

Dec 14 2024, 4:44 AM

Dec 13 2024

jamie added a comment to D47668: jail: Add meta and env parameters.
  • The allowed chars for each buffer are very limited by default, it covers Base64, k=v\n format, and some extra bytes. It can be changed via security.jail.meta_allowedchars sysctl. For convenience (as it seems to me for now), setting it to an empty string allows everything.
Dec 13 2024, 7:05 PM

Dec 9 2024

jamie added inline comments to D47992: jail: Avoid a use-after-free when destroying jails.
Dec 9 2024, 6:44 PM
jamie added inline comments to D47992: jail: Avoid a use-after-free when destroying jails.
Dec 9 2024, 4:49 AM
jamie accepted D47991: jail: Handle jail removal in a dedicated thread.

Longer term, I'd like to push some of vnet removal into the period between prison_cleanup() and the final jail destruction; interface removal is definitely part of that desire. But that's a mess of dependencies that hasn't found a solution yet, so I can see how we need this.

Dec 9 2024, 4:48 AM

Dec 6 2024

jamie accepted D47943: prison_proc_iterate(): make it work for prison.

I'm surprised the wrong behavior existed for this long without being noticed. I guess that shows how little-used kill(-1) is in usual operation.

Dec 6 2024, 5:42 PM

Nov 27 2024

jamie added a comment to D47668: jail: Add meta and env parameters.

Yeah, it seems that on the Jail Call of 26-Nov we came to a conclusion that for now we would keep it very simple like two buffers per jail managed from the user-land side, while keeping a wide spectrum of opportunities to extend it in the future having a more specific production need in mind. Thus, we can postpone thinking about extra complexity on the kernel side.

Nov 27 2024, 7:41 PM

Nov 19 2024

jamie added a comment to D47668: jail: Add meta and env parameters.
  • The current state of the patch allows reading meta by any user within a jail. Do we want to disable it by default and add something like allow.read_meta or allow.metadata parameter to control it per jail?
Nov 19 2024, 6:23 PM
jamie added a comment to D47668: jail: Add meta and env parameters.

A flat list of key=value pairs (instead of a single value) would allow multiple users of this feature per jail e.g. multiple helper commands preparing just one aspect of a jail e.g. dynamic devfs ruleset loading, network setup/teardown, storage provisioning.

Nov 19 2024, 6:20 PM

Nov 18 2024

jamie accepted D47651: jail: Let a couple of parameter types be specified as lists.

Not really part of this specific problem, but jail(8) should auto-recognize list parameters because their SYSCTL_JAIL specification has a type with ",a" appended. Ideally, it would build a list of such parameters it sees like that. For non-kernel parameters like vnet.interface and zfs.dataset, putting them in the array is probably as good as its going to get.

Nov 18 2024, 9:29 PM · manpages, Jails

Nov 8 2024

jamie added a comment to D47332: sysctl: Revise meaning of CTLFLAG_PRISON.

If we add CTLFLAG_PRISON to such sysctlS it will add some mess to the existing interface and behavior, and can add headache for future code. Having such flag added to these variables makes a feeling they can be changed but instead of a correct message that "Operation not permitted" we get something like this:

root@somejail:/ # sysctl security.jail.set_hostname_allowed=1
security.jail.set_hostname_allowed: 0 -> 0
Nov 8 2024, 10:40 PM

Oct 30 2024

jamie added a comment to D47332: sysctl: Revise meaning of CTLFLAG_PRISON.

I like the idea of flagging sysctls that hold values that can be read per jail. If jail(2) says otherwise, we can change that to match.

Oct 30 2024, 3:11 AM

Oct 28 2024

jamie accepted D47107: sysctl: Add flags to filter jail prison and vnet variables.
Oct 28 2024, 5:17 PM

Oct 25 2024

jamie added a comment to D47107: sysctl: Add flags to filter jail prison and vnet variables.

This change is focusing on VNET variables, but is open for -J ( CTLFLAG_PRISON ) if requested.

Oct 25 2024, 4:44 PM

Oct 24 2024

jamie added inline comments to D47107: sysctl: Add flags to filter jail prison and vnet variables.
Oct 24 2024, 4:46 PM

Oct 17 2024

jamie added a comment to D47027: jail: Avoid dereferencing a potentially null pointer in kern_jail_get().

But, the non-null-checked use of the pointer is harmless, as nothing actually dereferences it. Because pr_ip is an array, the value passed to vfs_setopt_part() is the value of the pointer plus the offset of the array within the structure being pointed to.

Oct 17 2024, 5:15 PM
jamie added a comment to D47027: jail: Avoid dereferencing a potentially null pointer in kern_jail_get().

Sorry I'm late to the game. This actually seems like something should go in. The null dereference was introduced in 500f82d6c32ed, replacing earlier code that was unintuitive but notably didn't need to dereference that pointer. Unfortunately, the fix didn't include a null check, leading to a statement that has one non-null-checked use of the pointer, followed immediately by a properly checked use (because that one predated 500f82d6c32ed).

Oct 17 2024, 4:54 PM

Oct 16 2024

jamie accepted D46896: MAC: mac.h: Fix missing includes/typedefs.
Oct 16 2024, 3:01 AM
jamie accepted D46899: MAC: Define a common 'mac' node for MAC's jail parameters.

Currently, it seems to suggest (being a jailsys parameter) that there's some sort of valid "new" or "deleted" state for MAC inside the jail.

Not sure what you mean here. SYSCTL_JAIL_PARAM_NODE() just declares the common MAC sub-node. mac_do(4) will then indeed use the new SYSCTL_JAIL_PARAM_SYS_SUBNODE() for the mac.do jail parameter "node", effectively intended to be a jailsys one.

Oct 16 2024, 3:00 AM
jamie accepted D46898: MAC: 'kernel_mac_support' module: Make an outdated comment more generic.
Oct 16 2024, 2:58 AM
jamie accepted D46897: MAC: mac.h: Separately test inclusion from userspace.
Oct 16 2024, 2:57 AM
jamie accepted D46903: MAC: mac_policy.h: Declare common MAC sysctl and jail parameters' nodes.
Oct 16 2024, 2:57 AM
jamie added a comment to D46284: Add the ability have executable jail.conf.

It would make sense for the exec.clean parameter to apply to the config execution. Bit of a chicken and egg problem there, but there's still the "-l" flag.

Oct 16 2024, 2:56 AM · Jails

Oct 13 2024

jamie committed rG16e1424d24b9: jail: expose children.max and children.cur via sysctl (authored by jamie).
jail: expose children.max and children.cur via sysctl
Oct 13 2024, 11:46 PM
jamie committed rGb3c2cc7ea9b9: tests: move sysctl_security_jail_children.sh to the right directory (authored by jamie).
tests: move sysctl_security_jail_children.sh to the right directory
Oct 13 2024, 8:57 PM

Oct 5 2024

jamie added a comment to D46899: MAC: Define a common 'mac' node for MAC's jail parameters.

I suppose this will make more sense once there's at least one MAC policy that has an associated jail parameter. Currently, it seems to suggest (being a jailsys parameter) that there's some sort of valid "new" or "deleted" state for MAC inside the jail.

Oct 5 2024, 11:57 PM
jamie accepted D46902: jail.h: New SYSCTL_JAIL_PARAM_DECL().
Oct 5 2024, 11:52 PM
jamie accepted D46900: jail.h: Fix whitespace in the param macros declaration block.
Oct 5 2024, 11:50 PM
jamie accepted D46901: jail.h: New SYSCTL_JAIL_PARAM_SYS_SUBNODE().
Oct 5 2024, 11:49 PM
jamie accepted D46886: osd: Constify signature of osd_register().
Oct 5 2024, 11:44 PM

Sep 24 2024

jamie committed rGf616b13bb35a: MFC jail: unbreak the zfs.mount_snapshot option (authored by jamie).
MFC jail: unbreak the zfs.mount_snapshot option
Sep 24 2024, 5:19 PM
jamie committed rG80c5d78d90e6: MFC jail: unbreak the zfs.mount_snapshot option (authored by jamie).
MFC jail: unbreak the zfs.mount_snapshot option
Sep 24 2024, 5:17 PM

Sep 19 2024

jamie committed rGae1a0648b05a: jail: unbreak the zfs.mount_snapshot option (authored by jamie).
jail: unbreak the zfs.mount_snapshot option
Sep 19 2024, 7:50 PM

Aug 16 2024

jamie committed rG1ff3118d72b1: MFC jail: only chdir to user's home directory when user is specified (authored by jamie).
MFC jail: only chdir to user's home directory when user is specified
Aug 16 2024, 5:13 PM

Aug 12 2024

jamie closed D46226: Restrict jail(8) and jexec(8) to chdir to the user's directory only when the user is expicitly specified.
Aug 12 2024, 10:37 PM
jamie committed rG5cf705491727: jail: only chdir to user's home directory when user is specified (authored by jamie).
jail: only chdir to user's home directory when user is specified
Aug 12 2024, 10:36 PM

Aug 5 2024

jamie added a comment to D46226: Restrict jail(8) and jexec(8) to chdir to the user's directory only when the user is expicitly specified.

This comes from discussion in Bug 277210.

Aug 5 2024, 5:45 AM
jamie requested review of D46226: Restrict jail(8) and jexec(8) to chdir to the user's directory only when the user is expicitly specified.
Aug 5 2024, 5:41 AM

Jun 28 2024

jamie committed rG0e391d97fbe4: MFC zfs/jail: Document the zfs.mount_snapshot parameter in jail(8). (authored by jamie).
MFC zfs/jail: Document the zfs.mount_snapshot parameter in jail(8).
Jun 28 2024, 7:52 PM
jamie committed rG172fbf12fc22: MFC zfs/jail: Mark the zfs.mount_snapshot jail parameter as boolean. (authored by jamie).
MFC zfs/jail: Mark the zfs.mount_snapshot jail parameter as boolean.
Jun 28 2024, 7:51 PM
jamie committed rGbb7b7b0eb7cf: MFC zfs/jail: Document the zfs.mount_snapshot parameter in jail(8). (authored by jamie).
MFC zfs/jail: Document the zfs.mount_snapshot parameter in jail(8).
Jun 28 2024, 7:50 PM
jamie committed rGc8f147943d2e: MFC zfs/jail: Mark the zfs.mount_snapshot jail parameter as boolean. (authored by jamie).
MFC zfs/jail: Mark the zfs.mount_snapshot jail parameter as boolean.
Jun 28 2024, 7:46 PM

Jun 24 2024

jamie committed rG63875db56bd5: Document the zfs.mount_snapshot parameter in jail(8). (authored by jamie).
Document the zfs.mount_snapshot parameter in jail(8).
Jun 24 2024, 8:06 PM
jamie committed rG9cbf1de7e34a: Mark the zfs.mount_snapshot jail parameter as boolean. (authored by jamie).
Mark the zfs.mount_snapshot jail parameter as boolean.
Jun 24 2024, 8:03 PM
jamie closed D45647: Document and subtlely change the zfs.mount_snapshot jail parameter.
Jun 24 2024, 8:03 PM · Jails, ZFS

Jun 21 2024

jamie added a comment to D45647: Document and subtlely change the zfs.mount_snapshot jail parameter.

I guess the change for sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c go to upstream first. Will it ?

Jun 21 2024, 5:05 PM · Jails, ZFS

Jun 19 2024

jamie requested review of D45647: Document and subtlely change the zfs.mount_snapshot jail parameter.
Jun 19 2024, 8:04 PM · Jails, ZFS

Jun 10 2024

jamie added a comment to D45545: jail: allow adjustment of host time.

Is there any value in a virtual time, i.e. letting a jail have its own clock? Apart from a test framework, I can't think of any, but maybe someone else can. That was actually my first thought when I saw the title of this, rather than encapsulating ntpd.

Jun 10 2024, 4:11 PM

May 16 2024

jamie added inline comments to D43696: Jail descriptors.
May 16 2024, 8:56 PM
jamie updated the diff for D43696: Jail descriptors.

Diff updated for libsys and other recent changes.

May 16 2024, 6:24 PM

Mar 17 2024

jamie committed rGd50685b303e3: jail: add the -C flag to clean up after a partially removed jail (authored by jamie).
jail: add the -C flag to clean up after a partially removed jail
Mar 17 2024, 5:13 AM
jamie closed D42670: jail(8) option to cleanup after dead jails.
Mar 17 2024, 5:13 AM

Feb 23 2024

jamie added a comment to D44010: jail: tests requires jail.

Yes, this is a better way.

Feb 23 2024, 4:18 PM

Feb 21 2024

jamie added a comment to D44010: jail: tests requires jail.

I'll admit very little familiarity with the testing framework. If there's a standard to show a test as skipped that doesn't indicate a problem, that sounds best. But if it just claims that it's passed, it would seem better to just not run it. Though both is probably a good idea: still have it pass (like if the test was built at another time), but don't build it on a jail-less system.

Feb 21 2024, 9:19 PM
jamie accepted D44010: jail: tests requires jail.
Feb 21 2024, 5:02 PM

Feb 11 2024

jamie added inline comments to D43696: Jail descriptors.
Feb 11 2024, 5:04 PM

Feb 5 2024

jamie updated the diff for D43696: Jail descriptors.

Here's the latest diff to address concerns so far (except those that request proper documentation).

Feb 5 2024, 4:27 AM
jamie added a comment to D43696: Jail descriptors.
In D43696#996617, @bz wrote:

Also, can we please have a man page?

Feb 5 2024, 3:46 AM
jamie added inline comments to D43696: Jail descriptors.
Feb 5 2024, 3:42 AM

Feb 4 2024

jamie accepted D43732: libjail: Guard against programmer error in jailparam_export().

Sure, looks helpful for just such a situation.

Feb 4 2024, 10:38 PM

Feb 2 2024

jamie committed rGdcae96578145: MFC jail: make sure jail.conf parse errors exit, and not crash. (authored by jamie).
MFC jail: make sure jail.conf parse errors exit, and not crash.
Feb 2 2024, 4:46 PM

Feb 1 2024

jamie added inline comments to D43696: Jail descriptors.
Feb 1 2024, 5:31 PM
jamie added inline comments to D43696: Jail descriptors.
Feb 1 2024, 5:29 PM
jamie requested review of D43696: Jail descriptors.
Feb 1 2024, 12:23 AM

Jan 26 2024

jamie committed rGab0841bdbe84: jail: expose children.max and children.cur via sysctl (authored by jamie).
jail: expose children.max and children.cur via sysctl
Jan 26 2024, 5:49 PM

Jan 25 2024

jamie accepted D43565: kern_jail: add security.jail.children.max and .cur sysctl.

Looks good to me!

Jan 25 2024, 10:28 PM
jamie added a comment to D43565: kern_jail: add security.jail.children.max and .cur sysctl.

c) Or something else what I have not spotted yet :)

c) Jamie wasn't thinking and of course you don't need it for read-only.

Jan 25 2024, 12:21 AM

Jan 23 2024

jamie added a comment to D43565: kern_jail: add security.jail.children.max and .cur sysctl.

You'll want to add CTLFLAG_PRISON to the sysctl flags.

Jan 23 2024, 10:57 PM
jamie added a comment to D43476: sys/jail.h: expose JAIL_MAX constant to applications.
In D43476#992839, @igor.ostapenko_pm.me wrote:

@jamie, does it look as an acceptable feature to introduce security.jail.children.max RO sysctl which reflects the current prison's p_childmax? If it does then I will help to implement it.
P.S. Probably you know existing "legal" ways to retrieve current prison's children.max w/o additional code to introduce.

Jan 23 2024, 5:18 PM

Jan 21 2024

jamie committed rG768149ff156e: jail: make sure jail.conf parse errors exit, and not crash. (authored by jamie).
jail: make sure jail.conf parse errors exit, and not crash.
Jan 21 2024, 5:23 AM

Jan 17 2024

jamie accepted D43476: sys/jail.h: expose JAIL_MAX constant to applications.

I'm not sure why this limit exists in the first place (it predates me). I suppose it's just for neatness' sake, with the idea no one would have more jails than that anyway. But as long as it's around, it might as well be known.

Jan 17 2024, 6:38 PM

Jan 5 2024

jamie accepted D43314: jail: add security.jail.mlock_allowed.

That's fine if there's a use for it, such as to quiet errors.

Jan 5 2024, 1:11 AM

Dec 21 2023

jamie accepted D43142: jail: Ignore errors from copyout() while copying the error string.
Dec 21 2023, 5:54 PM

Nov 30 2023

jamie committed rG51e7276365ba: Unbreak build from ed31b3f4a146 (misapplied diff). (authored by jamie).
Unbreak build from ed31b3f4a146 (misapplied diff).
Nov 30 2023, 1:30 AM
jamie committed rGed31b3f4a146: jail: Don't allow jail_set(2) to resurrect dying jails. (authored by jamie).
jail: Don't allow jail_set(2) to resurrect dying jails.
Nov 30 2023, 12:23 AM
jamie closed D28150: jail: Don't allow resurrection of dead jails.
Nov 30 2023, 12:23 AM

Nov 21 2023

jamie added a comment to D42672: Fix ZFS so that it sets mnt_exjail for snapshot automounts.

This version of the patch acquires a shared lock on
allprison_lock (which looks sufficient to ensure the
jail does not go from alive to dying.
It also acquires pr_mtx to check for prison_isalive(),
although I am not 100% sure it is needed?

Nov 21 2023, 9:34 PM

Nov 20 2023

jamie added a comment to D42672: Fix ZFS so that it sets mnt_exjail for snapshot automounts.

Since vfs_exjail_delete() is called when there are no processes running in the jail, a caller of vfs_exjail_clone() cannot be running in that jail.

It's not clear to me that the first part is true. In particular, prison_deref() first calls prison_deref_kill(), which calls prison_cleanup() and thus vfs_exjail_delete(); later it kills processes within the jail.

Hmm, unless I'm missing something, this is at odds with the comment in vfs_exjail_delete(). Perhaps we need to check the prison state when setting mnt_exjail? i.e., refuse to set it if the jail is dying.

Well, the comment on vfs_exjail_delete() states that no processes are in the
prison, but maybe the comment is bogus?
Anyhow, I think this version might be ok, but hopefully you or jamie@ can
confirm this?

My understanding (which could be wrong) is that a prison cannot go from
active to dying when there is a p_uref held on it. If that is the case, then
prison_proc_hold()/prison_proc_free() should ensure that it remains alive
until after the cloning is done, I hope?

Nov 20 2023, 7:10 PM
jamie added a comment to D42675: jail(8): make '-cm' run 'command=' in modify case as well.

The command parameters (including "command" itself) are well established as being run during jail setup and teardown. I would expect a lot of existing configuration to have problems with the command being run when the jail has already started up. While it makes sense on the command line, I don't want to break the connection between file configuration and command line configuration (more than it's already broken).

Nov 20 2023, 5:41 PM
jamie added inline comments to D42670: jail(8) option to cleanup after dead jails.
Nov 20 2023, 5:22 PM

Nov 18 2023

jamie requested review of D42670: jail(8) option to cleanup after dead jails.
Nov 18 2023, 11:54 PM
jamie committed rG6000d46fc3c1: Move "jail -e" out of the rest of jail(8) flow. (authored by jamie).
Move "jail -e" out of the rest of jail(8) flow.
Nov 18 2023, 8:49 PM

Oct 12 2023

jamie added inline comments to D28150: jail: Don't allow resurrection of dead jails.
Oct 12 2023, 4:59 PM

Oct 11 2023

jamie updated the diff for D28150: jail: Don't allow resurrection of dead jails.

Nothing new, though I just updated the diff against the latest sources.

Oct 11 2023, 12:52 AM

Oct 2 2023

jamie committed rG6a5113a8a1df: MFS jail: avoid a clash with /etc/jail.conf.d between rc and jail(8) (authored by jamie).
MFS jail: avoid a clash with /etc/jail.conf.d between rc and jail(8)
Oct 2 2023, 7:24 PM

Sep 28 2023

jamie committed rGc96d5c97bb65: MFC jail: avoid a clash with /etc/jail.conf.d between rc and jail(8) (authored by jamie).
MFC jail: avoid a clash with /etc/jail.conf.d between rc and jail(8)
Sep 28 2023, 4:40 AM

Sep 25 2023

jamie committed rGa2440348eed7: jail: avoid a clash with /etc/jail.conf.d between rc and jail(8) (authored by jamie).
jail: avoid a clash with /etc/jail.conf.d between rc and jail(8)
Sep 25 2023, 12:14 AM
jamie closed D41962: Avoid a clash between uses of /etc/jail.conf.d.
Sep 25 2023, 12:14 AM
jamie accepted D41962: Avoid a clash between uses of /etc/jail.conf.d.
Sep 25 2023, 12:01 AM

Sep 24 2023

jamie requested review of D41962: Avoid a clash between uses of /etc/jail.conf.d.
Sep 24 2023, 12:46 AM

Sep 14 2023

jamie committed rGd737efcc1c25: MFS jail.conf(5): Fix and expand description of ".include". (authored by jamie).
MFS jail.conf(5): Fix and expand description of ".include".
Sep 14 2023, 5:16 PM

Sep 9 2023

jamie committed rG402d5960cb82: MFC jail.conf(5): Fix and expand description of ".include". (authored by jamie).
MFC jail.conf(5): Fix and expand description of ".include".
Sep 9 2023, 4:58 PM

Sep 7 2023

crest_freebsd_rlwinm.de awarded D41723: Fix ".include" section of jail.conf.5 a Like token.
Sep 7 2023, 1:19 PM

Sep 5 2023

jamie committed rG165234d55274: jail.conf(5): Fix and expand description of ".include". (authored by jamie).
jail.conf(5): Fix and expand description of ".include".
Sep 5 2023, 8:38 PM