-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linprocfs: Add support for proc/sysvipc/{msg,sem,shm} #1218
Conversation
9f5497e
to
1231ad5
Compare
1231ad5
to
394783b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of poorly handled races I think?
394783b
to
9ab9db6
Compare
In some cases, the USB_QUIRK_VP macro was being misused. Instead of setting quirks to the intended value, the first two supplied quirks would go into lo_rev and hi_rev. Replace it with USB_QUIRK_VO which only takes the needed args. This also makes the Dummy products, which where being used to correctly set vendor only quirks, not necessary. Reviewed by: imp Pull Request: freebsd#1153
Seperate usb quirks that target specific revisions from those that dont. Alot of the quirks dont use lo_rev and hi_rev, so we can abstract the 0x0000, 0xffff into a macro. [[ This commit is a bit more churn than we like. I carefully reviewed each one and they are all good. The end product is better -- imp ]] Reviewed by: imp Pull Request: freebsd#1153
Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: imp Pull Request: freebsd#1218
I've had to revert this. There's a race and some issues with it that need to be resolved. Please either reopen with them fixed, or create a new review and reference this one in the first comment. |
msqids[id].u.msg_stime, | ||
msqids[id].u.msg_rtime, | ||
msqids[id].u.msg_ctime); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These times need to be cast to (intmax_t) and %jd should be used to print them.
if (msgmni != msginfo.msgmni) { | ||
free(msqids, M_TEMP); | ||
goto again; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is msginfo.msgmni changing? It would be better to just reply on the sysctl to get the data. It will return ENOMEM when the data size is too small. The case where it's too big is now handled corrected.
semids[id].u.sem_perm.cgid, | ||
semids[id].u.sem_otime, | ||
semids[id].u.sem_ctime); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above: intmax_t cast.
free(semids, M_TEMP); | ||
goto again; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. I think removing this check and keying off ENOMEM in the sysctl return value is the cleaner way to deal with this since we don't seem to have a cleaner, race-free interface to extract this info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. I think removing this check and keying off ENOMEM in the sysctl return value is the cleaner way to deal with this since we don't seem to have a cleaner, race-free interface to extract this info.
What do you mean by "keying off ENOMEM" ?
free(shmids, M_TEMP); | ||
goto again; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same again race.
shmids[id].u.shm_atime, | ||
shmids[id].u.shm_dtime, | ||
shmids[id].u.shm_ctime, | ||
0, 0); /* XXX rss & swp are not supported */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same again intmax_t cast.
if ((shmids[id].u.shm_perm.mode & SHMSEG_ALLOCATED) != 0) | ||
sbuf_printf(sb, | ||
"%10d %10lu %4o %21lu %5u %5u %5u %5u %5u %5u %5u %10ld %10ld %10ld %21d %21d\n", | ||
(int) shmids[id].u.shm_perm.key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the %21lu should be %21zu because this is a size_t.
Also from kib: "The recheck is more problematic, I do agree. Also, I realized one more |
We already have these at EOF:
|
Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: imp Pull Request: freebsd/freebsd-src#1218
Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: imp Pull Request: freebsd/freebsd-src#1218
Add support for proc/sysvipc/{msg,sem,shm}
Tracking in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278812
To build:
cd /sys/modules/linprocfs
make && doas make install && doas cp -f /boot/modules/linprocfs.ko /boot/kernel/
doas kldxref /boot/kernel/
doas umount -a -t linprocfs
doas kldunload -v linprocfs
doas kldload -v linprocfs
doas mount -t linprocfs linprocfs /compat/linux/proc/
How I tested it (needs
ipcmk
from theutil-linux
package):The filtering is the same as done by
ipcs
:Format string adapted from: