Page MenuHomeFreeBSD

mjg (Mateusz Guzik)
nice guy

Projects

User Details

User Since
Jun 4 2014, 10:38 AM (271 w, 5 d)

Recent Activity

Yesterday

mjg committed rS351215: vfs: fix up r351193 ("stop always overwriting ->mnt_stat in VFS_STATFS").
vfs: fix up r351193 ("stop always overwriting ->mnt_stat in VFS_STATFS")
Mon, Aug 19, 2:12 PM

Sun, Aug 18

mjg committed rS351193: vfs: stop always overwriting ->mnt_stat in VFS_STATFS.
vfs: stop always overwriting ->mnt_stat in VFS_STATFS
Sun, Aug 18, 6:40 PM
mjg closed D21317: vfs: stop always overwriting ->mnt_stat in VFS_STATFS.
Sun, Aug 18, 6:40 PM
mjg created D21317: vfs: stop always overwriting ->mnt_stat in VFS_STATFS.
Sun, Aug 18, 5:15 PM

Sat, Aug 17

mjg committed rS351175: fork: rework locking around do_fork.
fork: rework locking around do_fork
Sat, Aug 17, 6:20 PM
mjg committed rS351174: fork: bump process count before checking for permission to cross the limit.
fork: bump process count before checking for permission to cross the limit
Sat, Aug 17, 5:56 PM
mjg committed rS351173: fork: stop skipping < 100 ids on wrap around.
fork: stop skipping < 100 ids on wrap around
Sat, Aug 17, 5:42 PM

Thu, Aug 15

mjg added a comment to D21206: libc: Add fdwalk(3), commonly used in Linux software.

I used alloca. It may be wasteful on the stack for a very poorly behaving process but it should be fine. I don't think paying for mmap is justified.

Thu, Aug 15, 12:10 PM
mjg added a comment to D21206: libc: Add fdwalk(3), commonly used in Linux software.

I think I sufficiently hacked this for inclusion. First the kernel part, then fdwalk itself.

Thu, Aug 15, 7:44 AM
mjg added a comment to D21206: libc: Add fdwalk(3), commonly used in Linux software.

I had an extra look and there is an extremely worrisome comment: apparently the routine is expected to by async-signal safe. This means both malloc and realloc are off the table. This can be worked around with having a statically sized buffer and requesting the bitmap in chunks which fit the buffer, i.e. pass the buffer and an offset (size of the buffer * iteration counter). See https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gspawn.c#L1182

Thu, Aug 15, 4:11 AM
mjg added a comment to D21206: libc: Add fdwalk(3), commonly used in Linux software.

So I had a look at glib. What's the benefit of adding this function to libc? All consumers are going to link to glib anyway. Perhaps we should get the kernel part in and then submit a patch to glib to use it.

Thu, Aug 15, 4:04 AM
mjg added inline comments to D21206: libc: Add fdwalk(3), commonly used in Linux software.
Thu, Aug 15, 3:56 AM

Tue, Aug 13

mjg added inline comments to D21206: libc: Add fdwalk(3), commonly used in Linux software.
Tue, Aug 13, 7:43 PM
mjg added inline comments to D21206: libc: Add fdwalk(3), commonly used in Linux software.
Tue, Aug 13, 7:37 PM
mjg added inline comments to D21206: libc: Add fdwalk(3), commonly used in Linux software.
Tue, Aug 13, 1:12 PM
mjg added inline comments to D21206: libc: Add fdwalk(3), commonly used in Linux software.
Tue, Aug 13, 1:07 PM

Sat, Aug 10

mjg added a comment to D21206: libc: Add fdwalk(3), commonly used in Linux software.

It's not hard to add such a sysctl. If you want I can hack it up for you. I think it should just export the fd bitmap, then iteration over it is trivial.

Sat, Aug 10, 10:26 PM

Sat, Jul 27

mjg added a comment to D21089: Handle reference count overflow in non-INVARIANTS kernels..

The entire thing can be probably hacked to be better, but I don't have good ideas as it is.

Sat, Jul 27, 9:12 PM

Sun, Jul 21

mjg accepted D21014: Convert refcount(9) to bool..
Sun, Jul 21, 5:27 PM

Jul 19 2019

D20947: Check and avoid overflow when incrementing fp->f_count in fget_unlocked() and fhold(). is now accepted and ready to land.
Jul 19 2019, 12:51 PM

Jul 18 2019

mjg accepted D20947: Check and avoid overflow when incrementing fp->f_count in fget_unlocked() and fhold()..
Jul 18 2019, 10:46 PM

Jul 14 2019

mjg added a comment to D20947: Check and avoid overflow when incrementing fp->f_count in fget_unlocked() and fhold()..

Architectures problematic in this regard definitely don't have anywhere near enough resources for a 32-bit overflow to be realistic, so they can stick to that size.

Jul 14 2019, 7:14 PM
mjg added a comment to D20947: Check and avoid overflow when incrementing fp->f_count in fget_unlocked() and fhold()..

Note I did not propose converting refcount to long (or 64-bit). I proposed adding a long (or 64-bit) variant.

Jul 14 2019, 6:53 PM
mjg added a comment to D20947: Check and avoid overflow when incrementing fp->f_count in fget_unlocked() and fhold()..
In D20947#454096, @kib wrote:
In D20947#454095, @mjg wrote:

Looks like the type needs to be grown to an unsigned long instead. size-wise the struct already exceeds one cache line and I failed to find a way to shrink it.

Long would not help on ILP32 arches.

Jul 14 2019, 12:16 PM

Jul 13 2019

mjg added a comment to D20947: Check and avoid overflow when incrementing fp->f_count in fget_unlocked() and fhold()..

I don't think this is the right fix. There is other code bumping the count (with fhold()) and that is still unchecked.

Jul 13 2019, 9:47 PM

Jun 29 2019

mjg added a comment to D20800: Use a consistent snapshot of the fd's rights in fget_mmap()..

It's not about just copying. fget_unlocked is severely pessimized right now and so happens to amount of __predict_true/false convinces clang to not generated a jump fest for the common case.

Jun 29 2019, 7:19 PM
mjg added a comment to D20800: Use a consistent snapshot of the fd's rights in fget_mmap()..

Half-scratch my previous comment. Of course at the time the state is already possibly in flux so it has to be moved away if assertions are to be kept. See the other point though.

Jun 29 2019, 4:13 AM

Jun 28 2019

mjg added a comment to D20800: Use a consistent snapshot of the fd's rights in fget_mmap()..

I don't think it's useful to move it out, it's an avoidable branch. i.e. I think it would be better to:

Jun 28 2019, 11:17 PM
D20784: Fix mutual exclusion in pipe_direct_write(). is now accepted and ready to land.
Jun 28 2019, 5:10 AM

Jun 27 2019

mjg added inline comments to D20784: Fix mutual exclusion in pipe_direct_write()..
Jun 27 2019, 10:48 PM

Jun 7 2019

mjg added inline comments to D16744: Document seqc(9).
Jun 7 2019, 8:36 PM

May 25 2019

mjg added a comment to D20411: Add devfs(5) support for VOP_MKDIR(9) and VOP_RMDIR(9).

I think arbitrary mkdir/rmdir is a can of worms, perfectly avoidable for the stated purpose. lindevfs module could be created to extend devfs mount points with whatever is necessary. Preferably this would be a completely separate fs, but that's probably too problematic. i.e. currently the module would make_dev("shm") on it's own. the func can create directories and if it insists on getting a device, a separate variant can be added.

May 25 2019, 8:50 PM

May 12 2019

mjg updated the summary of D20243: [wip] extend MNT_VNODE_FOREACH macro with callback argument and use it to filter vnodes for tmpfs mtime.
May 12 2019, 7:58 AM
mjg committed rS347510: cache: fix a brainfart in r347505.
cache: fix a brainfart in r347505
May 12 2019, 7:56 AM
mjg committed rS347507: seqc: fix sed-introduced typos (seqcuence -> sequence).
seqc: fix sed-introduced typos (seqcuence -> sequence)
May 12 2019, 7:13 AM
mjg committed rS347506: amd64: tidy up pagezero*/pagecopy (movq -> movl).
amd64: tidy up pagezero*/pagecopy (movq -> movl)
May 12 2019, 7:11 AM
mjg committed rS347505: cache: bump numcache on entry, while here fix lnumcache type.
cache: bump numcache on entry, while here fix lnumcache type
May 12 2019, 6:59 AM
mjg committed rS347504: amd64: fixup MEMMOVE comment (10 -> r10).
amd64: fixup MEMMOVE comment (10 -> r10)
May 12 2019, 6:42 AM
mjg committed rS347503: cache: push sdt probes in cache_zap_locked to code doing the work.
cache: push sdt probes in cache_zap_locked to code doing the work
May 12 2019, 6:39 AM
mjg committed rS347502: x86: store pending bitmapped IPIs in per-cpu areas.
x86: store pending bitmapped IPIs in per-cpu areas
May 12 2019, 6:37 AM
mjg committed rS347501: amd64: stop re-reading curpc in suword.
amd64: stop re-reading curpc in suword
May 12 2019, 6:35 AM
mjg committed rS347500: random(4): depessimize arc4random.
random(4): depessimize arc4random
May 12 2019, 6:33 AM
mjg closed D20242: Depessimize arc4rand.
May 12 2019, 6:33 AM
mjg created D20244: nullfs: lock the vnode with LK_SHARED in null_vptocnp.
May 12 2019, 2:46 AM
mjg created D20243: [wip] extend MNT_VNODE_FOREACH macro with callback argument and use it to filter vnodes for tmpfs mtime.
May 12 2019, 2:02 AM
mjg created D20242: Depessimize arc4rand.
May 12 2019, 1:52 AM

May 10 2019

mjg added a comment to D2051: Use an rmlock to lock vfs cache.

No. Locking was significantly revamped and the problem at hand us unlikely to be encountered. Should it be encountered, the new (much finer-grained) locking can be modified to use exclusive-only locks. The speed up as reported here was disputed on the mailing lists and was likely not present.

May 10 2019, 2:10 AM

May 8 2019

mjg closed D20160: Reduce umtx-related work on exec and exit.
May 8 2019, 4:30 PM
mjg committed rS347355: Reduce umtx-related work on exec and exit.
Reduce umtx-related work on exec and exit
May 8 2019, 4:30 PM
mjg added inline comments to D20160: Reduce umtx-related work on exec and exit.
May 8 2019, 4:27 PM

May 7 2019

mjg added inline comments to D20160: Reduce umtx-related work on exec and exit.
May 7 2019, 7:57 PM
mjg updated the diff for D20160: Reduce umtx-related work on exec and exit.
  • remove proc locking in the first place
May 7 2019, 7:56 PM

May 4 2019

mjg created D20160: Reduce umtx-related work on exec and exit.
May 4 2019, 10:38 PM
mjg committed rS347132: sysv: get rid of fork/exit hooks if the code is compiled in.
sysv: get rid of fork/exit hooks if the code is compiled in
May 4 2019, 7:05 PM
mjg committed rS347131: Annotate nprocs with __exclusive_cache_line.
Annotate nprocs with __exclusive_cache_line
May 4 2019, 7:04 PM

Apr 24 2019

mjg added a comment to D19923: Switch to use shared vnode locks for text files during image activation..

This works fine

Apr 24 2019, 4:30 PM
mjg added a comment to D19923: Switch to use shared vnode locks for text files during image activation..

Extended the patch with:

+       if (!(((object->flags & OBJ_TMPFS) == 0 &&
+           object->type == OBJT_VNODE) ||
+           ((object->flags & OBJ_TMPFS) != 0 &&
+           object->type == OBJT_SWAP)))
+               printf("obj %p flags %x type %d\n", object, object->flags, object->type);
Apr 24 2019, 12:30 PM
mjg added a comment to D19923: Switch to use shared vnode locks for text files during image activation..

Sorry, I meant early when running poudriere. vp is NULL in vm_map_entry_inc_vnode_text. Can be trivially reproduced by having the shell fork when backed by tmpfs, in particular unpacking world, 'chroot . sh' + 'ls' do the trick.

Apr 24 2019, 11:38 AM

Apr 23 2019

mjg added a comment to D19923: Switch to use shared vnode locks for text files during image activation..

This crashes for me early on:

Apr 23 2019, 8:18 PM
mjg accepted D19997: MFC r324736:.
Apr 23 2019, 5:12 PM

Apr 18 2019

mjg added a comment to D19923: Switch to use shared vnode locks for text files during image activation..

I gave it a spin with poudriere and it panics:

Apr 18 2019, 4:28 PM

Apr 14 2019

mjg accepted D19887: fix the NFSv4 client so that it doesn't call pfind() with a mutex held.
Apr 14 2019, 9:03 PM
mjg added inline comments to D19887: fix the NFSv4 client so that it doesn't call pfind() with a mutex held.
Apr 14 2019, 1:08 PM
mjg added inline comments to D19908: Provide accounting of user-wired pages..
Apr 14 2019, 1:02 PM

Apr 12 2019

mjg added inline comments to D19887: fix the NFSv4 client so that it doesn't call pfind() with a mutex held.
Apr 12 2019, 3:23 AM

Apr 5 2019

mjg accepted D19825: Set the oppid field of orphans when exiting..
Apr 5 2019, 12:57 AM

Apr 3 2019

mjg committed rS345853: rctl: fix sysctl kern.racct.enable use after r341182.
rctl: fix sysctl kern.racct.enable use after r341182
Apr 3 2019, 8:37 PM

Mar 27 2019

mjg added inline comments to D19690: mount/unmount events to devd.
Mar 27 2019, 11:53 PM · Contributor Reviews (base)

Mar 25 2019

mjg added a comment to D19690: mount/unmount events to devd.

What's the motivation for this functionality?

Mar 25 2019, 12:23 PM · Contributor Reviews (base)

Mar 13 2019

mjg added a comment to D18930: Per-thread credentials.

So I'm in the process of reviewing this. I don't have a complete review yet, but I do have some comments.

Mar 13 2019, 12:32 AM

Mar 12 2019

mjg updated the summary of D19563: amd64: clean up cpu_switch.S.
Mar 12 2019, 3:35 PM
mjg created D19563: amd64: clean up cpu_switch.S.
Mar 12 2019, 3:34 PM

Feb 27 2019

mjg committed rS344648: Rename seq to seqc to avoid namespace clashes with Linux.
Rename seq to seqc to avoid namespace clashes with Linux
Feb 27 2019, 10:57 PM
mjg committed rS344647: vm: remove seq.h inclusion made obsolete by NUMA rewrite.
vm: remove seq.h inclusion made obsolete by NUMA rewrite
Feb 27 2019, 10:42 PM

Feb 26 2019

mjg accepted D19295: Teach truss(1) about fsync(2) and fdatasync(2)..
Feb 26 2019, 6:55 PM

Feb 5 2019

mjg accepted D19083: extattr_list_vp: Narrow locked section somewhat.
Feb 5 2019, 3:36 AM
mjg accepted D19082: extattr_list_vp: Only take shared vnode lock.

Lock acquisition can be moved few lines later, after branching on data. Similarly, unlock can be done earlier.

Feb 5 2019, 3:27 AM

Feb 1 2019

mjg added a comment to D18930: Per-thread credentials.

That's an error-prone approach. You should always have separate references for both ucred and pucred.

Feb 1 2019, 4:34 PM

Jan 30 2019

mjg added a comment to D18930: Per-thread credentials.

I don't have an opinion about the userspace API. It does seem a little bit fishy that there is no tight control from that end. I would expect a fully-privileged daemon to get create a credfd an allow certain uids/gids to be switched to. Then it can drop privs. But again, I did not think this through.

Jan 30 2019, 4:43 PM

Jan 29 2019

mjg added inline comments to D18930: Per-thread credentials.
Jan 29 2019, 12:58 AM

Dec 28 2018

mjg accepted D18665: pfind, pfind_any: Correct zombie logic.

Oops, indeed. Thanks for the fix.

Dec 28 2018, 12:40 AM

Dec 27 2018

mjg added inline comments to D18658: top: fix PID sorting after r340742; add process birth time sorting.
Dec 27 2018, 9:03 PM
mjg added inline comments to D18658: top: fix PID sorting after r340742; add process birth time sorting.
Dec 27 2018, 9:01 PM

Dec 20 2018

mjg added a comment to D18618: Make kernel print jail ID when logging a process exit..

See this review https://reviews.freebsd.org/D27

Dec 20 2018, 11:29 AM
mjg added a comment to D18580: Accept always TCP segment with SEG.SEQ==RCV.NXT.

I have a machine where I reliably fail to git clone postgres repository, it always gets stuck at about 20%. This patch fixes it.

Dec 20 2018, 1:48 AM

Dec 19 2018

mjg committed rS342267: MFC r342053.
MFC r342053
Dec 19 2018, 11:29 PM
mjg committed rS342264: Check for probes enabled in priv_check_cred before evaluting the error..
Check for probes enabled in priv_check_cred before evaluting the error.
Dec 19 2018, 11:28 PM
mjg committed rS342262: Provide SDT_PROBES_ENABLED for kernels without KDTRACE..
Provide SDT_PROBES_ENABLED for kernels without KDTRACE.
Dec 19 2018, 11:19 PM
mjg committed rS342250: MFC r340676,r340677,r340679,r340747,r340749,r341682.
MFC r340676,r340677,r340679,r340747,r340749,r341682
Dec 19 2018, 10:42 PM
mjg committed rS342249: MFC r340482,r341724.
MFC r340482,r341724
Dec 19 2018, 10:38 PM
mjg committed rS342248: MFC r340410.
MFC r340410
Dec 19 2018, 10:31 PM
mjg committed rS342247: mac: reduce pessimization of sdt probe handling.
mac: reduce pessimization of sdt probe handling
Dec 19 2018, 10:30 PM
mjg committed rS342245: Remove iBCS2: plug a wart missed in r342242.
Remove iBCS2: plug a wart missed in r342242
Dec 19 2018, 10:09 PM
mjg committed rS342244: Remove iBCS2, part3: the implementation.
Remove iBCS2, part3: the implementation
Dec 19 2018, 10:03 PM
mjg committed rS342243: Remove iBCS2, part2: general kernel.
Remove iBCS2, part2: general kernel
Dec 19 2018, 9:58 PM
mjg committed rS342242: Remove iBCS2, part1: userspace.
Remove iBCS2, part1: userspace
Dec 19 2018, 9:57 PM
mjg closed D18435: Manage process-related IDs with bitmaps.

This already landed in r342237, I see I forgot to add the line.

Dec 19 2018, 9:29 PM
mjg committed rS342240: MFC r341272,r341273,r341351.
MFC r341272,r341273,r341351
Dec 19 2018, 9:26 PM
mjg committed rS342239: MFC r341719.
MFC r341719
Dec 19 2018, 9:04 PM
mjg committed rS342238: MFC r341364.
MFC r341364
Dec 19 2018, 9:03 PM