Page MenuHomeFreeBSD

kib (Konstantin Belousov)
User

Projects

User Details

User Since
May 16 2014, 7:35 PM (641 w, 5 d)

Recent Activity

Today

kib added a comment to D59323: rtsold: ignore SIGCHLD to reap the casper daemon.
In D59323#1361227, @kib wrote:

Are you stating that libcapser does not waitpid() on the resulting pid after pdfork()? If yes, the proper solution is to add PD_NOWAITPID to pdfork() call. This should fix it for all consumers.

Yes, but this is a kernel regression no? I hadn't realized that pdfork() children are reaped automatically upon close().

Wed, Sep 2, 9:09 PM
kib added a comment to D59323: rtsold: ignore SIGCHLD to reap the casper daemon.

Are you stating that libcapser does not waitpid() on the resulting pid after pdfork()? If yes, the proper solution is to add PD_NOWAITPID to pdfork() call. This should fix it for all consumers.

Wed, Sep 2, 6:40 PM
kib updated the diff for D58094: Capsicumise truss(1).

Invert meaning of -y.
Fix new_proc() prototype.
Remove #if 0 block.
Initialize np var on new process.

Wed, Sep 2, 2:38 PM
kib updated the diff for D58094: Capsicumise truss(1).

Remove one more instance of 'Y'.

Wed, Sep 2, 2:00 PM
kib updated the diff for D58094: Capsicumise truss(1).

Use caph_enter().
Remove -Y option.
Update man page for -y.

Wed, Sep 2, 1:49 PM
kib added a comment to D58094: Capsicumise truss(1).

Why is capability mode optional?
Why not use procdescs unconditionally?

Wed, Sep 2, 1:48 PM
kib updated the diff for D58094: Capsicumise truss(1).

Rebase

Wed, Sep 2, 1:18 AM
kib committed rGc8f8d00c2422: ptrace(2): allow ptrace(PT_TRACE_ME) in cap mode (authored by kib).
ptrace(2): allow ptrace(PT_TRACE_ME) in cap mode
Wed, Sep 2, 1:02 AM
kib closed D59317: ptrace(2): allow ptrace(PT_TRACE_ME) in cap mode.
Wed, Sep 2, 1:02 AM
kib added a comment to D59269: x86: add support for TLSDESC relocations.
In D59269#1360942, @kib wrote:

Regarding leaking, glibc does seem to store them in a hash table tied to link_map (i.e. Obj_Entry) so will free on dlclose, unlike our arm64 implementation. Linked list seems a bit unnecessarily slow, but at the same time extensive dynamic TLSDESC + dlclose is probably not common enough to actually benefit from something like a reallocarray-based storage.

The list is only traversed on dlclose() to free items, so I do not see it as causing any slowdown. In fact, where the hashed lookup would be useful?

I don't understand why they use a hash table to uniquify their dynamic tlsdesc structs. I only note that it's a less cache-hating data structure, but for our implementation if we wanted that we'd just use an array of pointers. But I suppose you still have the dynamic tlsdesc structs scattered throughout memory so pointer chasing the linked list doesn't really make it much worse, beyond a bit of extra data dependency. So I think the linked list is fine.

Wed, Sep 2, 12:52 AM
kib added a comment to D59269: x86: add support for TLSDESC relocations.

Regarding leaking, glibc does seem to store them in a hash table tied to link_map (i.e. Obj_Entry) so will free on dlclose, unlike our arm64 implementation. Linked list seems a bit unnecessarily slow, but at the same time extensive dynamic TLSDESC + dlclose is probably not common enough to actually benefit from something like a reallocarray-based storage.

Wed, Sep 2, 12:39 AM
kib added a comment to D59269: x86: add support for TLSDESC relocations.

Looking at the glibc source, they do have an equivalent to the dtv_gen field, but the fast path check is whether the DTV's generation is >= that field, not ==. I think this is a time optimisation that avoids the need to access the global generation in order to do the check, instead just using a copy that's more to hand, and also lets you avoid taking the slow path for DTV entries that don't actually need it, even though the generation counter is ahead (e.g. if you dlopen A, use TLS for A, dlopen B, then use TLS for A again, you can still use the fast path, but ye olde __tls_get_addr doesn't know that, so will pessimistically update the DTV for B's load).

Wed, Sep 2, 12:38 AM
kib updated the diff for D59269: x86: add support for TLSDESC relocations.

Reword the comment about rtld_bind_lock.

Wed, Sep 2, 12:26 AM

Yesterday

kib updated the diff for D59269: x86: add support for TLSDESC relocations.

amd64: provide the fast path for dynamic TLSDESC resolver

Tue, Sep 1, 11:54 PM
kib requested review of D59317: ptrace(2): allow ptrace(PT_TRACE_ME) in cap mode.
Tue, Sep 1, 11:48 PM
kib accepted D59288: libm: Implement femode_t, fegetmode(), and fesetmode() as per C23.
In D59288#1360671, @kfv wrote:

Is it reasonable to provide the inline versions of these methods for complicated cases, like x86? Could it be always a function call?

Sorry, I forgot to answer this one. Well, I think keeping the current split might be preferable; C inlines the CSR ops the same way fesetround() does, and C++ already takes the libm call. IMHO, fegetmode()/fesetmode() sit with that group, not with fegetenv()—please correct me if I'm wrong or missing something. That said, always calling libm would be fine too if you’d rather keep the complicated x86 sequence out of the header. I'm OK either way.

Tue, Sep 1, 8:07 PM
kib accepted D59309: devstat: Fix a kernel stack disclosure.

You could memset only device_name then, right before strcpy(). It would be more clear IMHO.

Tue, Sep 1, 8:04 PM
kib committed rG326ab530dcab: pdopenpid(2): in cap mode, translate all errors from pdopenpid1() to ECAPMODE (authored by kib).
pdopenpid(2): in cap mode, translate all errors from pdopenpid1() to ECAPMODE
Tue, Sep 1, 1:57 PM
kib committed rGb3734c1386dd: tests/sys/kern/procdesc.c: mark grandchild var in pdopenpid_capmode() as… (authored by kib).
tests/sys/kern/procdesc.c: mark grandchild var in pdopenpid_capmode() as…
Tue, Sep 1, 1:57 PM
kib closed D59282: tests/sys/kern/procdesc.c: mark grandchild var in pdopenpid_capmode() as volatile.
Tue, Sep 1, 1:57 PM
kib closed D59252: pdopenpid(2): in cap mode, translate all errors from pdopenpid1() to ECAPMODE.
Tue, Sep 1, 1:57 PM
kib added a comment to D59282: tests/sys/kern/procdesc.c: mark grandchild var in pdopenpid_capmode() as volatile.

Why not use atomics?

Tue, Sep 1, 1:50 PM
kib added a comment to D59288: libm: Implement femode_t, fegetmode(), and fesetmode() as per C23.
In D59288#1360218, @kib wrote:

Is it reasonable to provide the inline versions of these methods for complicated cases, like x86? Could it be always a function call?

Tue, Sep 1, 6:16 AM

Mon, Aug 31

kib added a comment to D58855: namei: retry absolute symlink expansions from the native root.

Let me formulate what I tried to say, differently. There should be no abi symlink pass, or, if you prefer such wording, there must be at least one swich from the ABI namespace to native namespace. If we get ENOENT and the failed component was provided by an absolute symlink, then we should restart native-rooted lookup from the symlink resolved and the rest of the unprocessed path. If we successfully resolved symlink target in the ABI root and ENOENT came later, it is not the reason to restart with the symlink in native root.

Mon, Aug 31, 7:47 PM
kib added a comment to D59288: libm: Implement femode_t, fegetmode(), and fesetmode() as per C23.

Is it reasonable to provide the inline versions of these methods for complicated cases, like x86? Could it be always a function call?

Mon, Aug 31, 6:28 PM

Sun, Aug 30

kib requested review of D59282: tests/sys/kern/procdesc.c: mark grandchild var in pdopenpid_capmode() as volatile.
Sun, Aug 30, 11:51 PM
kib added a comment to D56085: kern_mib: remove kern.fallback_elf_brand compat sysctl.

Please ask @emaste to merge.

Sun, Aug 30, 5:35 PM
kib added a comment to D59271: vfs: allow lookup through VV_READLINK vnodes.

This is a special case that should be not handled by the generic VFS lookup code. Ideally, it should be contained to the fdescfs vop_lookup(). I am not sure how, the obvious idea to change the vnode return type when !ISLASTCN has some drawbacks, at very least the vnode must be reclaimed on deactivation, might be it would work then.

Sun, Aug 30, 5:24 PM
kib added a comment to D58855: namei: retry absolute symlink expansions from the native root.
In D58855#1359474, @kib wrote:

How this behaves when there is more than one symlink in the path to resolve?

Correctly. Same as one abs symlink.

Only the latest absolute target is kept for a possible native fallback; on ENOENT that target is retried once from the native root, then any further symlinks follow normal rules. Relative symlinks resolve as usual — they just do not affect that fallback.

Sun, Aug 30, 5:34 AM
kib accepted D58337: umtx: use a distribution-fair multiplier for the chain hash.
Sun, Aug 30, 5:26 AM
kib updated the diff for D59269: x86: add support for TLSDESC relocations.

Remove dtv_gen from tlsdesc_dynarg. There is no point of storing the generation there for our dtv update structure.
Add comment explaining the use of rtld_bind_lock in rtld_get_addr_slow().

Sun, Aug 30, 5:25 AM

Sat, Aug 29

kib added a comment to D59269: x86: add support for TLSDESC relocations.

I looked at the implementation for aarch64 and I see some issues that I do not understand.

Sat, Aug 29, 9:27 PM
kib edited reviewers for D59269: x86: add support for TLSDESC relocations, added: jhb, jrtc27, mmel; removed: andrew.
Sat, Aug 29, 9:16 PM
kib updated the diff for D59269: x86: add support for TLSDESC relocations.

Fix dta/dtv tls_gen check consistency.

Sat, Aug 29, 9:15 PM
kib reopened D58094: Capsicumise truss(1).
Sat, Aug 29, 7:43 PM
kib added a reviewer for D58094: Capsicumise truss(1): jhb.
Sat, Aug 29, 7:43 PM
kib requested review of D59269: x86: add support for TLSDESC relocations.
Sat, Aug 29, 7:31 PM
kib accepted D59265: arm64 pmap: correct the condition for determining when to flush the icache.
Sat, Aug 29, 6:05 PM
kib committed rG420428718da7: tty: gracefully handle proctree_lock locking (authored by kib).
tty: gracefully handle proctree_lock locking
Sat, Aug 29, 9:44 AM
kib committed rG824f934bf9d5: tty: make tty_wait_background() aware of proctree_lock ownership (authored by kib).
tty: make tty_wait_background() aware of proctree_lock ownership
Sat, Aug 29, 9:44 AM
kib committed rG9bd3fe571221: tty: add tty_wait_proctree(9) (authored by kib).
tty: add tty_wait_proctree(9)
Sat, Aug 29, 9:44 AM
kib committed rGa15c71254afa: condvar.9: document cv_wait_sig_unblock(9) (authored by kib).
condvar.9: document cv_wait_sig_unblock(9)
Sat, Aug 29, 9:44 AM
kib committed rG0cc6c442964d: condvars(9): add cv_wait_sig_unlock() (authored by kib).
condvars(9): add cv_wait_sig_unlock()
Sat, Aug 29, 9:44 AM
kib added a comment to D59034: sendfile(2): rework compat implementation.
In D59034#1354663, @kib wrote:

Why passing struct sendile_args to kern_sendfile()? This is not how all other kern_* wrappers are done, and IMO is worse than flattening the args. You have to explicitly initialize the literal anyway, which makes it equivalent to list the function's argument in the call.

It's the lowest churn change since that's how sendfile() worked, but I could flatten the arguments (or use a different structure that would benefit slightly from default initialization.)

Sat, Aug 29, 8:52 AM
kib added a comment to D58855: namei: retry absolute symlink expansions from the native root.

How this behaves when there is more than one symlink in the path to resolve?

Sat, Aug 29, 8:47 AM
kib accepted D59255: vmstat: Drop vm_cnt compat hack.
Sat, Aug 29, 3:38 AM
kib accepted D59254: various: Fix nlist invocations.
Sat, Aug 29, 3:29 AM

Fri, Aug 28

kib requested review of D59252: pdopenpid(2): in cap mode, translate all errors from pdopenpid1() to ECAPMODE.
Fri, Aug 28, 6:00 PM
kib updated the diff for D58094: Capsicumise truss(1).

Rebase.
Use pdptrace(2) without syscall wrapper, now that the syscall is upstreamed.

Fri, Aug 28, 12:13 PM
kib committed rGddf62c83fc0a: sys/tests/kern/pdopenpid: pdopenpid(2) is allowed in cap mode (authored by kib).
sys/tests/kern/pdopenpid: pdopenpid(2) is allowed in cap mode
Fri, Aug 28, 12:06 PM
kib committed rG1d20ebb7bfc3: Regen (authored by kib).
Regen
Fri, Aug 28, 12:06 PM
kib committed rG1ac08a43cf65: pdfork.2: document cap mode, namely pdopenpid(2) and pdptrace(2) errors (authored by kib).
pdfork.2: document cap mode, namely pdopenpid(2) and pdptrace(2) errors
Fri, Aug 28, 12:06 PM
kib committed rG73c92a978cce: pdopenpid(2): allow in capability mode with restrictions (authored by kib).
pdopenpid(2): allow in capability mode with restrictions
Fri, Aug 28, 12:06 PM
kib committed rG68d4b311270e: kern: add p_canopen() (authored by kib).
kern: add p_canopen()
Fri, Aug 28, 12:06 PM
kib committed rG7006cb7bd22d: pdptrace(2): allow debugging in capability mode (authored by kib).
pdptrace(2): allow debugging in capability mode
Fri, Aug 28, 12:06 PM
kib committed rG3dfd63b58463: ptrace.2: document PT_GET_ABI_NAME (authored by kib).
ptrace.2: document PT_GET_ABI_NAME
Fri, Aug 28, 12:06 PM
kib committed rG6b9ef5dfc903: ptrace(2): add PT_GET_ABI_NAME request (authored by kib).
ptrace(2): add PT_GET_ABI_NAME request
Fri, Aug 28, 12:06 PM
kib committed rG45633600acad: pdfork.2, rights.4: document pdptrace(2), CAP_PTRACE, and pdfork(PD_PTRACE_CAP) (authored by kib).
pdfork.2, rights.4: document pdptrace(2), CAP_PTRACE, and pdfork(PD_PTRACE_CAP)
Fri, Aug 28, 12:06 PM
kib committed rG5f5910ba3826: tests/sys/kern/pdwait: adjust test for the addition of CAP_PTRACE (authored by kib).
tests/sys/kern/pdwait: adjust test for the addition of CAP_PTRACE
Fri, Aug 28, 12:06 PM
kib committed rG16ff23d1a702: Regen (authored by kib).
Regen
Fri, Aug 28, 12:06 PM
kib committed rG6d17a04fc61c: lib/libsys: export pdptrace(2) (authored by kib).
lib/libsys: export pdptrace(2)
Fri, Aug 28, 12:06 PM
kib committed rGf8c0616052e2: Add pdptrace(2) (authored by kib).
Add pdptrace(2)
Fri, Aug 28, 12:06 PM
kib committed rG9cea869940f1: ptrace: split sys_ptrace()/freebsd32_ptrace() (authored by kib).
ptrace: split sys_ptrace()/freebsd32_ptrace()
Fri, Aug 28, 12:06 PM
kib closed D58989: Allow pdptrace(2) and pdopenpid(2) in capability mode.
Fri, Aug 28, 12:05 PM
kib committed rGb2f300ee8fc0: sys/bsm/audit_kevents.h: add AUE_PDPTRACE (authored by kib).
sys/bsm/audit_kevents.h: add AUE_PDPTRACE
Fri, Aug 28, 12:05 PM
kib closed D59113: ptrace(PT_GET_ABI_NAME).
Fri, Aug 28, 12:05 PM
kib committed rGe8c313204887: pdfork(2): add PD_PTRACE_CAP flag (authored by kib).
pdfork(2): add PD_PTRACE_CAP flag
Fri, Aug 28, 12:05 PM
kib committed rG8c911d9a9890: kern/kern_descrip.c: export filecaps_fill() (authored by kib).
kern/kern_descrip.c: export filecaps_fill()
Fri, Aug 28, 12:05 PM
kib committed rG5f82dd8e9161: capsicum: add CAP_PTRACE (authored by kib).
capsicum: add CAP_PTRACE
Fri, Aug 28, 12:05 PM
kib closed D58094: Capsicumise truss(1).
Fri, Aug 28, 12:05 PM
kib closed D58586: pdptrace(2).
Fri, Aug 28, 12:05 PM
kib updated the diff for D58989: Allow pdptrace(2) and pdopenpid(2) in capability mode.
sys/tests/kern/pdopenpid: pdopenpid(2) is allowed in cap mode
Fri, Aug 28, 8:51 AM
kib updated the diff for D58586: pdptrace(2).

pdtrace.2: mention that pdtrace() does not clear errno unlike ptrace()
ptrace.2: cross-ref pdtrace(2)
pdwait tests: adjust for addition of CAP_PTRACE

Fri, Aug 28, 8:49 AM
kib updated the diff for D58989: Allow pdptrace(2) and pdopenpid(2) in capability mode.

Move ptrace_check_allowed() call into ptrace_useraction().
Fix sysctl mib name in ptrace.2.

Fri, Aug 28, 2:30 AM
kib added inline comments to D58989: Allow pdptrace(2) and pdopenpid(2) in capability mode.
Fri, Aug 28, 2:29 AM

Thu, Aug 27

kib accepted D59201: unix: Fix a socket leak.
Thu, Aug 27, 3:40 PM
kib added inline comments to D59201: unix: Fix a socket leak.
Thu, Aug 27, 3:18 PM
kib added a comment to D59115: kobj: allow multiple inheritance with per-class softc.

I'm also fine with it, thanks. Is the device_get_softc_class() function OK? That's actually the one I had the most trouble with.

Thu, Aug 27, 3:14 PM
kib updated the diff for D58989: Allow pdptrace(2) and pdopenpid(2) in capability mode.

Man page editing.

Thu, Aug 27, 3:12 PM
kib added inline comments to D58989: Allow pdptrace(2) and pdopenpid(2) in capability mode.
Thu, Aug 27, 3:10 PM
kib updated the diff for D58586: pdptrace(2).

Renamed to ptrace_useraction().
Fixed tid.
Fixed arguments to ptrace_action() in kern_ptrace().
Man page editing.

Thu, Aug 27, 3:10 PM
kib added inline comments to D58586: pdptrace(2).
Thu, Aug 27, 3:09 PM
kib accepted D59222: rangelock: Reimplement _rangelock_cookie_assert().
Thu, Aug 27, 2:45 PM
kib added inline comments to D59222: rangelock: Reimplement _rangelock_cookie_assert().
Thu, Aug 27, 2:08 PM
kib added inline comments to D59201: unix: Fix a socket leak.
Thu, Aug 27, 7:05 AM

Wed, Aug 26

kib added a comment to D59115: kobj: allow multiple inheritance with per-class softc.

kobj_total_data_size looks good — thanks!
kobj_instance_data_offset seems too long to me, and 'instance' is not entirely precise. Can we shorten it to kobj_data_offset?

Wed, Aug 26, 11:01 AM
kib committed rGac1026c4c8af: ofed/ipoib: convert to timer_setup linuxKPI (authored by kib).
ofed/ipoib: convert to timer_setup linuxKPI
Wed, Aug 26, 12:48 AM
kib committed rGff47081093c8: mlx5(4): convert to timer_setup() linuxKPI (authored by kib).
mlx5(4): convert to timer_setup() linuxKPI
Wed, Aug 26, 12:48 AM
kib committed rG1f1f7b638fef: tests/sys/posixshm/posixshm_test.c::accounting fix after st_size changes (authored by kib).
tests/sys/posixshm/posixshm_test.c::accounting fix after st_size changes
Wed, Aug 26, 12:48 AM
kib committed rG1d9c9fe83449: shmfd: consistently return size in 512 byte blocks for fstat(2) st_blocks (authored by kib).
shmfd: consistently return size in 512 byte blocks for fstat(2) st_blocks
Wed, Aug 26, 12:48 AM

Mon, Aug 24

kib accepted D59126: tty: Revalidate after dropping the tty lock in ioctl handlers.
Mon, Aug 24, 2:27 PM
kib added a comment to D59126: tty: Revalidate after dropping the tty lock in ioctl handlers.

I believe this is fine for the next batch, my patch requires more work.
[Cannot accept due to the review state]

Mon, Aug 24, 2:07 PM
kib updated the diff for D59113: ptrace(PT_GET_ABI_NAME).

Fix signed/unsigned comparison.
Report error on too long ABI name.
Man page improvements.

Mon, Aug 24, 1:56 PM
kib added a comment to D59115: kobj: allow multiple inheritance with per-class softc.

This is one of my dilemmas. KOBJ consistently uses 'baseclass', but 'kobj_offsetof_baseclass' or 'kobj_baseclass_offsetof' looks ugly, especially since these could also be used for the main/leaf class.

What about 'kobj_offsetof_class' and 'kobj_sizeof_class'?

Mon, Aug 24, 10:53 AM
kib added a comment to D59115: kobj: allow multiple inheritance with per-class softc.
In D59115#1355807, @kib wrote:

kobj should not mention 'softc', it is not limited to the driver support. It should be named more generally.

Completely agree, but despite my best efforts, I can't figure out which word to use instead of “softc”

Mon, Aug 24, 6:27 AM

Sun, Aug 23

kib added a comment to D59126: tty: Revalidate after dropping the tty lock in ioctl handlers.

This is fine, but I think that we can avoid the trouble by locking the proctree_lock around the ioctl handler instead. Please see D59132

Sun, Aug 23, 9:01 PM
kib accepted D58724: amd_iommu: Bound IVHD device-entry parsing.
Sun, Aug 23, 11:49 AM
kib added a comment to D58337: umtx: use a distribution-fair multiplier for the chain hash.

So hm, yay or nay on this?

Sun, Aug 23, 8:23 AM
kib added a reviewer for D59115: kobj: allow multiple inheritance with per-class softc: jhb.
Sun, Aug 23, 8:21 AM
kib added a comment to D59115: kobj: allow multiple inheritance with per-class softc.

kobj should not mention 'softc', it is not limited to the driver support. It should be named more generally.

Sun, Aug 23, 8:21 AM