svn commit: r355839 - head/lib/libvmmapi
Author: araujo Date: Tue Dec 17 01:37:02 2019 New Revision: 355839 URL: https://svnweb.freebsd.org/changeset/base/355839 Log: Forgotten to remove the previous if statement in commit r355838. MFC after:1 month Differential Revision:https://reviews.freebsd.org/D19400 Modified: head/lib/libvmmapi/vmmapi.c Modified: head/lib/libvmmapi/vmmapi.c == --- head/lib/libvmmapi/vmmapi.c Tue Dec 17 01:33:26 2019(r355838) +++ head/lib/libvmmapi/vmmapi.c Tue Dec 17 01:37:02 2019(r355839) @@ -106,10 +106,8 @@ int vm_create(const char *name) { /* Try to load vmm(4) module before creating a guest. */ - if (modfind("vmm") < 0) { - if (modfind("vmm") < 0) - kldload("vmm"); - } + if (modfind("vmm") < 0) + kldload("vmm"); return (CREATE((char *)name)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355838 - head/lib/libvmmapi
Author: araujo Date: Tue Dec 17 01:33:26 2019 New Revision: 355838 URL: https://svnweb.freebsd.org/changeset/base/355838 Log: Attempt to load vmm(4) module before creating a guest using vm_create() wrapper in libvmmapi. Submitted by: Rob Fairbanks Reviewed by: jhb MFC after:1 month Differential Revision:https://reviews.freebsd.org/D19400 Modified: head/lib/libvmmapi/vmmapi.c Modified: head/lib/libvmmapi/vmmapi.c == --- head/lib/libvmmapi/vmmapi.c Tue Dec 17 00:13:45 2019(r355837) +++ head/lib/libvmmapi/vmmapi.c Tue Dec 17 01:33:26 2019(r355838) @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -103,7 +105,11 @@ vm_device_open(const char *name) int vm_create(const char *name) { - + /* Try to load vmm(4) module before creating a guest. */ + if (modfind("vmm") < 0) { + if (modfind("vmm") < 0) + kldload("vmm"); + } return (CREATE((char *)name)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r350433 - head/sys/dev/sound/pci/hda
Author: araujo Date: Tue Jul 30 02:01:49 2019 New Revision: 350433 URL: https://svnweb.freebsd.org/changeset/base/350433 Log: Fix sound on headset jack for ALC255 and ALC256 codec. PR: 219350 [1], [2] Submitted by: Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1] Neel Chauhan (neel_at_neelc.org) [2] uri Momotyuk (yurkis_at_gmail.com) [3] Reported by: miwi Reviewed by: mav Obtained from:https://github.com/trueos/trueos/pull/279 [3] MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D19017 Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c head/sys/dev/sound/pci/hda/hdac.h Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c == --- head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Jul 29 22:07:43 2019 (r350432) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Tue Jul 30 02:01:49 2019 (r350433) @@ -425,12 +425,21 @@ hdac_pin_patch(struct hdaa_widget *w) } else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) { switch (nid) { case 24: - config = 0x01a1913c; + config = 0x01a1913c; break; case 26: - config = 0x01a1913d; + config = 0x01a1913d; break; } + } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR ) { + switch (nid) { + case 20: + patch = "as=1 seq=0"; + break; + case 33: + patch = "as=1 seq=15"; + break; + } } if (patch != NULL) @@ -768,6 +777,10 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo) hdaa_write_coef(dev, 0x20, 0x07, 0x7cb); } break; + } + if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) { + val = hdaa_read_coef(dev, 0x20, 0x46); + hdaa_write_coef(dev, 0x20, 0x46, val|0x3000); } if (subid == APPLE_INTEL_MAC) hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, Modified: head/sys/dev/sound/pci/hda/hdac.h == --- head/sys/dev/sound/pci/hda/hdac.h Mon Jul 29 22:07:43 2019 (r350432) +++ head/sys/dev/sound/pci/hda/hdac.h Tue Jul 30 02:01:49 2019 (r350433) @@ -203,6 +203,7 @@ #define DELL_XPSM1210_SUBVENDORHDA_MODEL_CONSTRUCT(DELL, 0x01d7) #define DELL_OPLX745_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01da) #define DELL_XPS9560_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x07be) +#define DELL_I7577_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x0802) #define DELL_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x) /* Clevo */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349361 - head/usr.sbin/bhyve
Author: araujo Date: Tue Jun 25 06:24:56 2019 New Revision: 349361 URL: https://svnweb.freebsd.org/changeset/base/349361 Log: Add SPDX tags to bhyve(8) HD Audio device. Reviewed by: bcran Differential Revision:https://reviews.freebsd.org/D20750 Replaced: head/usr.sbin/bhyve/audio.c - copied, changed from r349351, head/usr.sbin/bhyve/audio.c head/usr.sbin/bhyve/audio.h - copied, changed from r349351, head/usr.sbin/bhyve/audio.h head/usr.sbin/bhyve/hda_codec.c - copied, changed from r349351, head/usr.sbin/bhyve/hda_codec.c head/usr.sbin/bhyve/hda_reg.h - copied, changed from r349351, head/usr.sbin/bhyve/hda_reg.h head/usr.sbin/bhyve/hdac_reg.h - copied, changed from r349351, head/usr.sbin/bhyve/hdac_reg.h head/usr.sbin/bhyve/pci_hda.c - copied, changed from r349351, head/usr.sbin/bhyve/pci_hda.c head/usr.sbin/bhyve/pci_hda.h - copied, changed from r349351, head/usr.sbin/bhyve/pci_hda.h Copied and modified: head/usr.sbin/bhyve/audio.c (from r349351, head/usr.sbin/bhyve/audio.c) == --- head/usr.sbin/bhyve/audio.c Tue Jun 25 02:35:22 2019(r349351, copy source) +++ head/usr.sbin/bhyve/audio.c Tue Jun 25 06:24:56 2019(r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/audio.h (from r349351, head/usr.sbin/bhyve/audio.h) == --- head/usr.sbin/bhyve/audio.h Tue Jun 25 02:35:22 2019(r349351, copy source) +++ head/usr.sbin/bhyve/audio.h Tue Jun 25 06:24:56 2019(r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/hda_codec.c (from r349351, head/usr.sbin/bhyve/hda_codec.c) == --- head/usr.sbin/bhyve/hda_codec.c Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/hda_codec.c Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/hda_reg.h (from r349351, head/usr.sbin/bhyve/hda_reg.h) == --- head/usr.sbin/bhyve/hda_reg.h Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/hda_reg.h Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Stephane E. Potvin * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/hdac_reg.h (from r349351, head/usr.sbin/bhyve/hdac_reg.h) == --- head/usr.sbin/bhyve/hdac_reg.h Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/hdac_reg.h Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Stephane E. Potvin * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/pci_hda.c (from r349351, head/usr.sbin/bhyve/pci_hda.c) == --- head/usr.sbin/bhyve/pci_hda.c Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/pci_hda.c Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/pci_hda.h (from r349351, head/usr.sbin/bhyve/pci_hda.h) == --- head/usr.sbin/bhyve/pci_hda.h Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/pci_hda.h Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r345171 - head/usr.sbin/bhyve
> > > > head/usr.sbin/bhyve/pci_emul.c > > > > > > > > > > > > Modified: head/usr.sbin/bhyve/pci_emul.c > > > > > > > > > > > > > > > == > > > > > > --- head/usr.sbin/bhyve/pci_emul.cFri Mar 15 02:11:27 2019 > > > > > (r345170) > > > > > > +++ head/usr.sbin/bhyve/pci_emul.cFri Mar 15 02:11:28 2019 > > > > > (r345171) > > > > > > @@ -953,7 +953,10 @@ pci_emul_add_pciecap(struct pci_devinst > *pi, int > > > > > type) > > > > > > bzero(, sizeof(pciecap)); > > > > > > > > > > > > pciecap.capid = PCIY_EXPRESS; > > > > > > - pciecap.pcie_capabilities = PCIECAP_VERSION | > > > PCIEM_TYPE_ROOT_PORT; > > > > > > + pciecap.pcie_capabilities = PCIECAP_VERSION | type; > > > > > > + /* Devices starting with version 1.1 must set the RBER bit > */ > > > > > > + if (PCIECAP_VERSION >= 1) > > > > > > + pciecap.dev_capabilities = PCIEM_CAP_ROLE_ERR_RPT; > > > > > > pciecap.link_capabilities = 0x411; /* gen1, x1 */ > > > > > > pciecap.link_status = 0x11; /* gen1, x1 */ > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Rod Grimes > > > > > rgri...@freebsd.org > > > > > > > > > > > > > > > > -- > > > Rod Grimes > > > rgri...@freebsd.org > > > > > -- > Rod Grimes > rgri...@freebsd.org > > Rod, again, I don't really want to be rude!!! But have you tried to write a blog or something like that with the ideas that you have instead to write an email and press send? Sometimes we are eager to reply every each email, but if we wait for a while that desire disappears and we will realize if we send that email or not would not change anything. I'm not trying to be sarcastic here, my point is, somebody commit something and someone else replies in public is because there is something really wrong and needs everybody attention. Maybe if you really think there is something wrong, first reply in private to that person and then escalete to public if the matters were not solved. Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r345171 - head/usr.sbin/bhyve
Em sáb, 16 de mar de 2019 às 00:03, Rodney W. Grimes < free...@gndrsh.dnsmgr.net> escreveu: > > Em sex, 15 de mar de 2019 ?s 22:12, Ian Lepore > escreveu: > > > > > On Thu, 2019-03-14 at 19:31 -0700, Rodney W. Grimes wrote: > > > > > Author: chuck > > > > > Date: Fri Mar 15 02:11:28 2019 > > > > > New Revision: 345171 > > > > > URL: https://svnweb.freebsd.org/changeset/base/345171 > > > > > > > > > > Log: > > > > > Fix bhyve PCIe capability emulation > > > > > > > > > > PCIe devices starting with version 1.1 must set the Role-Based > > > > > Error > > > > > Reporting bit. > > > > > > > > > > And while we're in the neighborhood, generalize the code > > > > > assigning the > > > > > device type. > > > > > > > > > > Reviewed by: imp, araujo, rgrimes > > > > > Approved by: imp (mentor) > > > > > MFC after:1 week > > > > > Differential Revision: https://reviews.freebsd.org/D19580 > > > > > > > > This code requires maintainer approval before a commit, > > > > though this was well reviewed that doesnt exclude it > > > > from the MAINTAINERS entry. > > > > > > > > > > Where exactly does it say that in MAINTAINERS? As another victim of > > > this sort of drive-by lynching after making a trivial bhyve change I > > > pretty seriously object to a vague and meaningless entry in MAINTAINERS > > > being used to pounce on anyone who dares to touch the precious bhyve > > > code. > > > > > > > There is a new entry on MAINTAINERS: > > https://svnweb.freebsd.org/base?view=revision=344631 > > > > > > > > > > There is no mention of bhyve in MAINTAINERS, for usr.sbin or elsewhere. > > > There is an entry for vmm(4), which to me does not say anything about > > > bhyve, yet somehow everybody is supposed to know what it means and > > > what-all territory it covers? > > > > > > IMO, this sort of hyper-proprietary pouncing on everyone who dares > > > change a single line of code is not productive. It is HIGHLY de- > > > motivating. Large sweeping design changes are one thing, but pouncing > > > on every tiny minor commit is just not helpful. > > > > > > > +1 > > > > I got so frustrated with it recently that I have decided to don't > > contribute with bhyve anymore, perhaps even with FreeBSD. > > I still have some people under mentorship that I intend to finish and > then > > probably I will phase out. > > Your failure to get reviews, and infact even abandon one that had > negative advice as to the validity of your suggested change and > committing it anyway is more likely the cause here. > > You also committed code with no review at all that had to be reverted > after the bugs it caused were found by an external down stream consumers > of the bhyve code. > > You had code reverted by core due to a external attribution request, > which had you been attending the bi monthly bhyve calls you would of > known was an issue. > > I would suggest these are the reasons your feeling angry, and that > I infact tried to reach out to jhb to discuss some of these earlier > but that reach out was never returned. I under stand your frustration, > you are just wanting to do with best thing you can for the project > and bhyve, can we try to find a better resolution to this situation > than your exit? > > > > > -- Ian > > > > > > > Leave it for now, I am sure jhb or thyco are fine with it, > > > > this is just a heads up FYI for future commits. > > > > > > > > Bhyve code has been and still is under a fairly tight > > > > MAINTAINER status. > > > > > > > > > Modified: > > > > > head/usr.sbin/bhyve/pci_emul.c > > > > > > > > > > Modified: head/usr.sbin/bhyve/pci_emul.c > > > > > === > > > > > === > > > > > --- head/usr.sbin/bhyve/pci_emul.c Fri Mar 15 02:11:27 2019 > (r3 > > > > > 45170) > > > > > +++ head/usr.sbin/bhyve/pci_emul.c Fri Mar 15 02:11:28 2019 > (r3 > > > > > 45171) > > > > > @@ -953,7 +953,10 @@ pci_emul_add_pciecap(struct pci_devinst *pi, > > > > > int type) > &
Re: svn commit: r345171 - head/usr.sbin/bhyve
Em sex, 15 de mar de 2019 às 22:12, Ian Lepore escreveu: > On Thu, 2019-03-14 at 19:31 -0700, Rodney W. Grimes wrote: > > > Author: chuck > > > Date: Fri Mar 15 02:11:28 2019 > > > New Revision: 345171 > > > URL: https://svnweb.freebsd.org/changeset/base/345171 > > > > > > Log: > > > Fix bhyve PCIe capability emulation > > > > > > PCIe devices starting with version 1.1 must set the Role-Based > > > Error > > > Reporting bit. > > > > > > And while we're in the neighborhood, generalize the code > > > assigning the > > > device type. > > > > > > Reviewed by: imp, araujo, rgrimes > > > Approved by: imp (mentor) > > > MFC after:1 week > > > Differential Revision: https://reviews.freebsd.org/D19580 > > > > This code requires maintainer approval before a commit, > > though this was well reviewed that doesnt exclude it > > from the MAINTAINERS entry. > > > > Where exactly does it say that in MAINTAINERS? As another victim of > this sort of drive-by lynching after making a trivial bhyve change I > pretty seriously object to a vague and meaningless entry in MAINTAINERS > being used to pounce on anyone who dares to touch the precious bhyve > code. > There is a new entry on MAINTAINERS: https://svnweb.freebsd.org/base?view=revision=344631 > > There is no mention of bhyve in MAINTAINERS, for usr.sbin or elsewhere. > There is an entry for vmm(4), which to me does not say anything about > bhyve, yet somehow everybody is supposed to know what it means and > what-all territory it covers? > > IMO, this sort of hyper-proprietary pouncing on everyone who dares > change a single line of code is not productive. It is HIGHLY de- > motivating. Large sweeping design changes are one thing, but pouncing > on every tiny minor commit is just not helpful. > +1 I got so frustrated with it recently that I have decided to don't contribute with bhyve anymore, perhaps even with FreeBSD. I still have some people under mentorship that I intend to finish and then probably I will phase out. > > -- Ian > > > Leave it for now, I am sure jhb or thyco are fine with it, > > this is just a heads up FYI for future commits. > > > > Bhyve code has been and still is under a fairly tight > > MAINTAINER status. > > > > > Modified: > > > head/usr.sbin/bhyve/pci_emul.c > > > > > > Modified: head/usr.sbin/bhyve/pci_emul.c > > > === > > > === > > > --- head/usr.sbin/bhyve/pci_emul.c Fri Mar 15 02:11:27 2019(r3 > > > 45170) > > > +++ head/usr.sbin/bhyve/pci_emul.c Fri Mar 15 02:11:28 2019(r3 > > > 45171) > > > @@ -953,7 +953,10 @@ pci_emul_add_pciecap(struct pci_devinst *pi, > > > int type) > > > bzero(, sizeof(pciecap)); > > > > > > pciecap.capid = PCIY_EXPRESS; > > > - pciecap.pcie_capabilities = PCIECAP_VERSION | > > > PCIEM_TYPE_ROOT_PORT; > > > + pciecap.pcie_capabilities = PCIECAP_VERSION | type; > > > + /* Devices starting with version 1.1 must set the RBER bit */ > > > + if (PCIECAP_VERSION >= 1) > > > + pciecap.dev_capabilities = PCIEM_CAP_ROLE_ERR_RPT; > > > pciecap.link_capabilities = 0x411; /* gen1, x1 */ > > > pciecap.link_status = 0x11; /* gen1, x1 */ > > > > > > > > > > > > > > > > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r345158 - head/usr.sbin/bhyve
Em sex, 15 de mar de 2019 às 05:09, Conrad Meyer escreveu: > Author: cem > Date: Thu Mar 14 21:08:48 2019 > New Revision: 345158 > URL: https://svnweb.freebsd.org/changeset/base/345158 > > Log: > bhyve(8): Fix uart emulation bug > > THRE is always asserted in LSR reads, so REG_IER writes that raise > IER_ETXRDY must also set thre_int_pending. > > Reported by: Illumos, according to emaste@ > https://twitter.com/ed_maste/status/1106195949087584258 > MFC after:2 weeks > > Modified: > head/usr.sbin/bhyve/uart_emul.c > > Modified: head/usr.sbin/bhyve/uart_emul.c > > == > --- head/usr.sbin/bhyve/uart_emul.c Thu Mar 14 20:32:48 2019 > (r345157) > +++ head/usr.sbin/bhyve/uart_emul.c Thu Mar 14 21:08:48 2019 > (r345158) > @@ -431,6 +431,9 @@ uart_write(struct uart_softc *sc, int offset, uint8_t > sc->thre_int_pending = true; > break; > case REG_IER: > + /* Set pending when IER_ETXRDY is raised (edge-triggered). > */ > + if ((sc->ier & IER_ETXRDY) == 0 && (value & IER_ETXRDY) != > 0) > + sc->thre_int_pending = true; > /* > * Apply mask so that bits 4-7 are 0 > * Also enables bits 0-3 only if they're 1 > > Hi cem@, FYI: https://svnweb.freebsd.org/base?view=revision=344057 So there is some license concern around this patch, core@ reverted my first attempt to import this patch from Illumos. I guess core@ will ping you soon to do the same. There is a review made by the Illumos guys: https://reviews.freebsd.org/D19499 Pending now bhyve maintainer to approve it. Dark days, we had 2 committers trying to fix the same thing and our hands are tied. Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r345050 - head/bin/date
On Wed, Mar 13, 2019, 12:57 AM Warner Losh > > On Tue, Mar 12, 2019, 9:43 AM John Baldwin wrote: > >> On 3/11/19 10:43 PM, Warner Losh wrote: >> > On Mon, Mar 11, 2019 at 11:25 PM Rodney W. Grimes < >> free...@gndrsh.dnsmgr.net> >> > wrote: >> > >> Author: imp >> Date: Tue Mar 12 04:49:59 2019 >> New Revision: 345050 >> URL: https://svnweb.freebsd.org/changeset/base/345050 >> >> Log: >> Remove now useless -d and -t flags. >> >> These were used to set dst flag and minutes west of UTC >> respectively. These are obsolete and have been removed form the >> kernel. These existed primarily to faithfully emulate early >> Unix ABIs that have been removed from FreeBSD. >> >> Reviewed by: jbh@, brooks@ >> >> Nits: jhb@ and I see he did comment in the review, but he did not >> >> accept it as a reviewew at the top. >> >> >> > >> > This is why I think just the reference to the differential revision is >> > perfectly fine. Why duplicate data? Others complained I hadn't included >> it. >> > He commented, we discussed it on irc (though most of it was about how to >> > use arc better), etc. I thought it warranted it. So please don't >> nitpick. >> > This level is really annoying and frustrating. Does this really help us >> > produce a better product? >> >> To be fair, we have been pretty consistent that 'Reviewed by' in the >> commit >> means 'Accepted' in phab. I probably would have ended up accepting this >> anyway and just didn't click the box, so it's ok. However, we have had >> folks in the past who were tagged in the past and gave feedback, but >> didn't >> approve of the change, but were listed as 'Reviewed by' hence the current >> practice. >> > > But we talked about it outside phab, which to my mind puts it under the > old rules. And it's not Rod's job to police this detail. It would be up to > you to hassle me if I misinterpreted that extra communication wrong. > > Warner > First of all, I would like to apologize to anyone that might get offended with what I will write, but I can't miss this opportunity! In the past 2 years or so, almost everyday there is a new drama, always something nonsense, always one or another nosy individual looking after other people efforts. Is it what we want for FreeBSD? I have started to question myself where we as community will end up. Is there anybody else concerned? Or perhaps I'm the drama queen and overseeing the situation. We should change freefall message to: "don't make drama, make code!" Best, > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343642 - head/usr.sbin/bhyve
Author: araujo Date: Fri Feb 1 03:09:11 2019 New Revision: 343642 URL: https://svnweb.freebsd.org/changeset/base/343642 Log: Revert r343634: Mostly a cosmetic change to replace strlen with strnlen. Requested by: kib and imp Modified: head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/smbiostbl.c head/usr.sbin/bhyve/usb_mouse.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Fri Feb 1 03:02:52 2019 (r343641) +++ head/usr.sbin/bhyve/bhyverun.c Fri Feb 1 03:09:11 2019 (r343642) @@ -233,8 +233,8 @@ usage(int code) " -W: force virtio to use single-vector MSI\n" " -x: local apic is in x2APIC mode\n" " -Y: disable MPtable generation\n", - progname, (int)strnlen(progname, PATH_MAX), "", (int)strnlen(progname, PATH_MAX), "", - (int)strnlen(progname, PATH_MAX), ""); + progname, (int)strlen(progname), "", (int)strlen(progname), "", + (int)strlen(progname), ""); exit(code); } Modified: head/usr.sbin/bhyve/smbiostbl.c == --- head/usr.sbin/bhyve/smbiostbl.c Fri Feb 1 03:02:52 2019 (r343641) +++ head/usr.sbin/bhyve/smbiostbl.c Fri Feb 1 03:09:11 2019 (r343642) @@ -558,7 +558,7 @@ smbios_generic_initializer(struct smbios_structure *te int len; string = template_strings[i]; - len = strnlen(string, SMBIOS_MAX_LENGTH) + 1; + len = strlen(string) + 1; memcpy(curaddr, string, len); curaddr += len; } @@ -611,7 +611,7 @@ smbios_type1_initializer(struct smbios_structure *temp return (-1); MD5Init(); - MD5Update(, vmname, strnlen(vmname, PATH_MAX)); + MD5Update(, vmname, strlen(vmname)); MD5Update(, hostname, sizeof(hostname)); MD5Final(digest, ); Modified: head/usr.sbin/bhyve/usb_mouse.c == --- head/usr.sbin/bhyve/usb_mouse.c Fri Feb 1 03:02:52 2019 (r343641) +++ head/usr.sbin/bhyve/usb_mouse.c Fri Feb 1 03:09:11 2019 (r343642) @@ -70,7 +70,6 @@ enum { UMSTR_MAX }; -#define UMOUSE_DESC_MAX_LEN32 static const char *umouse_desc_strings[] = { "\x04\x09", "BHYVE", @@ -442,7 +441,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer goto done; } - slen = 2 + strnlen(str, UMOUSE_DESC_MAX_LEN) * 2; + slen = 2 + strlen(str) * 2; udata[0] = slen; udata[1] = UDESC_STRING; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343634 - head/usr.sbin/bhyve
Em sex, 1 de fev de 2019 às 09:21, Konstantin Belousov escreveu: > On Fri, Feb 01, 2019 at 09:05:37AM +0800, Marcelo Araujo wrote: > > Em sex, 1 de fev de 2019 às 09:01, Konstantin Belousov < > kostik...@gmail.com> > > escreveu: > > > > > On Fri, Feb 01, 2019 at 08:40:11AM +0800, Marcelo Araujo wrote: > > > > Em sex, 1 de fev de 2019 às 08:36, Warner Losh > > > escreveu: > > > > > > > > > > > > > > > > > > > On Thu, Jan 31, 2019, 4:46 PM Konstantin Belousov < > kostik...@gmail.com > > > > > wrote: > > > > > > > > > >> On Thu, Jan 31, 2019 at 11:32:19PM +, Marcelo Araujo wrote: > > > > >> > Author: araujo > > > > >> > Date: Thu Jan 31 23:32:19 2019 > > > > >> > New Revision: 343634 > > > > >> > URL: https://svnweb.freebsd.org/changeset/base/343634 > > > > >> > > > > > >> > Log: > > > > >> > Mostly a cosmetic change to replace strlen with strnlen. > > > > >> This is not cosmetic, and more, for instance the usage() part of > the > > > > >> change > > > > >> does not make any sense to me. > > > > >> > > > > > > > > > > I specifically objected as well and was blown off. What gives? > > > > > > > > > > > > > I have asked you feedback and got none! I will revert the usage() > changes > > > > later then. > > > > > > I noted the usage() chunk because it is the first one in the commit and > > > I stopped after I see the obvious issues with it, not because it is the > > > only wrong part. > > > > > > > Are you implying that all the patch is wrong? > > I have no problem to revert it at all if you give me the right reason, it > > was basically a port from another project that also uses bhyve. > > By default, all uses of strncmp() and strncpy() are bugs. > Your commit message have no explanation what the change fixes/improves. > > So I looked at the second chunk, for smbios_generic_initializer(). It > also seems to be wrong. If template_string[i] length is greater than > SMBIOS_MAX_LENGTH, then the copied string is not nul-terminated. If its > length is less than the constant, then what is the point ? > > I also looked at the third chunk, smbios_type1_initializer(). I cannot > understand the reasoning behind it, at all. > > Only usb_mouse.c is left, I do not expect anything good from it. > Thanks kib, I will recheck the patch and open another review! I will revert this commit in a few. Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343634 - head/usr.sbin/bhyve
Em sex, 1 de fev de 2019 às 09:01, Konstantin Belousov escreveu: > On Fri, Feb 01, 2019 at 08:40:11AM +0800, Marcelo Araujo wrote: > > Em sex, 1 de fev de 2019 às 08:36, Warner Losh > escreveu: > > > > > > > > > > > On Thu, Jan 31, 2019, 4:46 PM Konstantin Belousov > > wrote: > > > > > >> On Thu, Jan 31, 2019 at 11:32:19PM +, Marcelo Araujo wrote: > > >> > Author: araujo > > >> > Date: Thu Jan 31 23:32:19 2019 > > >> > New Revision: 343634 > > >> > URL: https://svnweb.freebsd.org/changeset/base/343634 > > >> > > > >> > Log: > > >> > Mostly a cosmetic change to replace strlen with strnlen. > > >> This is not cosmetic, and more, for instance the usage() part of the > > >> change > > >> does not make any sense to me. > > >> > > > > > > I specifically objected as well and was blown off. What gives? > > > > > > > I have asked you feedback and got none! I will revert the usage() changes > > later then. > > I noted the usage() chunk because it is the first one in the commit and > I stopped after I see the obvious issues with it, not because it is the > only wrong part. > Are you implying that all the patch is wrong? I have no problem to revert it at all if you give me the right reason, it was basically a port from another project that also uses bhyve. Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343634 - head/usr.sbin/bhyve
Em sex, 1 de fev de 2019 às 08:36, Warner Losh escreveu: > > > On Thu, Jan 31, 2019, 4:46 PM Konstantin Belousov wrote: > >> On Thu, Jan 31, 2019 at 11:32:19PM +0000, Marcelo Araujo wrote: >> > Author: araujo >> > Date: Thu Jan 31 23:32:19 2019 >> > New Revision: 343634 >> > URL: https://svnweb.freebsd.org/changeset/base/343634 >> > >> > Log: >> > Mostly a cosmetic change to replace strlen with strnlen. >> This is not cosmetic, and more, for instance the usage() part of the >> change >> does not make any sense to me. >> > > I specifically objected as well and was blown off. What gives? > I have asked you feedback and got none! I will revert the usage() changes later then. Best, > > Warner > > > >> > Obtained from: Project ACRN >> > MFC after: 2 weeks >> > >> > Modified: >> > head/usr.sbin/bhyve/bhyverun.c >> > head/usr.sbin/bhyve/smbiostbl.c >> > head/usr.sbin/bhyve/usb_mouse.c >> > >> > Modified: head/usr.sbin/bhyve/bhyverun.c >> > >> == >> > --- head/usr.sbin/bhyve/bhyverun.cThu Jan 31 23:21:18 2019 >> (r343633) >> > +++ head/usr.sbin/bhyve/bhyverun.cThu Jan 31 23:32:19 2019 >> (r343634) >> > @@ -233,8 +233,8 @@ usage(int code) >> > " -W: force virtio to use single-vector MSI\n" >> > " -x: local apic is in x2APIC mode\n" >> > " -Y: disable MPtable generation\n", >> > - progname, (int)strlen(progname), "", >> (int)strlen(progname), "", >> > - (int)strlen(progname), ""); >> > + progname, (int)strnlen(progname, PATH_MAX), "", >> (int)strnlen(progname, PATH_MAX), "", >> > + (int)strnlen(progname, PATH_MAX), ""); >> > >> > exit(code); >> > } >> > >> > Modified: head/usr.sbin/bhyve/smbiostbl.c >> > >> == >> > --- head/usr.sbin/bhyve/smbiostbl.c Thu Jan 31 23:21:18 2019 >> (r343633) >> > +++ head/usr.sbin/bhyve/smbiostbl.c Thu Jan 31 23:32:19 2019 >> (r343634) >> > @@ -558,7 +558,7 @@ smbios_generic_initializer(struct smbios_structure >> *te >> > int len; >> > >> > string = template_strings[i]; >> > - len = strlen(string) + 1; >> > + len = strnlen(string, SMBIOS_MAX_LENGTH) + 1; >> > memcpy(curaddr, string, len); >> > curaddr += len; >> > } >> > @@ -611,7 +611,7 @@ smbios_type1_initializer(struct smbios_structure >> *temp >> > return (-1); >> > >> > MD5Init(); >> > - MD5Update(, vmname, strlen(vmname)); >> > + MD5Update(, vmname, strnlen(vmname, PATH_MAX)); >> > MD5Update(, hostname, sizeof(hostname)); >> > MD5Final(digest, ); >> > >> > >> > Modified: head/usr.sbin/bhyve/usb_mouse.c >> > >> == >> > --- head/usr.sbin/bhyve/usb_mouse.c Thu Jan 31 23:21:18 2019 >> (r343633) >> > +++ head/usr.sbin/bhyve/usb_mouse.c Thu Jan 31 23:32:19 2019 >> (r343634) >> > @@ -70,6 +70,7 @@ enum { >> > UMSTR_MAX >> > }; >> > >> > +#define UMOUSE_DESC_MAX_LEN 32 >> > static const char *umouse_desc_strings[] = { >> > "\x04\x09", >> > "BHYVE", >> > @@ -441,7 +442,7 @@ umouse_request(void *scarg, struct usb_data_xfer >> *xfer >> > goto done; >> > } >> > >> > - slen = 2 + strlen(str) * 2; >> > + slen = 2 + strnlen(str, UMOUSE_DESC_MAX_LEN) * 2; >> > udata[0] = slen; >> > udata[1] = UDESC_STRING; >> > >> >> -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343634 - head/usr.sbin/bhyve
Author: araujo Date: Thu Jan 31 23:32:19 2019 New Revision: 343634 URL: https://svnweb.freebsd.org/changeset/base/343634 Log: Mostly a cosmetic change to replace strlen with strnlen. Obtained from:Project ACRN MFC after:2 weeks Modified: head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/smbiostbl.c head/usr.sbin/bhyve/usb_mouse.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Thu Jan 31 23:21:18 2019 (r343633) +++ head/usr.sbin/bhyve/bhyverun.c Thu Jan 31 23:32:19 2019 (r343634) @@ -233,8 +233,8 @@ usage(int code) " -W: force virtio to use single-vector MSI\n" " -x: local apic is in x2APIC mode\n" " -Y: disable MPtable generation\n", - progname, (int)strlen(progname), "", (int)strlen(progname), "", - (int)strlen(progname), ""); + progname, (int)strnlen(progname, PATH_MAX), "", (int)strnlen(progname, PATH_MAX), "", + (int)strnlen(progname, PATH_MAX), ""); exit(code); } Modified: head/usr.sbin/bhyve/smbiostbl.c == --- head/usr.sbin/bhyve/smbiostbl.c Thu Jan 31 23:21:18 2019 (r343633) +++ head/usr.sbin/bhyve/smbiostbl.c Thu Jan 31 23:32:19 2019 (r343634) @@ -558,7 +558,7 @@ smbios_generic_initializer(struct smbios_structure *te int len; string = template_strings[i]; - len = strlen(string) + 1; + len = strnlen(string, SMBIOS_MAX_LENGTH) + 1; memcpy(curaddr, string, len); curaddr += len; } @@ -611,7 +611,7 @@ smbios_type1_initializer(struct smbios_structure *temp return (-1); MD5Init(); - MD5Update(, vmname, strlen(vmname)); + MD5Update(, vmname, strnlen(vmname, PATH_MAX)); MD5Update(, hostname, sizeof(hostname)); MD5Final(digest, ); Modified: head/usr.sbin/bhyve/usb_mouse.c == --- head/usr.sbin/bhyve/usb_mouse.c Thu Jan 31 23:21:18 2019 (r343633) +++ head/usr.sbin/bhyve/usb_mouse.c Thu Jan 31 23:32:19 2019 (r343634) @@ -70,6 +70,7 @@ enum { UMSTR_MAX }; +#define UMOUSE_DESC_MAX_LEN32 static const char *umouse_desc_strings[] = { "\x04\x09", "BHYVE", @@ -441,7 +442,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer goto done; } - slen = 2 + strlen(str) * 2; + slen = 2 + strnlen(str, UMOUSE_DESC_MAX_LEN) * 2; udata[0] = slen; udata[1] = UDESC_STRING; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343077 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jan 16 03:46:27 2019 New Revision: 343077 URL: https://svnweb.freebsd.org/changeset/base/343077 Log: Fix broken uart on Win2016 guest. Obtained from:Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4) MFC after:3 weeks. Modified: head/usr.sbin/bhyve/uart_emul.c Modified: head/usr.sbin/bhyve/uart_emul.c == --- head/usr.sbin/bhyve/uart_emul.c Wed Jan 16 03:07:32 2019 (r343076) +++ head/usr.sbin/bhyve/uart_emul.c Wed Jan 16 03:46:27 2019 (r343077) @@ -431,6 +431,13 @@ uart_write(struct uart_softc *sc, int offset, uint8_t sc->thre_int_pending = true; break; case REG_IER: + /* Assert an interrupt if re-enabling the THRE intr, since we +* always report THRE as active in the status register. +*/ + if ((sc->ier & IER_ETXRDY) == 0 && + (value & IER_ETXRDY) != 0) { + sc->thre_int_pending = true; + } /* * Apply mask so that bits 4-7 are 0 * Also enables bits 0-3 only if they're 1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343068 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jan 16 00:39:23 2019 New Revision: 343068 URL: https://svnweb.freebsd.org/changeset/base/343068 Log: Use capsicum_helpers(3) that allow us to simplify the code and its functions will return success when the kernel is built without support of the capability mode. It is important to note, that I'm taking a more conservative approach with these changes and it will be done in small steps. Reviewed by: jhb MFC after:6 weeks Differential Revision:https://reviews.freebsd.org/D18744 Modified: head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/block_if.c head/usr.sbin/bhyve/consport.c head/usr.sbin/bhyve/dbgport.c head/usr.sbin/bhyve/gdb.c head/usr.sbin/bhyve/mevent.c head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_passthru.c head/usr.sbin/bhyve/pci_virtio_console.c head/usr.sbin/bhyve/pci_virtio_net.c head/usr.sbin/bhyve/pci_virtio_rnd.c head/usr.sbin/bhyve/rfb.c head/usr.sbin/bhyve/uart_emul.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/bhyverun.c Wed Jan 16 00:39:23 2019 (r343068) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -949,15 +948,13 @@ do_open(const char *vmname) #ifndef WITHOUT_CAPSICUM cap_rights_init(, CAP_IOCTL, CAP_MMAP_RW); - if (cap_rights_limit(vm_get_device_fd(ctx), ) == -1 && - errno != ENOSYS) + if (caph_rights_limit(vm_get_device_fd(ctx), ) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); vm_get_ioctls(); cmds = vm_get_ioctls(NULL); if (cmds == NULL) errx(EX_OSERR, "out of memory"); - if (cap_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); free((cap_ioctl_t *)cmds); #endif Modified: head/usr.sbin/bhyve/block_if.c == --- head/usr.sbin/bhyve/block_if.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/block_if.c Wed Jan 16 00:39:23 2019 (r343068) @@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -473,7 +476,7 @@ blockif_open(const char *optstr, const char *ident) if (ro) cap_rights_clear(, CAP_FSYNC, CAP_WRITE); - if (cap_rights_limit(fd, ) == -1 && errno != ENOSYS) + if (caph_rights_limit(fd, ) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif @@ -504,7 +507,7 @@ blockif_open(const char *optstr, const char *ident) psectsz = sbuf.st_blksize; #ifndef WITHOUT_CAPSICUM - if (cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1 && errno != ENOSYS) + if (caph_ioctls_limit(fd, cmds, nitems(cmds)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: head/usr.sbin/bhyve/consport.c == --- head/usr.sbin/bhyve/consport.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/consport.c Wed Jan 16 00:39:23 2019 (r343068) @@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$"); #endif #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -138,11 +141,9 @@ console_handler(struct vmctx *ctx, int vcpu, int in, i #ifndef WITHOUT_CAPSICUM cap_rights_init(, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); - if (cap_rights_limit(STDIN_FILENO, ) == -1 && - errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, ) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif ttyopen(); Modified: head/usr.sbin/bhyve/dbgport.c == --- head/usr.sbin/bhyve/dbgport.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/dbgport.c Wed Jan 16 00:39:23 2019 (r343068) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -167,7 +170,7 @@ init_dbgport(int sport) #ifndef WITHOUT_CAPSICUM
Re: svn commit: r342349 - head/usr.sbin/ctladm
Em sáb, 22 de dez de 2018 às 02:53, Alexander Motin escreveu: > On 21.12.2018 13:37, Marcelo Araujo wrote: > > Em sáb, 22 de dez de 2018 às 01:22, Alexander Motin > <mailto:m...@freebsd.org>> escreveu: > > > > Author: mav > > Date: Fri Dec 21 17:22:15 2018 > > New Revision: 342349 > > URL: https://svnweb.freebsd.org/changeset/base/342349 > > > > Log: > > Fix passing wrong variables to nvlist_destroy() after r333446. > > > > Reported by: Alexander Fedorov (IT-Grad.ru) > > MFC after:5 days > > > > > > Thanks to fix that! > > Welcome. > > > Out of curiosity, that was reported by email, bugzilla or any other > place? > Directly to me via OpenZFS slack. > > -- > Alexander Motin > Thank you! Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r342349 - head/usr.sbin/ctladm
Em sáb, 22 de dez de 2018 às 01:22, Alexander Motin escreveu: > Author: mav > Date: Fri Dec 21 17:22:15 2018 > New Revision: 342349 > URL: https://svnweb.freebsd.org/changeset/base/342349 > > Log: > Fix passing wrong variables to nvlist_destroy() after r333446. > > Reported by: Alexander Fedorov (IT-Grad.ru) > MFC after:5 days > Thanks to fix that! Out of curiosity, that was reported by email, bugzilla or any other place? Best, > > Modified: > head/usr.sbin/ctladm/ctladm.c > > Modified: head/usr.sbin/ctladm/ctladm.c > > == > --- head/usr.sbin/ctladm/ctladm.c Fri Dec 21 17:18:33 2018 > (r342348) > +++ head/usr.sbin/ctladm/ctladm.c Fri Dec 21 17:22:15 2018 > (r342349) > @@ -667,7 +667,7 @@ cctl_port(int fd, int argc, char **argv, char *combine > } > > bailout: > - nvlist_destroy(req.args_nvl); > + nvlist_destroy(option_list); > free(driver); > return (retval); > > @@ -2542,7 +2542,7 @@ cctl_create_lun(int fd, int argc, char **argv, char > *c > fprintf(stdout, "Device ID: %s\n", > req.reqdata.create.device_id); > > bailout: > - nvlist_destroy(req.args_nvl); > + nvlist_destroy(option_list); > return (retval); > } > > @@ -2644,7 +2644,7 @@ cctl_rm_lun(int fd, int argc, char **argv, char > *combi > printf("LUN %d removed successfully\n", lun_id); > > bailout: > - nvlist_destroy(req.args_nvl); > + nvlist_destroy(option_list); > return (retval); > } > > @@ -2764,7 +2764,7 @@ cctl_modify_lun(int fd, int argc, char **argv, char > *c > printf("LUN %d modified successfully\n", lun_id); > > bailout: > - nvlist_destroy(req.args_nvl); > + nvlist_destroy(option_list); > return (retval); > } > > > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r340722 - head/lib/libbe
On Thu, Nov 22, 2018, 12:19 AM Rodney W. Grimes < free...@pdx.rh.cn85.dnsmgr.net wrote: > > Author: 0mp (ports committer) > > Date: Wed Nov 21 11:22:44 2018 > > New Revision: 340722 > > URL: https://svnweb.freebsd.org/changeset/base/340722 > > > > Log: > > libbe(3): Put each error value in separate line. > > > > As requested by a TODO in the source code. > > > > Reviewed by:bcr > > Approved by:krion (mentor, implicit), mat (mentor, implicit) > > Differential Revision: https://reviews.freebsd.org/D18063 > > Who with a src bit approved the commit to src? > I was asking myself the same question!! > > Modified: > > head/lib/libbe/libbe.3 > > > > Modified: head/lib/libbe/libbe.3 > > > == > > --- head/lib/libbe/libbe.3Wed Nov 21 06:36:15 2018(r340721) > > +++ head/lib/libbe/libbe.3Wed Nov 21 11:22:44 2018(r340722) > > @@ -28,7 +28,7 @@ > > .\" > > .\" $FreeBSD$ > > .\" > > -.Dd November 17, 2018 > > +.Dd November 21, 2018 > > .Dt LIBBE 3 > > .Os > > .Sh NAME > > @@ -440,30 +440,49 @@ The > > .Fn be_prop_list_free > > function will free the property list. > > .Sh DIAGNOSTICS > > -Upon error, one of the following values will be returned. > > -.\" TODO: make each entry on its own line. > > -.Bd -ragged -offset indent > > -BE_ERR_SUCCESS, > > -BE_ERR_INVALIDNAME, > > -BE_ERR_EXISTS, > > -BE_ERR_NOENT, > > -BE_ERR_PERMS, > > -BE_ERR_DESTROYACT, > > -BE_ERR_DESTROYMNT, > > -BE_ERR_BADPATH, > > -BE_ERR_PATHBUSY, > > -BE_ERR_PATHLEN, > > -BE_ERR_BADMOUNT, > > -BE_ERR_NOORIGIN, > > -BE_ERR_MOUNTED, > > -BE_ERR_NOMOUNT, > > -BE_ERR_ZFSOPEN, > > -BE_ERR_ZFSCLONE, > > -BE_ERR_IO, > > -BE_ERR_NOPOOL, > > -BE_ERR_NOMEM, > > +Upon error, one of the following values will be returned: > > +.Bl -dash -offset indent -compact > > +.It > > +BE_ERR_SUCCESS > > +.It > > +BE_ERR_INVALIDNAME > > +.It > > +BE_ERR_EXISTS > > +.It > > +BE_ERR_NOENT > > +.It > > +BE_ERR_PERMS > > +.It > > +BE_ERR_DESTROYACT > > +.It > > +BE_ERR_DESTROYMNT > > +.It > > +BE_ERR_BADPATH > > +.It > > +BE_ERR_PATHBUSY > > +.It > > +BE_ERR_PATHLEN > > +.It > > +BE_ERR_BADMOUNT > > +.It > > +BE_ERR_NOORIGIN > > +.It > > +BE_ERR_MOUNTED > > +.It > > +BE_ERR_NOMOUNT > > +.It > > +BE_ERR_ZFSOPEN > > +.It > > +BE_ERR_ZFSCLONE > > +.It > > +BE_ERR_IO > > +.It > > +BE_ERR_NOPOOL > > +.It > > +BE_ERR_NOMEM > > +.It > > BE_ERR_UNKNOWN > > -.Ed > > +.El > > .Sh SEE ALSO > > .Xr be 1 > > .Sh HISTORY > > > > > > -- > Rod Grimes > rgri...@freebsd.org > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r340707 - head/usr.sbin/bhyve
Em qua, 21 de nov de 2018 às 08:23, Shawn Webb escreveu: > On Tue, Nov 20, 2018 at 10:21:19PM +0000, Marcelo Araujo wrote: > > Author: araujo > > Date: Tue Nov 20 22:21:19 2018 > > New Revision: 340707 > > URL: https://svnweb.freebsd.org/changeset/base/340707 > > > > Log: > > Define AHCI_PORT_IDENT and increase by 1 the VTBLK_BLK_ID_BYTES > > to avoid buffer accessed out of bounds, also switch to snprintf(3). > > > > PR: 200859 > > Submitted by: Caglar > > Obtained from: https://github.com/mist64/xhyve/pull/24 > > MFC after: 4 weeks > > Sponsored by: iXsystems Inc. > > > > Modified: > > head/usr.sbin/bhyve/pci_ahci.c > > head/usr.sbin/bhyve/pci_virtio_block.c > > > > Modified: head/usr.sbin/bhyve/pci_ahci.c > > > == > > --- head/usr.sbin/bhyve/pci_ahci.cTue Nov 20 22:12:10 2018 > (r340706) > > +++ head/usr.sbin/bhyve/pci_ahci.cTue Nov 20 22:21:19 2018 > (r340707) > > @@ -105,7 +105,7 @@ enum sata_fis_type { > > * ATA commands > > */ > > #define ATA_SF_ENAB_SATA_SF 0x10 > > -#define ATA_SATA_SF_AN 0x05 > > +#define ATA_SATA_SF_AN 0x05 > > #define ATA_SF_DIS_SATA_SF 0x90 > > > > /* > > @@ -119,6 +119,8 @@ static FILE *dbg; > > #endif > > #define WPRINTF(format, arg...) printf(format, ##arg) > > > > +#define AHCI_PORT_IDENT 20 + 1 > > + > > struct ahci_ioreq { > > struct blockif_req io_req; > > struct ahci_port *io_pr; > > @@ -136,7 +138,7 @@ struct ahci_port { > > struct pci_ahci_softc *pr_sc; > > uint8_t *cmd_lst; > > uint8_t *rfis; > > - char ident[20 + 1]; > > + char ident[AHCI_PORT_IDENT]; > > int port; > > int atapi; > > int reset; > > @@ -2374,7 +2376,8 @@ pci_ahci_init(struct vmctx *ctx, struct > pci_devinst *p > > MD5Init(); > > MD5Update(, opts, strlen(opts)); > > MD5Final(digest, ); > > - sprintf(sc->port[p].ident, > "BHYVE-%02X%02X-%02X%02X-%02X%02X", > > + snprintf(sc->port[p].ident, AHCI_PORT_IDENT, > > + "BHYVE-%02X%02X-%02X%02X-%02X%02X", > > digest[0], digest[1], digest[2], digest[3], digest[4], > > digest[5]); > > > > > > Modified: head/usr.sbin/bhyve/pci_virtio_block.c > > > == > > --- head/usr.sbin/bhyve/pci_virtio_block.cTue Nov 20 22:12:10 2018 > (r340706) > > +++ head/usr.sbin/bhyve/pci_virtio_block.cTue Nov 20 22:21:19 2018 > (r340707) > > @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); > > #define VTBLK_S_IOERR1 > > #define VTBLK_S_UNSUPP 2 > > > > -#define VTBLK_BLK_ID_BYTES 20 > > +#define VTBLK_BLK_ID_BYTES 20 + 1 > > > > /* Capability bits */ > > #define VTBLK_F_SEG_MAX (1 << 2)/* Maximum request > segments */ > > @@ -344,7 +344,8 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst > * > > MD5Init(); > > MD5Update(, opts, strlen(opts)); > > MD5Final(digest, ); > > - sprintf(sc->vbsc_ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X", > > + snprintf(sc->vbsc_ident, VTBLK_BLK_ID_BYTES, > > + "BHYVE-%02X%02X-%02X%02X-%02X%02X", > > digest[0], digest[1], digest[2], digest[3], digest[4], > digest[5]); > > > > /* setup virtio block config space */ > > Hey Marcelo, > > Thanks for committing this. Could VTBLK_BLK_ID_BYTES and > AHCI_PORT_IDENT be merged into the same macro, defined in > usr.sbin/bhyve/pci_emul.h? Especially since both equate to the same > value. > The macro could be merged, but it is safer to have it in this way, in case something changes specifically for one of the drivers. I don't think pci_emul.h would be the right place for that, this file is in charge of PCI emulation functions and it is pretty much generic among the other drivers. Best. > > Thanks, > > -- > Shawn Webb > Cofounder and Security Engineer > HardenedBSD > > Tor-ified Signal:+1 443-546-8752 > Tor+XMPP+OTR:latt...@is.a.hacker.sx > GPG Key ID: 0x6A84658F52456EEE > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r340707 - head/usr.sbin/bhyve
Author: araujo Date: Tue Nov 20 22:21:19 2018 New Revision: 340707 URL: https://svnweb.freebsd.org/changeset/base/340707 Log: Define AHCI_PORT_IDENT and increase by 1 the VTBLK_BLK_ID_BYTES to avoid buffer accessed out of bounds, also switch to snprintf(3). PR: 200859 Submitted by: Caglar Obtained from:https://github.com/mist64/xhyve/pull/24 MFC after:4 weeks Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_ahci.c head/usr.sbin/bhyve/pci_virtio_block.c Modified: head/usr.sbin/bhyve/pci_ahci.c == --- head/usr.sbin/bhyve/pci_ahci.c Tue Nov 20 22:12:10 2018 (r340706) +++ head/usr.sbin/bhyve/pci_ahci.c Tue Nov 20 22:21:19 2018 (r340707) @@ -105,7 +105,7 @@ enum sata_fis_type { * ATA commands */ #defineATA_SF_ENAB_SATA_SF 0x10 -#defineATA_SATA_SF_AN 0x05 +#defineATA_SATA_SF_AN 0x05 #defineATA_SF_DIS_SATA_SF 0x90 /* @@ -119,6 +119,8 @@ static FILE *dbg; #endif #define WPRINTF(format, arg...) printf(format, ##arg) +#define AHCI_PORT_IDENT 20 + 1 + struct ahci_ioreq { struct blockif_req io_req; struct ahci_port *io_pr; @@ -136,7 +138,7 @@ struct ahci_port { struct pci_ahci_softc *pr_sc; uint8_t *cmd_lst; uint8_t *rfis; - char ident[20 + 1]; + char ident[AHCI_PORT_IDENT]; int port; int atapi; int reset; @@ -2374,7 +2376,8 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *p MD5Init(); MD5Update(, opts, strlen(opts)); MD5Final(digest, ); - sprintf(sc->port[p].ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X", + snprintf(sc->port[p].ident, AHCI_PORT_IDENT, + "BHYVE-%02X%02X-%02X%02X-%02X%02X", digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]); Modified: head/usr.sbin/bhyve/pci_virtio_block.c == --- head/usr.sbin/bhyve/pci_virtio_block.c Tue Nov 20 22:12:10 2018 (r340706) +++ head/usr.sbin/bhyve/pci_virtio_block.c Tue Nov 20 22:21:19 2018 (r340707) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #define VTBLK_S_IOERR 1 #defineVTBLK_S_UNSUPP 2 -#defineVTBLK_BLK_ID_BYTES 20 +#defineVTBLK_BLK_ID_BYTES 20 + 1 /* Capability bits */ #defineVTBLK_F_SEG_MAX (1 << 2)/* Maximum request segments */ @@ -344,7 +344,8 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst * MD5Init(); MD5Update(, opts, strlen(opts)); MD5Final(digest, ); - sprintf(sc->vbsc_ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X", + snprintf(sc->vbsc_ident, VTBLK_BLK_ID_BYTES, + "BHYVE-%02X%02X-%02X%02X-%02X%02X", digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]); /* setup virtio block config space */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r340211 - head/usr.sbin/bhyve
Author: araujo Date: Wed Nov 7 06:29:01 2018 New Revision: 340211 URL: https://svnweb.freebsd.org/changeset/base/340211 Log: Comestic change to try to inline the memset with SSE/AVX instructions. Also switch from int to size_t to keep portability. Reviewed by: brooks Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D17795 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Wed Nov 7 04:20:29 2018 (r340210) +++ head/usr.sbin/bhyve/pci_nvme.c Wed Nov 7 06:29:01 2018 (r340211) @@ -251,11 +251,13 @@ static void pci_nvme_io_partial(struct blockif_req *br (NVME_STATUS_SC_MASK << NVME_STATUS_SC_SHIFT)) static __inline void -cpywithpad(char *dst, int dst_size, const char *src, char pad) +cpywithpad(char *dst, size_t dst_size, const char *src, char pad) { - int len = strnlen(src, dst_size); + size_t len; + + len = strnlen(src, dst_size); + memset(dst, pad, dst_size); memcpy(dst, src, len); - memset(dst + len, pad, dst_size - len); } static __inline void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r340050 - head/usr.sbin/bhyve
Author: araujo Date: Fri Nov 2 13:48:06 2018 New Revision: 340050 URL: https://svnweb.freebsd.org/changeset/base/340050 Log: Remove printf for debug purpose forgotten on r340046. Reported by: Dmitry Luhtionov Modified: head/usr.sbin/bhyve/ps2kbd.c Modified: head/usr.sbin/bhyve/ps2kbd.c == --- head/usr.sbin/bhyve/ps2kbd.cFri Nov 2 11:41:58 2018 (r340049) +++ head/usr.sbin/bhyve/ps2kbd.cFri Nov 2 13:48:06 2018 (r340050) @@ -319,7 +319,6 @@ ps2kbd_keysym_queue(struct ps2kbd_softc *sc, const struct extended_translation *trans; found = 0; - printf("keysym 0x%x\n", keysym); if (keysym < 0x80) { code = ascii_translations[keysym]; e0_prefix = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r340046 - head/usr.sbin/bhyve
Author: araujo Date: Fri Nov 2 08:28:14 2018 New Revision: 340046 URL: https://svnweb.freebsd.org/changeset/base/340046 Log: Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad keys. PR: 213835 Submitted by: Vasily Postnicov MFC after:4 weeks Relnotes: Yes Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/ps2kbd.c Modified: head/usr.sbin/bhyve/ps2kbd.c == --- head/usr.sbin/bhyve/ps2kbd.cFri Nov 2 08:03:19 2018 (r340045) +++ head/usr.sbin/bhyve/ps2kbd.cFri Nov 2 08:28:14 2018 (r340046) @@ -76,6 +76,107 @@ struct ps2kbd_softc { uint8_t curcmd; /* current command for next byte */ }; +#define SCANCODE_E0_PREFIX 1 +struct extended_translation { + uint32_t keysym; + uint8_t scancode; + int flags; +}; + +/* + * FIXME: Pause/break and Print Screen/SysRq require special handling. + */ +static const struct extended_translation extended_translations[] = { + {0xff08, 0x66}, /* Back space */ + {0xff09, 0x0d}, /* Tab */ + {0xff0d, 0x5a}, /* Return */ + {0xff1b, 0x76}, /* Escape */ + {0xff50, 0x6c, SCANCODE_E0_PREFIX}, /* Home */ + {0xff51, 0x6b, SCANCODE_E0_PREFIX}, /* Left arrow */ + {0xff52, 0x75, SCANCODE_E0_PREFIX}, /* Up arrow */ + {0xff53, 0x74, SCANCODE_E0_PREFIX}, /* Right arrow */ + {0xff54, 0x72, SCANCODE_E0_PREFIX}, /* Down arrow */ + {0xff55, 0x7d, SCANCODE_E0_PREFIX}, /* PgUp */ + {0xff56, 0x7a, SCANCODE_E0_PREFIX}, /* PgDown */ + {0xff57, 0x69, SCANCODE_E0_PREFIX}, /* End */ + {0xff63, 0x70, SCANCODE_E0_PREFIX}, /* Ins */ + {0xff8d, 0x5a, SCANCODE_E0_PREFIX}, /* Keypad Enter */ + {0xffe1, 0x12}, /* Left shift */ + {0xffe2, 0x59}, /* Right shift */ + {0xffe3, 0x14}, /* Left control */ + {0xffe4, 0x14, SCANCODE_E0_PREFIX}, /* Right control */ + /* {0xffe7, XXX}, Left meta */ + /* {0xffe8, XXX}, Right meta */ + {0xffe9, 0x11}, /* Left alt */ + {0xfe03, 0x11, SCANCODE_E0_PREFIX}, /* AltGr */ + {0xffea, 0x11, SCANCODE_E0_PREFIX}, /* Right alt */ + {0xffeb, 0x1f, SCANCODE_E0_PREFIX}, /* Left Windows */ + {0xffec, 0x27, SCANCODE_E0_PREFIX}, /* Right Windows */ + {0xffbe, 0x05}, /* F1 */ + {0xffbf, 0x06}, /* F2 */ + {0xffc0, 0x04}, /* F3 */ + {0xffc1, 0x0c}, /* F4 */ + {0xffc2, 0x03}, /* F5 */ + {0xffc3, 0x0b}, /* F6 */ + {0xffc4, 0x83}, /* F7 */ + {0xffc5, 0x0a}, /* F8 */ + {0xffc6, 0x01}, /* F9 */ + {0xffc7, 0x09}, /* F10 */ + {0xffc8, 0x78}, /* F11 */ + {0xffc9, 0x07}, /* F12 */ + {0x, 0x71, SCANCODE_E0_PREFIX}, /* Del */ + {0xff14, 0x7e}, /* ScrollLock */ + /* NumLock and Keypads*/ + {0xff7f, 0x77}, /* NumLock */ + {0xffaf, 0x4a, SCANCODE_E0_PREFIX}, /* Keypad slash */ + {0xffaa, 0x7c}, /* Keypad asterisk */ + {0xffad, 0x7b}, /* Keypad minus */ + {0xffab, 0x79}, /* Keypad plus */ + {0xffb7, 0x6c}, /* Keypad 7 */ + {0xff95, 0x6c}, /* Keypad home */ + {0xffb8, 0x75}, /* Keypad 8 */ + {0xff97, 0x75}, /* Keypad up arrow */ + {0xffb9, 0x7d}, /* Keypad 9 */ + {0xff9a, 0x7d}, /* Keypad PgUp */ + {0xffb4, 0x6b}, /* Keypad 4 */ + {0xff96, 0x6b}, /* Keypad left arrow */ + {0xffb5, 0x73}, /* Keypad 5 */ + {0xff9d, 0x73}, /* Keypad empty */ + {0xffb6, 0x74}, /* Keypad 6 */ + {0xff98, 0x74}, /* Keypad right arrow */ + {0xffb1, 0x69}, /* Keypad 1 */ + {0xff9c, 0x69}, /* Keypad end */ + {0xffb2, 0x72}, /* Keypad 2 */ + {0xff99, 0x72}, /* Keypad down arrow */ + {0xffb3, 0x7a}, /* Keypad 3 */ + {0xff9b, 0x7a}, /* Keypad PgDown */ + {0xffb0, 0x70}, /* Keypad 0 */ + {0xff9e, 0x70}, /* Keypad ins */ + {0xffae, 0x71}, /* Keypad . */ + {0xff9f, 0x71},
svn commit: r340045 - head/usr.sbin/bhyve
Author: araujo Date: Fri Nov 2 08:03:19 2018 New Revision: 340045 URL: https://svnweb.freebsd.org/changeset/base/340045 Log: Fix resource leak when using strdup(3). Reported by: Coverity CID: 1357337 Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_fbuf.c Modified: head/usr.sbin/bhyve/pci_fbuf.c == --- head/usr.sbin/bhyve/pci_fbuf.c Fri Nov 2 08:01:42 2018 (r340044) +++ head/usr.sbin/bhyve/pci_fbuf.c Fri Nov 2 08:03:19 2018 (r340045) @@ -319,6 +319,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } done: + free(uopts); return (ret); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r340044 - head/usr.sbin/bhyve
Author: araujo Date: Fri Nov 2 08:01:42 2018 New Revision: 340044 URL: https://svnweb.freebsd.org/changeset/base/340044 Log: Fix resource leak when using strdup(3). Reported by: Coverity CID: 1357336 Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_xhci.c Modified: head/usr.sbin/bhyve/pci_xhci.c == --- head/usr.sbin/bhyve/pci_xhci.c Fri Nov 2 07:59:28 2018 (r340043) +++ head/usr.sbin/bhyve/pci_xhci.c Fri Nov 2 08:01:42 2018 (r340044) @@ -2700,6 +2700,8 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *o sc->ndevices++; } + if (uopt != NULL) + free(uopt); portsfinal: sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs)); @@ -2729,6 +2731,7 @@ done: free(devices); } } + free(uopt); return (sc->ndevices); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r340043 - head/usr.sbin/bhyve
Author: araujo Date: Fri Nov 2 07:59:28 2018 New Revision: 340043 URL: https://svnweb.freebsd.org/changeset/base/340043 Log: Fix resource leak, variable fd going out of scope. Reported by: Coverity CID: 1204383 Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_virtio_rnd.c Modified: head/usr.sbin/bhyve/pci_virtio_rnd.c == --- head/usr.sbin/bhyve/pci_virtio_rnd.cFri Nov 2 07:57:28 2018 (r340042) +++ head/usr.sbin/bhyve/pci_virtio_rnd.cFri Nov 2 07:59:28 2018 (r340043) @@ -168,6 +168,7 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst * len = read(fd, , sizeof(v)); if (len <= 0) { WPRINTF(("vtrnd: /dev/random not ready, read(): %d", len)); + close(fd); return (1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r340042 - head/usr.sbin/bhyve
Author: araujo Date: Fri Nov 2 07:57:28 2018 New Revision: 340042 URL: https://svnweb.freebsd.org/changeset/base/340042 Log: Fix resource leak, variables cp, xopts and nopt going out of scope. Reported by: Coverity CID: 1305412 Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/block_if.c Modified: head/usr.sbin/bhyve/block_if.c == --- head/usr.sbin/bhyve/block_if.c Fri Nov 2 07:48:23 2018 (r340041) +++ head/usr.sbin/bhyve/block_if.c Fri Nov 2 07:57:28 2018 (r340042) @@ -573,6 +573,9 @@ blockif_open(const char *optstr, const char *ident) err: if (fd >= 0) close(fd); + free(cp); + free(xopts); + free(nopt); return (NULL); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r339936 - head/sys/amd64/vmm/amd
On Wed, Oct 31, 2018, 10:07 PM Shawn Webb wrote: > On Wed, Oct 31, 2018 at 01:27:44AM +0000, Marcelo Araujo wrote: > > Author: araujo > > Date: Wed Oct 31 01:27:44 2018 > > New Revision: 339936 > > URL: https://svnweb.freebsd.org/changeset/base/339936 > > > > Log: > > Merge cases with upper block. > > This is a cosmetic change only to simplify code. > > > > Reported by:anish > > Sponsored by: iXsystems Inc. > > > > Modified: > > head/sys/amd64/vmm/amd/svm_msr.c > > > > Modified: head/sys/amd64/vmm/amd/svm_msr.c > > > == > > --- head/sys/amd64/vmm/amd/svm_msr.c Tue Oct 30 23:09:04 2018 > (r339935) > > +++ head/sys/amd64/vmm/amd/svm_msr.c Wed Oct 31 01:27:44 2018 > (r339936) > > @@ -122,11 +122,7 @@ svm_rdmsr(struct svm_softc *sc, int vcpu, u_int > num, u > > case MSR_MTRR16kBase ... MSR_MTRR16kBase + 1: > > case MSR_MTRR64kBase: > > case MSR_SYSCFG: > > - *result = 0; > > - break; > > case MSR_AMDK8_IPM: > > - *result = 0; > > - break; > > case MSR_EXTFEATURES: > > *result = 0; > > break; > > Does this need a /* FALLTHROUGH */ comment to appease the Coverity > Gods? > Wow yeah, probably yes!!! I will check tomorrow! Thanks. > Thanks, > > -- > Shawn Webb > Cofounder and Security Engineer > HardenedBSD > > Tor-ified Signal:+1 443-546-8752 > Tor+XMPP+OTR:latt...@is.a.hacker.sx > GPG Key ID: 0x6A84658F52456EEE > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r339936 - head/sys/amd64/vmm/amd
Author: araujo Date: Wed Oct 31 01:27:44 2018 New Revision: 339936 URL: https://svnweb.freebsd.org/changeset/base/339936 Log: Merge cases with upper block. This is a cosmetic change only to simplify code. Reported by: anish Sponsored by: iXsystems Inc. Modified: head/sys/amd64/vmm/amd/svm_msr.c Modified: head/sys/amd64/vmm/amd/svm_msr.c == --- head/sys/amd64/vmm/amd/svm_msr.cTue Oct 30 23:09:04 2018 (r339935) +++ head/sys/amd64/vmm/amd/svm_msr.cWed Oct 31 01:27:44 2018 (r339936) @@ -122,11 +122,7 @@ svm_rdmsr(struct svm_softc *sc, int vcpu, u_int num, u case MSR_MTRR16kBase ... MSR_MTRR16kBase + 1: case MSR_MTRR64kBase: case MSR_SYSCFG: - *result = 0; - break; case MSR_AMDK8_IPM: - *result = 0; - break; case MSR_EXTFEATURES: *result = 0; break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r339911 - head/sys/amd64/vmm/amd
Author: araujo Date: Tue Oct 30 10:02:23 2018 New Revision: 339911 URL: https://svnweb.freebsd.org/changeset/base/339911 Log: Emulate machine check related MSR_EXTFEATURES to allow guest OSes to boot on AMD FX Series. PR: 224476 Submitted by: Keita Uchida Reviewed by: rgrimes Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D17713 Modified: head/sys/amd64/vmm/amd/svm_msr.c Modified: head/sys/amd64/vmm/amd/svm_msr.c == --- head/sys/amd64/vmm/amd/svm_msr.cTue Oct 30 10:01:15 2018 (r339910) +++ head/sys/amd64/vmm/amd/svm_msr.cTue Oct 30 10:02:23 2018 (r339911) @@ -127,6 +127,9 @@ svm_rdmsr(struct svm_softc *sc, int vcpu, u_int num, u case MSR_AMDK8_IPM: *result = 0; break; + case MSR_EXTFEATURES: + *result = 0; + break; default: error = EINVAL; break; @@ -162,6 +165,8 @@ svm_wrmsr(struct svm_softc *sc, int vcpu, u_int num, u /* * Ignore writes to microcode update register. */ + break; + case MSR_EXTFEATURES: break; default: error = EINVAL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r339909 - head/sys/net
Author: araujo Date: Tue Oct 30 09:53:57 2018 New Revision: 339909 URL: https://svnweb.freebsd.org/changeset/base/339909 Log: Allow changing lagg(4) MTU. Previously, changing the MTU would require destroying the lagg and creating a new one. Now it is allowed to change the MTU of the lagg interface and the MTU of the ports will be set to match. If any port cannot set the new MTU, all ports are reverted to the original MTU of the lagg. Additionally, when adding ports, the MTU of a port will be automatically set to the MTU of the lagg. As always, the MTU of the lagg is initially determined by the MTU of the first port added. If adding an interface as a port for some reason fails, that interface is reverted to its original MTU. Submitted by: Ryan Moeller Reviewed by: mav Relnotes: Yes Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D17576 Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c == --- head/sys/net/if_lagg.c Tue Oct 30 09:43:26 2018(r339908) +++ head/sys/net/if_lagg.c Tue Oct 30 09:53:57 2018(r339909) @@ -633,11 +633,18 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * { struct lagg_softc *sc_ptr; struct lagg_port *lp, *tlp; - int error, i; + struct ifreq ifr; + int error, i, oldmtu; uint64_t *pval; LAGG_XLOCK_ASSERT(sc); + if (sc->sc_ifp == ifp) { + if_printf(sc->sc_ifp, + "cannot add a lagg to itself as a port\n"); + return (EINVAL); + } + /* Limit the maximal number of lagg ports */ if (sc->sc_count >= LAGG_MAX_PORTS) return (ENOSPC); @@ -656,12 +663,25 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * return (EPROTONOSUPPORT); /* Allow the first Ethernet member to define the MTU */ - if (CK_SLIST_EMPTY(>sc_ports)) + oldmtu = -1; + if (CK_SLIST_EMPTY(>sc_ports)) { sc->sc_ifp->if_mtu = ifp->if_mtu; - else if (sc->sc_ifp->if_mtu != ifp->if_mtu) { - if_printf(sc->sc_ifp, "invalid MTU for %s\n", - ifp->if_xname); - return (EINVAL); + } else if (sc->sc_ifp->if_mtu != ifp->if_mtu) { + if (ifp->if_ioctl == NULL) { + if_printf(sc->sc_ifp, "cannot change MTU for %s\n", + ifp->if_xname); + return (EINVAL); + } + oldmtu = ifp->if_mtu; + strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = sc->sc_ifp->if_mtu; + error = (*ifp->if_ioctl)(ifp, SIOCSIFMTU, (caddr_t)); + if (error != 0) { + if_printf(sc->sc_ifp, "invalid MTU for %s\n", + ifp->if_xname); + return (error); + } + ifr.ifr_mtu = oldmtu; } lp = malloc(sizeof(struct lagg_port), M_DEVBUF, M_WAITOK|M_ZERO); @@ -673,6 +693,9 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * if (ifp == sc_ptr->sc_ifp) { LAGG_LIST_UNLOCK(); free(lp, M_DEVBUF); + if (oldmtu != -1) + (*ifp->if_ioctl)(ifp, SIOCSIFMTU, + (caddr_t)); return (EINVAL); /* XXX disable stacking for the moment, its untested */ #ifdef LAGG_PORT_STACKING @@ -681,6 +704,9 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * LAGG_MAX_STACKING) { LAGG_LIST_UNLOCK(); free(lp, M_DEVBUF); + if (oldmtu != -1) + (*ifp->if_ioctl)(ifp, SIOCSIFMTU, + (caddr_t)); return (E2BIG); } #endif @@ -746,6 +772,8 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * if ((error = lagg_proto_addport(sc, lp)) != 0) { /* Remove the port, without calling pr_delport. */ lagg_port_destroy(lp, 0); + if (oldmtu != -1) + (*ifp->if_ioctl)(ifp, SIOCSIFMTU, (caddr_t)); return (error); } @@ -1464,8 +1492,31 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data break; case SIOCSIFMTU: - /* Do not allow the MTU to be directly changed */ - error = EINVAL; + LAGG_XLOCK(sc); + CK_SLIST_FOREACH(lp, >sc_ports, lp_entries) { + if (lp->lp_ioctl != NULL) + error =
svn commit: r338242 - head/usr.sbin/bhyve
Author: araujo Date: Thu Aug 23 07:34:51 2018 New Revision: 338242 URL: https://svnweb.freebsd.org/changeset/base/338242 Log: Add manpage entry for the new bhyve options -s "help" and -l "help". Reported by: 0mp Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Thu Aug 23 06:03:59 2018(r338241) +++ head/usr.sbin/bhyve/bhyve.8 Thu Aug 23 07:34:51 2018(r338242) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jul 11, 2018 +.Dd Aug 23, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -44,10 +44,10 @@ .Op Ar ,threads=n .Oc .Op Fl g Ar gdbport -.Op Fl l Ar lpcdev Ns Op , Ns Ar conf +.Op Fl l Ar help|lpcdev Ns Op , Ns Ar conf .Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t .Op Fl p Ar vcpu:hostcpu -.Op Fl s Ar slot,emulation Ns Op , Ns Ar conf +.Op Fl s Ar help|slot,emulation Ns Op , Ns Ar conf .Op Fl G Ar port .Op Fl U Ar uuid .Ar vmname @@ -144,7 +144,7 @@ Print help message and exit. .It Fl H Yield the virtual CPU thread when a HLT instruction is detected. If this option is not specified, virtual CPUs will use 100% of a host CPU. -.It Fl l Ar lpcdev Ns Op , Ns Ar conf +.It Fl l Op Ar help|lpcdev Ns Op , Ns Ar conf Allow devices behind the LPC PCI-ISA bridge to be configured. The only supported devices are the TTY-class devices .Ar com1 @@ -152,6 +152,9 @@ and .Ar com2 and the boot ROM device .Ar bootrom . +.Pp +.Ar help +print a list of supported LPC devices. .It Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t Guest physical memory size in bytes. This must be the same size that was given to @@ -171,7 +174,7 @@ to .Em hostcpu . .It Fl P Force the guest virtual CPU to exit when a PAUSE instruction is detected. -.It Fl s Ar slot,emulation Ns Op , Ns Ar conf +.It Fl s Op Ar help|slot,emulation Ns Op , Ns Ar conf Configure a virtual PCI slot and function. .Pp .Nm @@ -180,6 +183,8 @@ slots on the bus. There are 32 available slots, with the option of providing up to 8 functions per slot. .Bl -tag -width 10n +.It Ar help +print a list of supported PCI devices. .It Ar slot .Ar pcislot[:function] .Ar bus:pcislot:function ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r338210 - head/usr.sbin/bhyve
Author: araujo Date: Wed Aug 22 20:23:08 2018 New Revision: 338210 URL: https://svnweb.freebsd.org/changeset/base/338210 Log: Add -s "help" and -l "help" to print a list of supported PCI and LPC devices. For tools that uses bhyve such like libvirt, it is important to be able to probe what features are supported by the given bhyve binary. To give more context, libvirt probes bhyve's capabilities in a not very effective way: - Running 'bhyve -h' and parsing output. - To detect devices, it runs 'bhyve -s 0,dev' for every each device and parses error output to identify if the device is supported or not. PR: 210 Submitted by: novel MFC after:2 weeks Relnotes: yes Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_emul.h head/usr.sbin/bhyve/pci_lpc.c head/usr.sbin/bhyve/pci_lpc.h Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Wed Aug 22 19:38:48 2018 (r338209) +++ head/usr.sbin/bhyve/bhyverun.c Wed Aug 22 20:23:08 2018 (r338210) @@ -960,13 +960,19 @@ main(int argc, char *argv[]) gdb_port = atoi(optarg); break; case 'l': - if (lpc_device_parse(optarg) != 0) { + if (strncmp(optarg, "help", strlen(optarg)) == 0) { + lpc_print_supported_devices(); + exit(0); + } else if (lpc_device_parse(optarg) != 0) { errx(EX_USAGE, "invalid lpc device " "configuration '%s'", optarg); } break; case 's': - if (pci_parse_slot(optarg) != 0) + if (strncmp(optarg, "help", strlen(optarg)) == 0) { + pci_print_supported_devices(); + exit(0); + } else if (pci_parse_slot(optarg) != 0) exit(4); else break; Modified: head/usr.sbin/bhyve/pci_emul.c == --- head/usr.sbin/bhyve/pci_emul.c Wed Aug 22 19:38:48 2018 (r338209) +++ head/usr.sbin/bhyve/pci_emul.c Wed Aug 22 20:23:08 2018 (r338210) @@ -237,6 +237,17 @@ done: return (error); } +void +pci_print_supported_devices() +{ + struct pci_devemu **pdpp, *pdp; + + SET_FOREACH(pdpp, pci_devemu_set) { + pdp = *pdpp; + printf("%s\n", pdp->pe_emu); + } +} + static int pci_valid_pba_offset(struct pci_devinst *pi, uint64_t offset) { Modified: head/usr.sbin/bhyve/pci_emul.h == --- head/usr.sbin/bhyve/pci_emul.h Wed Aug 22 19:38:48 2018 (r338209) +++ head/usr.sbin/bhyve/pci_emul.h Wed Aug 22 20:23:08 2018 (r338210) @@ -234,6 +234,7 @@ int pci_msix_table_bar(struct pci_devinst *pi); intpci_msix_pba_bar(struct pci_devinst *pi); intpci_msi_maxmsgnum(struct pci_devinst *pi); intpci_parse_slot(char *opt); +voidpci_print_supported_devices(); void pci_populate_msicap(struct msicap *cap, int msgs, int nextptr); intpci_emul_add_msixcap(struct pci_devinst *pi, int msgnum, int barnum); intpci_emul_msix_twrite(struct pci_devinst *pi, uint64_t offset, int size, Modified: head/usr.sbin/bhyve/pci_lpc.c == --- head/usr.sbin/bhyve/pci_lpc.c Wed Aug 22 19:38:48 2018 (r338209) +++ head/usr.sbin/bhyve/pci_lpc.c Wed Aug 22 20:23:08 2018 (r338210) @@ -114,6 +114,16 @@ done: return (error); } +void +lpc_print_supported_devices() +{ + size_t i; + + printf("bootrom\n"); + for (i = 0; i < LPC_UART_NUM; i++) + printf("%s\n", lpc_uart_names[i]); +} + const char * lpc_bootrom(void) { Modified: head/usr.sbin/bhyve/pci_lpc.h == --- head/usr.sbin/bhyve/pci_lpc.h Wed Aug 22 19:38:48 2018 (r338209) +++ head/usr.sbin/bhyve/pci_lpc.h Wed Aug 22 20:23:08 2018 (r338210) @@ -68,6 +68,7 @@ struct lpc_sysres { #defineSYSRES_MEM(base, length)LPC_SYSRES(LPC_SYSRES_MEM, base, length) intlpc_device_parse(const char *opt); +voidlpc_print_supported_devices(); char *lpc_pirq_name(int pin); void lpc_pirq_routed(void); const char *lpc_bootrom(void); ___ svn-src-head@freebsd.org mailing list
svn commit: r338164 - head/usr.sbin/bhyve
Author: araujo Date: Tue Aug 21 23:11:26 2018 New Revision: 338164 URL: https://svnweb.freebsd.org/changeset/base/338164 Log: Fix resource leak when using strdup(3). Reported by: Coverity CID: 1394929 Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Tue Aug 21 23:03:02 2018 (r338163) +++ head/usr.sbin/bhyve/pci_nvme.c Tue Aug 21 23:11:26 2018 (r338164) @@ -1726,6 +1726,7 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o sc->nvstore.sectsz_bits = 12; if (sc->nvstore.ctx == NULL) { perror("Unable to allocate RAM"); + free(uopt); return (-1); } } else if (optidx == 0) { @@ -1734,12 +1735,14 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o sc->nvstore.ctx = blockif_open(xopts, bident); if (sc->nvstore.ctx == NULL) { perror("Could not open backing file"); + free(uopt); return (-1); } sc->nvstore.type = NVME_STOR_BLOCKIF; sc->nvstore.size = blockif_size(sc->nvstore.ctx); } else { fprintf(stderr, "Invalid option %s\n", xopts); + free(uopt); return (-1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r338133 - head/usr.sbin/gstat
Author: araujo Date: Tue Aug 21 11:22:49 2018 New Revision: 338133 URL: https://svnweb.freebsd.org/changeset/base/338133 Log: - Add CSV output to gstat via -C flag. Add a -C option, similar to -B, that allows gstat to produce basic CSV output with absolute timestamps (ISO 8601, nearly.) Multiple devices are handled by way of a single-pivot CSV table with duplicated timestamps for each object output. Submitted by: Nick Principe Reviewed by: myself, imp@, asomers (earlier verison), bcr (manpages) Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D16151 Modified: head/usr.sbin/gstat/gstat.8 head/usr.sbin/gstat/gstat.c Modified: head/usr.sbin/gstat/gstat.8 == --- head/usr.sbin/gstat/gstat.8 Tue Aug 21 11:17:25 2018(r338132) +++ head/usr.sbin/gstat/gstat.8 Tue Aug 21 11:22:49 2018(r338133) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 10, 2016 +.Dd August 21, 2018 .Dt GSTAT 8 .Os .Sh NAME @@ -61,6 +61,10 @@ consumers too. The default is to show statistics only for .Xr geom 4 producers. +.It Fl C +CSV output mode. +Implies endless batch mode, but output is in the form of comma-separated +values, with ISO 8601-like timestamps. .It Fl d Enable display of statistics for delete .Pq Dv BIO_DELETE Modified: head/usr.sbin/gstat/gstat.c == --- head/usr.sbin/gstat/gstat.c Tue Aug 21 11:17:25 2018(r338132) +++ head/usr.sbin/gstat/gstat.c Tue Aug 21 11:22:49 2018(r338133) @@ -53,9 +53,12 @@ #include #include -static int flag_a, flag_b, flag_B, flag_c, flag_d, flag_o, flag_p, flag_s; +static int flag_a, flag_b, flag_B, flag_c, flag_C, flag_d, flag_o, flag_p, + flag_s; static int flag_I = 100; +#define HIGH_PCT_BUSY_THRESH 80 +#define MEDIUM_PCT_BUSY_THRESH 50 #define PRINTMSG(...) do { \ if ((flag_b && !loop) || (flag_B)) \ printf(__VA_ARGS__);\ @@ -76,7 +79,7 @@ int main(int argc, char **argv) { int error, i, quit; - int curx, cury, maxx, maxy, line_len, loop, max_flen; + int curx, cury, maxx, maxy, line_len, loop, max_flen, head_printed; struct devstat *gsp, *gsq; void *sp, *sq; double dt; @@ -89,6 +92,7 @@ main(int argc, char **argv) short cf, cb; char *p; char f_s[100], pf_s[100], tmp_f_s[100]; + char ts[100], g_name[4096]; const char *line; long double ld[16]; uint64_t u64; @@ -106,7 +110,7 @@ main(int argc, char **argv) flag_b = 1; f_s[0] = '\0'; - while ((i = getopt(argc, argv, "abBdcf:I:ops")) != -1) { + while ((i = getopt(argc, argv, "abBdcCf:I:ops")) != -1) { switch (i) { case 'a': flag_a = 1; @@ -121,6 +125,13 @@ main(int argc, char **argv) case 'c': flag_c = 1; break; + case 'C': + flag_C = 1; + /* csv out implies repeating batch mode */ + flag_b = 1; + flag_B = 1; + head_printed = 0; + break; case 'd': flag_d = 1; break; @@ -214,13 +225,21 @@ main(int argc, char **argv) dt = tp.tv_sec - tq.tv_sec; dt += (tp.tv_nsec - tq.tv_nsec) * 1e-9; tq = tp; + if (flag_C) { /* set timestamp string */ + (void)strftime(ts,sizeof(ts), + "%F %T",localtime(_sec)); + (void)snprintf(ts,sizeof(ts), + "%s.%.9ld",ts,tq.tv_nsec); + } geom_stats_snapshot_reset(sp); geom_stats_snapshot_reset(sq); if (!flag_b) move(0,0); - PRINTMSG("dT: %5.3fs w: %.3fs", dt, (float)flag_I / 100); - if (f_s[0] != '\0') { + if (!flag_C) + PRINTMSG("dT: %5.3fs w: %.3fs", dt, + (float)flag_I / 100); + if (!flag_C && f_s[0] != '\0') { PRINTMSG(" filter: "); if (!flag_b) { getyx(stdscr, cury, curx); @@ -239,25 +258,52 @@ main(int argc, char **argv) } PRINTMSG("%s", pf_s); } - PRINTMSG("\n"); - PRINTMSG(" L(q) ops/s "); - if (flag_s) { - PRINTMSG(" r/s kB kBps ms/r
svn commit: r338089 - head/usr.sbin/bhyve
Author: araujo Date: Mon Aug 20 04:56:37 2018 New Revision: 338089 URL: https://svnweb.freebsd.org/changeset/base/338089 Log: NVMe spec version 1.3c says that "serial number" field must be 7-bit ASCII, with unused bytes padded by space characters. Same for firmware number and namespace number. Discussed with: imp@ Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Aug 20 04:50:11 2018 (r338088) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Aug 20 04:56:37 2018 (r338089) @@ -254,6 +254,14 @@ static void pci_nvme_io_partial(struct blockif_req *br (NVME_STATUS_SC_MASK << NVME_STATUS_SC_SHIFT)) static __inline void +cpywithpad(char *dst, int dst_size, const char *src, char pad) +{ + int len = strnlen(src, dst_size); + memcpy(dst, src, len); + memset(dst + len, pad, dst_size - len); +} + +static __inline void pci_nvme_status_tc(uint16_t *status, uint16_t type, uint16_t code) { @@ -287,21 +295,9 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->vid = 0xFB5D; cd->ssvid = 0x; - cd->mn[0] = 'b'; - cd->mn[1] = 'h'; - cd->mn[2] = 'y'; - cd->mn[3] = 'v'; - cd->mn[4] = 'e'; - cd->mn[5] = '-'; - cd->mn[6] = 'N'; - cd->mn[7] = 'V'; - cd->mn[8] = 'M'; - cd->mn[9] = 'e'; + cpywithpad((char *)cd->mn, sizeof(cd->mn), "bhyve-NVMe", ' '); + cpywithpad((char *)cd->fr, sizeof(cd->fr), "1.0", ' '); - cd->fr[0] = '1'; - cd->fr[1] = '.'; - cd->fr[2] = '0'; - /* Num of submission commands that we can handle at a time (2^rab) */ cd->rab = 4; @@ -1715,12 +1711,11 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o } else if (!strcmp("ser", xopts)) { /* * This field indicates the Product Serial Number in -* 8-bit ASCII, unused bytes should be NULL characters. -* Ref: NVM Express Management Interface 1.0a. +* 7-bit ASCII, unused bytes should be space characters. +* Ref: NVMe v1.3c. */ - memset(sc->ctrldata.sn, 0, sizeof(sc->ctrldata.sn)); - strncpy(sc->ctrldata.sn, config, - sizeof(sc->ctrldata.sn)); + cpywithpad((char *)sc->ctrldata.sn, + sizeof(sc->ctrldata.sn), config, ' '); } else if (!strcmp("ram", xopts)) { uint64_t sz = strtoull([4], NULL, 10); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r338088 - head/usr.sbin/bhyve
Author: araujo Date: Mon Aug 20 04:50:11 2018 New Revision: 338088 URL: https://svnweb.freebsd.org/changeset/base/338088 Log: Users must set the number of queues from 1 to maximum 16 queues. Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Aug 20 04:44:29 2018 (r338087) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Aug 20 04:50:11 2018 (r338088) @@ -373,9 +373,8 @@ pci_nvme_reset_locked(struct pci_nvme_softc *sc) sc->regs.cc = 0; sc->regs.csts = 0; + sc->num_cqueues = sc->num_squeues = sc->max_queues; if (sc->submit_queues != NULL) { - sc->num_cqueues = sc->num_squeues = sc->max_queues; - for (int i = 0; i <= sc->max_queues; i++) { /* * The Admin Submission Queue is at index 0. @@ -1765,10 +1764,9 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o (1 << sc->nvstore.sectsz_bits) < sc->nvstore.sectsz; sc->nvstore.sectsz_bits++); - if (sc->max_queues == 0) { - fprintf(stderr, "Invalid maxq option\n"); - return (-1); - } + if (sc->max_queues <= 0 || sc->max_queues > NVME_QUEUES) + sc->max_queues = NVME_QUEUES; + if (sc->max_qentries <= 0) { fprintf(stderr, "Invalid qsz option\n"); return (-1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r338087 - head/usr.sbin/bhyve
Author: araujo Date: Mon Aug 20 04:44:29 2018 New Revision: 338087 URL: https://svnweb.freebsd.org/changeset/base/338087 Log: Fix double mutex lock. Reported by: Coverity CID: 1394833 Discussed with: Leon Dang Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Aug 20 02:40:10 2018 (r338086) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Aug 20 04:44:29 2018 (r338087) @@ -358,7 +358,7 @@ pci_nvme_init_nsdata(struct pci_nvme_softc *sc) } static void -pci_nvme_reset(struct pci_nvme_softc *sc) +pci_nvme_reset_locked(struct pci_nvme_softc *sc) { DPRINTF(("%s\r\n", __func__)); @@ -374,7 +374,6 @@ pci_nvme_reset(struct pci_nvme_softc *sc) sc->regs.csts = 0; if (sc->submit_queues != NULL) { - pthread_mutex_lock(>mtx); sc->num_cqueues = sc->num_squeues = sc->max_queues; for (int i = 0; i <= sc->max_queues; i++) { @@ -398,8 +397,6 @@ pci_nvme_reset(struct pci_nvme_softc *sc) sc->compl_queues[i].tail = 0; sc->compl_queues[i].head = 0; } - - pthread_mutex_unlock(>mtx); } else sc->submit_queues = calloc(sc->max_queues + 1, sizeof(struct nvme_submission_queue)); @@ -414,6 +411,14 @@ pci_nvme_reset(struct pci_nvme_softc *sc) } static void +pci_nvme_reset(struct pci_nvme_softc *sc) +{ + pthread_mutex_lock(>mtx); + pci_nvme_reset_locked(sc); + pthread_mutex_unlock(>mtx); +} + +static void pci_nvme_init_controller(struct vmctx *ctx, struct pci_nvme_softc *sc) { uint16_t acqs, asqs; @@ -1537,7 +1542,7 @@ pci_nvme_write_bar_0(struct vmctx *ctx, struct pci_nvm if (NVME_CC_GET_EN(ccreg) != NVME_CC_GET_EN(sc->regs.cc)) { if (NVME_CC_GET_EN(ccreg) == 0) /* transition 1-> causes controller reset */ - pci_nvme_reset(sc); + pci_nvme_reset_locked(sc); else pci_nvme_init_controller(ctx, sc); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r337887 - head/usr.sbin/bhyve
2018-08-17 7:33 GMT+08:00 Brooks Davis : > On Thu, Aug 16, 2018 at 05:23:26PM -0600, Warner Losh wrote: > > On Thu, Aug 16, 2018 at 5:16 PM, Brooks Davis > wrote: > > > > > On Fri, Aug 17, 2018 at 07:04:05AM +0800, Marcelo Araujo wrote: > > > > 2018-08-17 3:29 GMT+08:00 Rodney W. Grimes > > > net>: > > > > > > > > > > On Thu, Aug 16, 2018 at 11:06 AM, John-Mark Gurney < > j...@funkthat.com > > > > > > > > > wrote: > > > > > > > > > > > > > Marcelo Araujo wrote this message on Thu, Aug 16, 2018 at 06:31 > > > +: > > > > > > > > Author: araujo > > > > > > > > Date: Thu Aug 16 06:31:54 2018 > > > > > > > > New Revision: 337887 > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/337887 > > > > > > > > > > > > > > > > Log: > > > > > > > > Add a comment explaining how the PSN works and why there > is no > > > > > need for > > > > > > > > a null terminator. Also mark CID 1394825 as intentional. > > > > > > > > > > > > > > > > Reported by:Coverity > > > > > > > > CID:1394825 > > > > > > > > MFC after: 1 week > > > > > > > > Sponsored by: iXsystems Inc. > > > > > > > > > > > > > > > > Modified: > > > > > > > > head/usr.sbin/bhyve/pci_nvme.c > > > > > > > > > > > > > > > > Modified: head/usr.sbin/bhyve/pci_nvme.c > > > > > > > > > > > > > > > == > > > > > > > > --- head/usr.sbin/bhyve/pci_nvme.cThu Aug 16 06:20:25 > 2018 > > > > > > > (r337886) > > > > > > > > +++ head/usr.sbin/bhyve/pci_nvme.cThu Aug 16 06:31:54 > 2018 > > > > > > > (r337887) > > > > > > > > @@ -1714,6 +1714,11 @@ pci_nvme_parse_opts(struct > pci_nvme_softc > > > *sc, > > > > > > > char *o > > > > > > > > > > > > > > [...] > > > > > > > > > > > > > > > memset(sc->ctrldata.sn, 0, sizeof(sc-> > > > > > ctrldata.sn > > > > > > > )); > > > > > > > > strncpy(sc->ctrldata.sn, config, > > > > > > > > sizeof(sc->ctrldata.sn)); > > > > > > > > > > > > > > This memset is unneeded, as strncpy will write NUL bytes to > fill > > > out > > > > > > > the buffer: > > > > > > > If src is less than len characters long, the remainder of > > > > > > > dst is filled with `\0' characters. > > > > > > > > > > > > > > > > > > > It also looks like the comment was wrong. The newest NVMe > standards > > > say > > > > > > these fields should be 7-bit and space-padded. > > > > > > > > > > lol, which is what the vendor that caused me grief with > > > > > ata serial numbers did decades ago. > > > > > > > > > > -- > > > > > Rod Grimes > > > > > rgri...@freebsd.org > > > > > > > > > > > > > I have discussed a bit with imp@, but I will drop the patch here to > get > > > > other peoples opinion too. > > > > So, name space and firmware number also need to be padded with > spaces. > > > > > > > > I couldn't think in any other better way to do that. > > > > > > > > Does this patch looks reasonable? > > > > https://people.freebsd.org/~araujo/pci_nvme.diff > > > > > > You should check that len<=dst_size and at least truncate rather than > > > overflowing. If the strings from userspace you need to return or log > an > > > error, if they come from the kernel, you can panic. > > > > Help me understand, I thought that the strnlen bounded what was copied. > > Apparently the standard calls for ' ' rather than '\0' padding. The > prop memcpy+memset does the job, but contains potential overflows. > > -- Brooks > Maybe I missed something, but when I call cpywithpad() I pass the dst_size, even if the 'src' is bigger than the 'dst' it will be truncated because with strnlen(src, dst_size) the src will be reduced to dst_size length. I made couple tests and could not overflow it(example): cd->fr maximum length is 8: cpywithpad((char *)cd->fr, sizeof(cd->fr), "1.0090\0", ' '); the output of cpywithpad: len: 8 is <= dst_size: 8 Same tests I made with mn that has length of 40 adding a string with 244 characters. Sorry my ignorance, but could you give me a better example? Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r337887 - head/usr.sbin/bhyve
2018-08-17 3:29 GMT+08:00 Rodney W. Grimes : > > On Thu, Aug 16, 2018 at 11:06 AM, John-Mark Gurney > wrote: > > > > > Marcelo Araujo wrote this message on Thu, Aug 16, 2018 at 06:31 +: > > > > Author: araujo > > > > Date: Thu Aug 16 06:31:54 2018 > > > > New Revision: 337887 > > > > URL: https://svnweb.freebsd.org/changeset/base/337887 > > > > > > > > Log: > > > > Add a comment explaining how the PSN works and why there is no > need for > > > > a null terminator. Also mark CID 1394825 as intentional. > > > > > > > > Reported by:Coverity > > > > CID:1394825 > > > > MFC after: 1 week > > > > Sponsored by: iXsystems Inc. > > > > > > > > Modified: > > > > head/usr.sbin/bhyve/pci_nvme.c > > > > > > > > Modified: head/usr.sbin/bhyve/pci_nvme.c > > > > > > > == > > > > --- head/usr.sbin/bhyve/pci_nvme.cThu Aug 16 06:20:25 2018 > > > (r337886) > > > > +++ head/usr.sbin/bhyve/pci_nvme.cThu Aug 16 06:31:54 2018 > > > (r337887) > > > > @@ -1714,6 +1714,11 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, > > > char *o > > > > > > [...] > > > > > > > memset(sc->ctrldata.sn, 0, sizeof(sc-> > ctrldata.sn > > > )); > > > > strncpy(sc->ctrldata.sn, config, > > > > sizeof(sc->ctrldata.sn)); > > > > > > This memset is unneeded, as strncpy will write NUL bytes to fill out > > > the buffer: > > > If src is less than len characters long, the remainder of > > > dst is filled with `\0' characters. > > > > > > > It also looks like the comment was wrong. The newest NVMe standards say > > these fields should be 7-bit and space-padded. > > lol, which is what the vendor that caused me grief with > ata serial numbers did decades ago. > > -- > Rod Grimes > rgri...@freebsd.org > I have discussed a bit with imp@, but I will drop the patch here to get other peoples opinion too. So, name space and firmware number also need to be padded with spaces. I couldn't think in any other better way to do that. Does this patch looks reasonable? https://people.freebsd.org/~araujo/pci_nvme.diff Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r337889 - head/usr.sbin/bhyve
Author: araujo Date: Thu Aug 16 06:38:01 2018 New Revision: 337889 URL: https://svnweb.freebsd.org/changeset/base/337889 Log: Fix a resource leak when using strdup(3) and also fix few style(9). Reported by: Coverity CID: 1394929 MFC after:1 week Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:35:44 2018 (r337888) +++ head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:38:01 2018 (r337889) @@ -1746,6 +1746,8 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o optidx++; } + free(uopt); + if (sc->nvstore.ctx == NULL || sc->nvstore.size == 0) { fprintf(stderr, "backing store not specified\n"); return (-1); @@ -1756,9 +1758,7 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o sc->nvstore.sectsz = blockif_sectsz(sc->nvstore.ctx); for (sc->nvstore.sectsz_bits = 9; (1 << sc->nvstore.sectsz_bits) < sc->nvstore.sectsz; -sc->nvstore.sectsz_bits++) - ; - +sc->nvstore.sectsz_bits++); if (sc->max_queues == 0) { fprintf(stderr, "Invalid maxq option\n"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r337888 - head/usr.sbin/bhyve
Author: araujo Date: Thu Aug 16 06:35:44 2018 New Revision: 337888 URL: https://svnweb.freebsd.org/changeset/base/337888 Log: Remove duplicated code. Reported by: Coverity CID: 1394893 MFC after:1 week Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:31:54 2018 (r337887) +++ head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:35:44 2018 (r337888) @@ -1159,11 +1159,6 @@ pci_nvme_io_done(struct blockif_req *br, int err) DPRINTF(("%s error %d %s\r\n", __func__, err, strerror(err))); /* TODO return correct error */ - if (err) - code = NVME_SC_DATA_TRANSFER_ERROR; - else - code = NVME_SC_SUCCESS; - code = err ? NVME_SC_DATA_TRANSFER_ERROR : NVME_SC_SUCCESS; pci_nvme_status_genc(, code); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r337887 - head/usr.sbin/bhyve
Author: araujo Date: Thu Aug 16 06:31:54 2018 New Revision: 337887 URL: https://svnweb.freebsd.org/changeset/base/337887 Log: Add a comment explaining how the PSN works and why there is no need for a null terminator. Also mark CID 1394825 as intentional. Reported by: Coverity CID: 1394825 MFC after:1 week Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:20:25 2018 (r337886) +++ head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:31:54 2018 (r337887) @@ -1714,6 +1714,11 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o } else if (!strcmp("sectsz", xopts)) { sectsz = atoi(config); } else if (!strcmp("ser", xopts)) { + /* +* This field indicates the Product Serial Number in +* 8-bit ASCII, unused bytes should be NULL characters. +* Ref: NVM Express Management Interface 1.0a. +*/ memset(sc->ctrldata.sn, 0, sizeof(sc->ctrldata.sn)); strncpy(sc->ctrldata.sn, config, sizeof(sc->ctrldata.sn)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r337886 - head/usr.sbin/bhyve
Author: araujo Date: Thu Aug 16 06:20:25 2018 New Revision: 337886 URL: https://svnweb.freebsd.org/changeset/base/337886 Log: Increase the mask from 15 to 255 or otherwise NVME_FEAT_SOFTWARE_PROGRESS will never be reached. Discussed with: Leon Dang and Darius Mihai MFC after:1 week. Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 01:27:16 2018 (r337885) +++ head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:20:25 2018 (r337886) @@ -653,7 +653,7 @@ static int nvme_opc_set_features(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { - int feature = command->cdw10 & 0x0F; + int feature = command->cdw10 & 0xFF; uint32_t iv; DPRINTF(("%s feature 0x%x\r\n", __func__, feature)); @@ -748,7 +748,7 @@ static int nvme_opc_get_features(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { - int feature = command->cdw10 & 0x0F; + int feature = command->cdw10 & 0xFF; DPRINTF(("%s feature 0x%x\r\n", __func__, feature)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r337023 - in head: sys/amd64/vmm usr.sbin/jail
Author: araujo Date: Wed Aug 1 00:39:21 2018 New Revision: 337023 URL: https://svnweb.freebsd.org/changeset/base/337023 Log: - Add the ability to run bhyve(8) within a jail(8). This patch adds a new sysctl(8) knob "security.jail.vmm_allowed", by default this option is disable. Submitted by: Shawn Webb Reviewed by: jamie@ and myself. Relnotes: Yes. Sponsored by: HardenedBSD and G2, Inc. Differential Revision:https://reviews.freebsd.org/D16057 Modified: head/sys/amd64/vmm/vmm_dev.c head/usr.sbin/jail/jail.8 Modified: head/sys/amd64/vmm/vmm_dev.c == --- head/sys/amd64/vmm/vmm_dev.cTue Jul 31 23:44:13 2018 (r337022) +++ head/sys/amd64/vmm/vmm_dev.cWed Aug 1 00:39:21 2018 (r337023) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -43,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -82,16 +84,29 @@ struct vmmdev_softc { static SLIST_HEAD(, vmmdev_softc) head; +static unsigned pr_allow_flag; static struct mtx vmmdev_mtx; static MALLOC_DEFINE(M_VMMDEV, "vmmdev", "vmmdev"); SYSCTL_DECL(_hw_vmm); +static int vmm_priv_check(struct ucred *ucred); static int devmem_create_cdev(const char *vmname, int id, char *devmem); static void devmem_destroy(void *arg); static int +vmm_priv_check(struct ucred *ucred) +{ + + if (jailed(ucred) && + !(ucred->cr_prison->pr_allow & pr_allow_flag)) + return (EPERM); + + return (0); +} + +static int vcpu_lock_one(struct vmmdev_softc *sc, int vcpu) { int error; @@ -177,6 +192,10 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag void *hpa, *cookie; struct vmmdev_softc *sc; + error = vmm_priv_check(curthread->td_ucred); + if (error) + return (error); + sc = vmmdev_lookup2(cdev); if (sc == NULL) return (ENXIO); @@ -351,11 +370,14 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da uint64_t *regvals; int *regnums; + error = vmm_priv_check(curthread->td_ucred); + if (error) + return (error); + sc = vmmdev_lookup2(cdev); if (sc == NULL) return (ENXIO); - error = 0; vcpu = -1; state_changed = 0; @@ -777,6 +799,10 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of int error, found, segid; bool sysmem; + error = vmm_priv_check(curthread->td_ucred); + if (error) + return (error); + first = *offset; last = first + mapsize; if ((nprot & PROT_EXEC) || first < 0 || first >= last) @@ -865,6 +891,10 @@ sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) struct vmmdev_softc *sc; struct cdev *cdev; + error = vmm_priv_check(req->td->td_ucred); + if (error) + return (error); + strlcpy(buf, "beavis", sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) @@ -906,7 +936,8 @@ sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) destroy_dev_sched_cb(cdev, vmmdev_destroy, sc); return (0); } -SYSCTL_PROC(_hw_vmm, OID_AUTO, destroy, CTLTYPE_STRING | CTLFLAG_RW, +SYSCTL_PROC(_hw_vmm, OID_AUTO, destroy, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON, NULL, 0, sysctl_vmm_destroy, "A", NULL); static struct cdevsw vmmdevsw = { @@ -927,6 +958,10 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) struct vmmdev_softc *sc, *sc2; char buf[VM_MAX_NAMELEN]; + error = vmm_priv_check(req->td->td_ucred); + if (error) + return (error); + strlcpy(buf, "beavis", sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) @@ -977,13 +1012,16 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) return (0); } -SYSCTL_PROC(_hw_vmm, OID_AUTO, create, CTLTYPE_STRING | CTLFLAG_RW, +SYSCTL_PROC(_hw_vmm, OID_AUTO, create, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON, NULL, 0, sysctl_vmm_create, "A", NULL); void vmmdev_init(void) { mtx_init(_mtx, "vmm device mutex", NULL, MTX_DEF); + pr_allow_flag = prison_add_allow(NULL, "vmm", NULL, + "Allow use of vmm in a jail."); } int Modified: head/usr.sbin/jail/jail.8 == --- head/usr.sbin/jail/jail.8 Tue Jul 31 23:44:13 2018(r337022) +++ head/usr.sbin/jail/jail.8 Wed Aug 1 00:39:21 2018(r337023) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2018 +.Dd July 30, 2018 .Dt JAIL 8 .Os .Sh NAME @@ -650,6 +650,12 @@ See .Xr zfs 8 for information on how to configure the ZFS filesystem to operate from
Re: svn commit: r336188 - head/usr.sbin/bhyve
Hi Ravi, Yes, you are correct! I have discussed about it in the review and the approach you mentioned is exactly I'm gonna do. Although with this patch the intention for now is make exit(1) more unique for "powered off". Snipped from the review: "OK, I will update the manpage and commit it as-is just to make the exit(1) more unique for now. I have intention to revisit it and improve all the exit returns. I will replace fprintf/perror + exit as soon as I finish the drivers analysis to make sure what can be improved as error, exit and return code." The full discussion is at that review. Best, 2018-07-11 11:28 GMT+08:00 Ravi Pokala : > Hi Marcelo, > > If the intention is to have specific exit codes have specific meanings, > wouldn't it be useful to set up defines or an enum or something, so a > symbolic value can be used rather than a bare integer? > > Thanks, > > Ravi (rpokala@) > > -----Original Message- > From: on behalf of Marcelo Araujo > > Date: 2018-07-10, Tuesday at 20:23 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r336188 - head/usr.sbin/bhyve > > Author: araujo > Date: Wed Jul 11 03:23:09 2018 > New Revision: 336188 > URL: https://svnweb.freebsd.org/changeset/base/336188 > > Log: > Improve bhyve exit(3) error code. > > The bhyve(8) exit status indicates how the VM was terminated: > > 0 rebooted > 1 powered off > 2 halted > 3 triple fault > > The problem is when we have wrappers around bhyve that parses the exit > error code and gets an exit(1) for an error but interprets it as > "powered off". > So to mitigate this issue and makes it less error prone for third part > applications, I have added a new exit code 4 that is "exited due to an > error". > > For now the bhyve(8) exit status are: > 0 rebooted > 1 powered off > 2 halted > 3 triple fault > 4 exited due to an error > > Reviewed by: @jhb > MFC after:2 weeks. > Sponsored by: iXsystems Inc. > Differential Revision:https://reviews.freebsd.org/D16161 > > Modified: > head/usr.sbin/bhyve/bhyve.8 > head/usr.sbin/bhyve/bhyverun.c > head/usr.sbin/bhyve/dbgport.c > head/usr.sbin/bhyve/fwctl.c > head/usr.sbin/bhyve/mevent_test.c > head/usr.sbin/bhyve/pci_e82545.c > > Modified: head/usr.sbin/bhyve/bhyve.8 > > == > --- head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 02:32:06 2018(r336187) > +++ head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 03:23:09 2018(r336188) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd Jul 05, 2018 > +.Dd Jul 11, 2018 > .Dt BHYVE 8 > .Os > .Sh NAME > @@ -520,6 +520,8 @@ powered off > halted > .It 3 > triple fault > +.It 4 > +exited due to an error > .El > .Sh EXAMPLES > If not using a boot ROM, the guest operating system must have been loaded > with > > Modified: head/usr.sbin/bhyve/bhyverun.c > > == > --- head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 02:32:06 2018 > (r336187) > +++ head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 03:23:09 2018 > (r336188) > @@ -397,7 +397,7 @@ fbsdrun_deletecpu(struct vmctx *ctx, int vcpu) > > if (!CPU_ISSET(vcpu, )) { > fprintf(stderr, "Attempting to delete unknown cpu %d\n", > vcpu); > - exit(1); > + exit(4); > } > > CPU_CLR_ATOMIC(vcpu, ); > @@ -742,7 +742,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip > if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == > NULL) { > fprintf(stderr, "vm_loop: unexpected exitcode > 0x%x\n", > exitcode); > - exit(1); > + exit(4); > } > > rc = (*handler[exitcode])(ctx, [vcpu], ); > @@ -753,7 +753,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip > case VMEXIT_ABORT: > abort(); > default: > - exit(1); > + exit(4); > } > } > fprintf(stderr, "vm_run error %d, errno %d\n", error, errno); > @@ -785,7 +785,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) > err = vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, ); > if (err < 0) { > fprintf(stderr, "
svn commit: r336188 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jul 11 03:23:09 2018 New Revision: 336188 URL: https://svnweb.freebsd.org/changeset/base/336188 Log: Improve bhyve exit(3) error code. The bhyve(8) exit status indicates how the VM was terminated: 0 rebooted 1 powered off 2 halted 3 triple fault The problem is when we have wrappers around bhyve that parses the exit error code and gets an exit(1) for an error but interprets it as "powered off". So to mitigate this issue and makes it less error prone for third part applications, I have added a new exit code 4 that is "exited due to an error". For now the bhyve(8) exit status are: 0 rebooted 1 powered off 2 halted 3 triple fault 4 exited due to an error Reviewed by: @jhb MFC after:2 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D16161 Modified: head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/dbgport.c head/usr.sbin/bhyve/fwctl.c head/usr.sbin/bhyve/mevent_test.c head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 02:32:06 2018(r336187) +++ head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 03:23:09 2018(r336188) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jul 05, 2018 +.Dd Jul 11, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -520,6 +520,8 @@ powered off halted .It 3 triple fault +.It 4 +exited due to an error .El .Sh EXAMPLES If not using a boot ROM, the guest operating system must have been loaded with Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 03:23:09 2018 (r336188) @@ -397,7 +397,7 @@ fbsdrun_deletecpu(struct vmctx *ctx, int vcpu) if (!CPU_ISSET(vcpu, )) { fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu); - exit(1); + exit(4); } CPU_CLR_ATOMIC(vcpu, ); @@ -742,7 +742,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", exitcode); - exit(1); + exit(4); } rc = (*handler[exitcode])(ctx, [vcpu], ); @@ -753,7 +753,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip case VMEXIT_ABORT: abort(); default: - exit(1); + exit(4); } } fprintf(stderr, "vm_run error %d, errno %d\n", error, errno); @@ -785,7 +785,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) err = vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, ); if (err < 0) { fprintf(stderr, "VM exit on HLT not supported\n"); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_HALT_EXIT, 1); if (cpu == BSP) @@ -800,7 +800,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) if (err < 0) { fprintf(stderr, "SMP mux requested, no pause support\n"); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, 1); if (cpu == BSP) @@ -814,7 +814,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) if (err) { fprintf(stderr, "Unable to set x2apic state (%d)\n", err); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_ENABLE_INVPCID, 1); @@ -850,7 +850,7 @@ do_open(const char *vmname) } } else { perror("vm_create"); - exit(1); + exit(4); } } else { if (!romboot) { @@ -859,14 +859,14 @@ do_open(const char *vmname) * bootrom must be configured to boot it. */ fprintf(stderr, "virtual machine cannot be booted\n"); - exit(1); + exit(4); } } ctx = vm_open(vmname); if (ctx == NULL) { perror("vm_open"); - exit(1); + exit(4); } #ifndef WITHOUT_CAPSICUM @@ -888,7 +888,7 @@ do_open(const char *vmname) error = vm_reinit(ctx);
svn commit: r336162 - head/usr.sbin/bhyve
Author: araujo Date: Tue Jul 10 05:36:32 2018 New Revision: 336162 URL: https://svnweb.freebsd.org/changeset/base/336162 Log: Fix style(9) space and tab. Modified: head/usr.sbin/bhyve/pci_virtio_block.c Modified: head/usr.sbin/bhyve/pci_virtio_block.c == --- head/usr.sbin/bhyve/pci_virtio_block.c Tue Jul 10 04:26:32 2018 (r336161) +++ head/usr.sbin/bhyve/pci_virtio_block.c Tue Jul 10 05:36:32 2018 (r336162) @@ -109,7 +109,7 @@ struct virtio_blk_hdr { #defineVBH_OP_WRITE1 #defineVBH_OP_FLUSH4 #defineVBH_OP_FLUSH_OUT5 -#defineVBH_OP_IDENT8 +#defineVBH_OP_IDENT8 #defineVBH_FLAG_BARRIER0x8000 /* OR'ed into vbh_type */ uint32_tvbh_type; uint32_tvbh_ioprio; @@ -151,7 +151,7 @@ static int pci_vtblk_cfgwrite(void *, int, int, uint32 static struct virtio_consts vtblk_vi_consts = { "vtblk",/* our name */ 1, /* we support 1 virtqueue */ - sizeof(struct vtblk_config), /* config reg size */ + sizeof(struct vtblk_config),/* config reg size */ pci_vtblk_reset,/* reset */ pci_vtblk_notify, /* device-wide qnotify */ pci_vtblk_cfgread, /* read PCI config */ @@ -249,7 +249,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vque } io->io_req.br_resid = iolen; - DPRINTF(("virtio-block: %s op, %zd bytes, %d segs, offset %ld\n\r", + DPRINTF(("virtio-block: %s op, %zd bytes, %d segs, offset %ld\n\r", writeop ? "write" : "read/ident", iolen, i - 1, io->io_req.br_offset)); @@ -309,7 +309,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst * */ snprintf(bident, sizeof(bident), "%d:%d", pi->pi_slot, pi->pi_func); bctxt = blockif_open(opts, bident); - if (bctxt == NULL) { + if (bctxt == NULL) { perror("Could not open backing file"); return (1); } @@ -343,7 +343,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst * */ MD5Init(); MD5Update(, opts, strlen(opts)); - MD5Final(digest, ); + MD5Final(digest, ); sprintf(sc->vbsc_ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X", digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335974 - head/usr.sbin/bhyve
Author: araujo Date: Thu Jul 5 03:33:58 2018 New Revision: 335974 URL: https://svnweb.freebsd.org/changeset/base/335974 Log: - Add bhyve NVMe device emulation. The initial work on bhyve NVMe device emulation was done by the GSoC student Shunsuke Mie and was heavily modified in performan, functionality and guest support by Leon Dang. bhyve: -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z accepted devpath: /dev/blockdev /path/to/image ram=size_in_MiB Tested with guest OS: FreeBSD Head, Linux Fedora fc27, Ubuntu 18.04, OpenSuse 15.0, Windows Server 2016 Datacenter. Tested with all accepted device paths: Real nvme, zdev and also with ram. Tested on: AMD Ryzen Threadripper 1950X 16-Core Processor and Intel(R) Xeon(R) CPU E5-2609 v2 @ 2.50GHz. Tests at: https://people.freebsd.org/~araujo/bhyve_nvme/nvme.txt Submitted by: Shunsuke Mie , Leon Dang Reviewed by: chuck (early version), grehan Relnotes: Yes Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D14022 Added: head/usr.sbin/bhyve/pci_nvme.c (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/block_if.h Modified: head/usr.sbin/bhyve/Makefile == --- head/usr.sbin/bhyve/MakefileThu Jul 5 02:43:10 2018 (r335973) +++ head/usr.sbin/bhyve/MakefileThu Jul 5 03:33:58 2018 (r335974) @@ -41,6 +41,7 @@ SRCS= \ pci_hostbridge.c\ pci_irq.c \ pci_lpc.c \ + pci_nvme.c \ pci_passthru.c \ pci_virtio_block.c \ pci_virtio_console.c\ Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Thu Jul 5 02:43:10 2018(r335973) +++ head/usr.sbin/bhyve/bhyve.8 Thu Jul 5 03:33:58 2018(r335974) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jun 11, 2018 +.Dd Jul 05, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -241,6 +241,8 @@ The LPC bridge emulation can only be configured on bus Raw framebuffer device attached to VNC server. .It Li xhci eXtensible Host Controller Interface (xHCI) USB controller. +.It Li nvme +NVM Express (NVMe) controller. .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -432,6 +434,27 @@ xHCI USB devices: .It Li tablet A USB tablet device which provides precise cursor synchronization when using VNC. +.El +.Pp +NVMe devices: +.Bl -tag -width 10n +.It Li devpath +Accepted device paths are: +.Ar /dev/blockdev +or +.Ar /path/to/image +or +.Ar ram=size_in_MiB . +.It Li maxq +Max number of queues. +.It Li qsz +Max elements in each queue. +.It Li ioslots +Max number of concurrent I/O requests. +.It Li sectsz +Sector size (defaults to blockif sector size). +.It Li ser +Serial number with maximum 20 characters. .El .El .It Fl S Modified: head/usr.sbin/bhyve/block_if.h == --- head/usr.sbin/bhyve/block_if.h Thu Jul 5 02:43:10 2018 (r335973) +++ head/usr.sbin/bhyve/block_if.h Thu Jul 5 03:33:58 2018 (r335974) @@ -44,12 +44,12 @@ #define BLOCKIF_IOV_MAX33 /* not practical to be IOV_MAX */ struct blockif_req { - struct iovecbr_iov[BLOCKIF_IOV_MAX]; int br_iovcnt; off_t br_offset; ssize_t br_resid; void(*br_callback)(struct blockif_req *req, int err); void*br_param; + struct iovecbr_iov[BLOCKIF_IOV_MAX]; }; struct blockif_ctxt; Added: head/usr.sbin/bhyve/pci_nvme.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/pci_nvme.c Thu Jul 5 03:33:58 2018 (r335974) @@ -0,0 +1,1853 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017 Shunsuke Mie + * Copyright (c) 2018 Leon Dang + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES,
svn commit: r335104 - head/usr.sbin/bhyve
Author: araujo Date: Thu Jun 14 01:34:53 2018 New Revision: 335104 URL: https://svnweb.freebsd.org/changeset/base/335104 Log: Fix style(9) space vs tab. Reviewed by: jhb MFC after:3 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15768 Modified: head/usr.sbin/bhyve/acpi.c head/usr.sbin/bhyve/ahci.h head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/block_if.c head/usr.sbin/bhyve/bootrom.h head/usr.sbin/bhyve/console.h head/usr.sbin/bhyve/consport.c head/usr.sbin/bhyve/inout.c head/usr.sbin/bhyve/mem.h head/usr.sbin/bhyve/mevent.c head/usr.sbin/bhyve/mevent_test.c head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_virtio_net.c head/usr.sbin/bhyve/pci_xhci.c head/usr.sbin/bhyve/rfb.c head/usr.sbin/bhyve/rtc.c head/usr.sbin/bhyve/sockstream.c head/usr.sbin/bhyve/uart_emul.c head/usr.sbin/bhyve/usb_mouse.c head/usr.sbin/bhyve/vga.h head/usr.sbin/bhyve/virtio.c head/usr.sbin/bhyve/virtio.h Modified: head/usr.sbin/bhyve/acpi.c == --- head/usr.sbin/bhyve/acpi.c Thu Jun 14 01:28:55 2018(r335103) +++ head/usr.sbin/bhyve/acpi.c Thu Jun 14 01:34:53 2018(r335104) @@ -885,7 +885,7 @@ basl_make_templates(void) int len; err = 0; - + /* * */ Modified: head/usr.sbin/bhyve/ahci.h == --- head/usr.sbin/bhyve/ahci.h Thu Jun 14 01:28:55 2018(r335103) +++ head/usr.sbin/bhyve/ahci.h Thu Jun 14 01:34:53 2018(r335104) @@ -33,292 +33,292 @@ #define_AHCI_H_ /* ATA register defines */ -#define ATA_DATA0 /* (RW) data */ +#defineATA_DATA0 /* (RW) data */ -#define ATA_FEATURE 1 /* (W) feature */ -#define ATA_F_DMA 0x01/* enable DMA */ -#define ATA_F_OVL 0x02/* enable overlap */ +#defineATA_FEATURE 1 /* (W) feature */ +#defineATA_F_DMA 0x01/* enable DMA */ +#defineATA_F_OVL 0x02/* enable overlap */ -#define ATA_COUNT 2 /* (W) sector count */ +#defineATA_COUNT 2 /* (W) sector count */ -#define ATA_SECTOR 3 /* (RW) sector # */ -#define ATA_CYL_LSB 4 /* (RW) cylinder# LSB */ -#define ATA_CYL_MSB 5 /* (RW) cylinder# MSB */ -#define ATA_DRIVE 6 /* (W) Sector/Drive/Head */ -#define ATA_D_LBA 0x40/* use LBA addressing */ -#define ATA_D_IBM 0xa0/* 512 byte sectors, ECC */ +#defineATA_SECTOR 3 /* (RW) sector # */ +#defineATA_CYL_LSB 4 /* (RW) cylinder# LSB */ +#defineATA_CYL_MSB 5 /* (RW) cylinder# MSB */ +#defineATA_DRIVE 6 /* (W) Sector/Drive/Head */ +#defineATA_D_LBA 0x40/* use LBA addressing */ +#defineATA_D_IBM 0xa0/* 512 byte sectors, ECC */ -#define ATA_COMMAND 7 /* (W) command */ +#defineATA_COMMAND 7 /* (W) command */ -#define ATA_ERROR 8 /* (R) error */ -#define ATA_E_ILI 0x01/* illegal length */ -#define ATA_E_NM0x02/* no media */ -#define ATA_E_ABORT 0x04/* command aborted */ -#define ATA_E_MCR 0x08/* media change request */ -#define ATA_E_IDNF 0x10/* ID not found */ -#define ATA_E_MC0x20/* media changed */ -#define ATA_E_UNC 0x40/* uncorrectable data */ -#define ATA_E_ICRC 0x80/* UDMA crc error */ -#defineATA_E_ATAPI_SENSE_MASK 0xf0/* ATAPI sense key mask */ +#defineATA_ERROR 8 /* (R) error */ +#defineATA_E_ILI 0x01/* illegal length */ +#defineATA_E_NM0x02/* no media */ +#defineATA_E_ABORT 0x04/* command aborted */ +#defineATA_E_MCR 0x08/* media change request */ +#defineATA_E_IDNF 0x10/* ID not found */ +#defineATA_E_MC0x20/* media changed */ +#defineATA_E_UNC 0x40/* uncorrectable data */ +#defineATA_E_ICRC 0x80/* UDMA crc error */ +#defineATA_E_ATAPI_SENSE_MASK 0xf0/* ATAPI sense key mask */ -#define ATA_IREASON 9 /* (R) interrupt reason */ -#define ATA_I_CMD
svn commit: r335103 - head/lib/libvmmapi
Author: araujo Date: Thu Jun 14 01:28:55 2018 New Revision: 335103 URL: https://svnweb.freebsd.org/changeset/base/335103 Log: Fix style(9) space vs tab. Reviewed by: jhb MFC after:3 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15774 Modified: head/lib/libvmmapi/vmmapi.c Modified: head/lib/libvmmapi/vmmapi.c == --- head/lib/libvmmapi/vmmapi.c Thu Jun 14 01:27:35 2018(r335102) +++ head/lib/libvmmapi/vmmapi.c Thu Jun 14 01:28:55 2018(r335103) @@ -85,19 +85,19 @@ struct vmctx { static int vm_device_open(const char *name) { -int fd, len; -char *vmfile; + int fd, len; + char *vmfile; len = strlen("/dev/vmm/") + strlen(name) + 1; vmfile = malloc(len); assert(vmfile != NULL); snprintf(vmfile, len, "/dev/vmm/%s", name); -/* Open the device file */ -fd = open(vmfile, O_RDWR, 0); + /* Open the device file */ + fd = open(vmfile, O_RDWR, 0); free(vmfile); -return (fd); + return (fd); } int @@ -876,7 +876,7 @@ vm_set_capability(struct vmctx *ctx, int vcpu, enum vm vmcap.cpuid = vcpu; vmcap.captype = cap; vmcap.capval = val; - + return (ioctl(ctx->fd, VM_SET_CAPABILITY, )); } @@ -1580,4 +1580,3 @@ vm_get_ioctls(size_t *len) *len = nitems(vm_ioctl_cmds); return (NULL); } - ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335050 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jun 13 11:49:34 2018 New Revision: 335050 URL: https://svnweb.freebsd.org/changeset/base/335050 Log: While I was investigating CID 1194192 related with a resource leak on mrp memory allocation, I could identify that actually we use this pointer on pci_emul.c as well as on vga.c source file. I have reworked the logic here to make it more readable and also add a warn to explicit show the function where the memory allocation error could happen, also sort headers. Also CID 1194192 was marked as "Intentional". Obtained from:TrueOS MFC after:4 weeks. Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/mem.c Modified: head/usr.sbin/bhyve/mem.c == --- head/usr.sbin/bhyve/mem.c Wed Jun 13 11:12:52 2018(r335049) +++ head/usr.sbin/bhyve/mem.c Wed Jun 13 11:49:34 2018(r335050) @@ -38,15 +38,16 @@ __FBSDID("$FreeBSD$"); #include -#include #include +#include #include #include -#include -#include #include +#include #include +#include +#include #include "mem.h" @@ -285,8 +286,11 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_ err = 0; mrp = malloc(sizeof(struct mmio_rb_range)); - - if (mrp != NULL) { + if (mrp == NULL) { + warn("%s: couldn't allocate memory for mrp\n", +__func__); + err = ENOMEM; + } else { mrp->mr_param = *memp; mrp->mr_base = memp->base; mrp->mr_end = memp->base + memp->size - 1; @@ -297,8 +301,7 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_ assert(perror == 0); if (err) free(mrp); - } else - err = ENOMEM; + } return (err); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335030 - in head/sys/amd64/vmm: . amd intel io
Author: araujo Date: Wed Jun 13 07:02:58 2018 New Revision: 335030 URL: https://svnweb.freebsd.org/changeset/base/335030 Log: Add SPDX tags to vmm(4). MFC after:4 weeks. Sponsored by: iXsystems Inc. Modified: head/sys/amd64/vmm/amd/amdvi_hw.c head/sys/amd64/vmm/amd/amdvi_priv.h head/sys/amd64/vmm/amd/ivrs_drv.c head/sys/amd64/vmm/amd/npt.c head/sys/amd64/vmm/amd/npt.h head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/amd/svm.h head/sys/amd64/vmm/amd/svm_genassym.c head/sys/amd64/vmm/amd/svm_msr.c head/sys/amd64/vmm/amd/svm_msr.h head/sys/amd64/vmm/amd/svm_softc.h head/sys/amd64/vmm/amd/svm_support.S head/sys/amd64/vmm/amd/vmcb.c head/sys/amd64/vmm/amd/vmcb.h head/sys/amd64/vmm/intel/vmx_support.S head/sys/amd64/vmm/io/vatpic.c head/sys/amd64/vmm/io/vatpit.h head/sys/amd64/vmm/io/vpmtmr.c head/sys/amd64/vmm/io/vpmtmr.h head/sys/amd64/vmm/io/vrtc.c head/sys/amd64/vmm/io/vrtc.h head/sys/amd64/vmm/vmm_ioport.c head/sys/amd64/vmm/vmm_ioport.h Modified: head/sys/amd64/vmm/amd/amdvi_hw.c == --- head/sys/amd64/vmm/amd/amdvi_hw.c Wed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/amdvi_hw.c Wed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016, Anish Gupta (an...@freebsd.org) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/amdvi_priv.h == --- head/sys/amd64/vmm/amd/amdvi_priv.h Wed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/amdvi_priv.h Wed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Anish Gupta (an...@freebsd.org) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/ivrs_drv.c == --- head/sys/amd64/vmm/amd/ivrs_drv.c Wed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/ivrs_drv.c Wed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016, Anish Gupta (an...@freebsd.org) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/npt.c == --- head/sys/amd64/vmm/amd/npt.cWed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/npt.cWed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/npt.h == --- head/sys/amd64/vmm/amd/npt.hWed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/npt.hWed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/svm.c == --- head/sys/amd64/vmm/amd/svm.cWed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/svm.cWed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013, Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/svm.h == --- head/sys/amd64/vmm/amd/svm.hWed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/svm.hWed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/svm_genassym.c == --- head/sys/amd64/vmm/amd/svm_genassym.c Wed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/svm_genassym.c Wed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: head/sys/amd64/vmm/amd/svm_msr.c == --- head/sys/amd64/vmm/amd/svm_msr.cWed Jun 13 06:11:04 2018 (r335029) +++ head/sys/amd64/vmm/amd/svm_msr.cWed Jun 13 07:02:58 2018 (r335030) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014,
svn commit: r335027 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jun 13 04:00:21 2018 New Revision: 335027 URL: https://svnweb.freebsd.org/changeset/base/335027 Log: When this code was introduced at r300829 the author forgot to add the BSD license header that is the same as in its C header file. MFC after:4 weeks. Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/bhyvegc.c Modified: head/usr.sbin/bhyve/bhyvegc.c == --- head/usr.sbin/bhyve/bhyvegc.c Wed Jun 13 03:35:24 2018 (r335026) +++ head/usr.sbin/bhyve/bhyvegc.c Wed Jun 13 04:00:21 2018 (r335027) @@ -1,3 +1,31 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015 Tycho Nightingale + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #include __FBSDID("$FreeBSD$"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335026 - in head/usr.sbin: bhyvectl bhyveload
Author: araujo Date: Wed Jun 13 03:35:24 2018 New Revision: 335026 URL: https://svnweb.freebsd.org/changeset/base/335026 Log: style(9) remove unnecessary blank tabs. Obtained from:TrueOS MFC after:4 weeks. Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyvectl/bhyvectl.c head/usr.sbin/bhyveload/bhyveload.c Modified: head/usr.sbin/bhyvectl/bhyvectl.c == --- head/usr.sbin/bhyvectl/bhyvectl.c Wed Jun 13 03:22:08 2018 (r335025) +++ head/usr.sbin/bhyvectl/bhyvectl.c Wed Jun 13 03:35:24 2018 (r335026) @@ -848,7 +848,7 @@ get_all_registers(struct vmctx *ctx, int vcpu) if (error == 0) printf("rflags[%d]\t0x%016lx\n", vcpu, rflags); } - + return (error); } @@ -1115,7 +1115,7 @@ get_misc_vmcs(struct vmctx *ctx, int vcpu) vcpu, u64); } } - + if (!error && (get_tpr_threshold || get_all)) { uint64_t threshold; error = vm_get_vmcs_field(ctx, vcpu, VMCS_TPR_THRESHOLD, @@ -1133,7 +1133,7 @@ get_misc_vmcs(struct vmctx *ctx, int vcpu) vcpu, insterr); } } - + if (!error && (get_exit_ctls || get_all)) { error = vm_get_vmcs_field(ctx, vcpu, VMCS_EXIT_CTLS, ); if (error == 0) @@ -1181,7 +1181,7 @@ get_misc_vmcs(struct vmctx *ctx, int vcpu) if (error == 0) printf("host_rsp[%d]\t\t0x%016lx\n", vcpu, rsp); } - + if (!error && (get_vmcs_link || get_all)) { error = vm_get_vmcs_field(ctx, vcpu, VMCS_LINK_POINTER, ); if (error == 0) Modified: head/usr.sbin/bhyveload/bhyveload.c == --- head/usr.sbin/bhyveload/bhyveload.c Wed Jun 13 03:22:08 2018 (r335025) +++ head/usr.sbin/bhyveload/bhyveload.c Wed Jun 13 03:35:24 2018 (r335026) @@ -365,7 +365,7 @@ cb_setreg(void *arg, int r, uint64_t v) { int error; enum vm_reg_name vmreg; - + vmreg = VM_REG_LAST; switch (r) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335025 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jun 13 03:22:08 2018 New Revision: 335025 URL: https://svnweb.freebsd.org/changeset/base/335025 Log: Add SPDX tags to bhyve(8). Discussed with: rgrimes, pfg and mav. Obtained from:TrueOS MFC after:4 weeks. Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/atkbdc.c head/usr.sbin/bhyve/bhyvegc.h head/usr.sbin/bhyve/bootrom.c head/usr.sbin/bhyve/bootrom.h head/usr.sbin/bhyve/console.c head/usr.sbin/bhyve/console.h head/usr.sbin/bhyve/fwctl.c head/usr.sbin/bhyve/fwctl.h head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_fbuf.c head/usr.sbin/bhyve/pci_irq.c head/usr.sbin/bhyve/pci_irq.h head/usr.sbin/bhyve/pci_virtio_console.c head/usr.sbin/bhyve/pci_virtio_rnd.c head/usr.sbin/bhyve/pci_xhci.c head/usr.sbin/bhyve/pci_xhci.h head/usr.sbin/bhyve/ps2kbd.c head/usr.sbin/bhyve/ps2kbd.h head/usr.sbin/bhyve/ps2mouse.c head/usr.sbin/bhyve/ps2mouse.h head/usr.sbin/bhyve/rfb.c head/usr.sbin/bhyve/rfb.h head/usr.sbin/bhyve/sockstream.c head/usr.sbin/bhyve/sockstream.h head/usr.sbin/bhyve/task_switch.c head/usr.sbin/bhyve/usb_emul.c head/usr.sbin/bhyve/usb_emul.h head/usr.sbin/bhyve/usb_mouse.c head/usr.sbin/bhyve/vga.c head/usr.sbin/bhyve/vga.h Modified: head/usr.sbin/bhyve/atkbdc.c == --- head/usr.sbin/bhyve/atkbdc.cWed Jun 13 00:45:38 2018 (r335024) +++ head/usr.sbin/bhyve/atkbdc.cWed Jun 13 03:22:08 2018 (r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 Tycho Nightingale * Copyright (c) 2015 Nahanni Systems Inc. * All rights reserved. Modified: head/usr.sbin/bhyve/bhyvegc.h == --- head/usr.sbin/bhyve/bhyvegc.h Wed Jun 13 00:45:38 2018 (r335024) +++ head/usr.sbin/bhyve/bhyvegc.h Wed Jun 13 03:22:08 2018 (r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Tycho Nightingale * All rights reserved. * Modified: head/usr.sbin/bhyve/bootrom.c == --- head/usr.sbin/bhyve/bootrom.c Wed Jun 13 00:45:38 2018 (r335024) +++ head/usr.sbin/bhyve/bootrom.c Wed Jun 13 03:22:08 2018 (r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Neel Natu * All rights reserved. * Modified: head/usr.sbin/bhyve/bootrom.h == --- head/usr.sbin/bhyve/bootrom.h Wed Jun 13 00:45:38 2018 (r335024) +++ head/usr.sbin/bhyve/bootrom.h Wed Jun 13 03:22:08 2018 (r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Neel Natu * All rights reserved. * Modified: head/usr.sbin/bhyve/console.c == --- head/usr.sbin/bhyve/console.c Wed Jun 13 00:45:38 2018 (r335024) +++ head/usr.sbin/bhyve/console.c Wed Jun 13 03:22:08 2018 (r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Tycho Nightingale * All rights reserved. * Modified: head/usr.sbin/bhyve/console.h == --- head/usr.sbin/bhyve/console.h Wed Jun 13 00:45:38 2018 (r335024) +++ head/usr.sbin/bhyve/console.h Wed Jun 13 03:22:08 2018 (r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Tycho Nightingale * All rights reserved. * Modified: head/usr.sbin/bhyve/fwctl.c == --- head/usr.sbin/bhyve/fwctl.c Wed Jun 13 00:45:38 2018(r335024) +++ head/usr.sbin/bhyve/fwctl.c Wed Jun 13 03:22:08 2018(r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Peter Grehan * All rights reserved. * Modified: head/usr.sbin/bhyve/fwctl.h == --- head/usr.sbin/bhyve/fwctl.h Wed Jun 13 00:45:38 2018(r335024) +++ head/usr.sbin/bhyve/fwctl.h Wed Jun 13 03:22:08 2018(r335025) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Peter Grehan * All rights reserved. * Modified: head/usr.sbin/bhyve/pci_e82545.c == --- head/usr.sbin/bhyve/pci_e82545.cWed Jun 13 00:45:38 2018 (r335024) +++ head/usr.sbin/bhyve/pci_e82545.cWed Jun 13 03:22:08 2018
Re: svn commit: r334940 - head/usr.sbin/bhyve
2018-06-11 22:46 GMT+08:00 Pedro Giffuni : > > > On 06/10/18 21:41, Marcelo Araujo wrote: > > > > 2018-06-11 10:25 GMT+08:00 Pedro Giffuni : > >> >> >> On 10/06/2018 21:09, Marcelo Araujo wrote: >> >>> Author: araujo >>> Date: Mon Jun 11 02:09:20 2018 >>> New Revision: 334940 >>> URL: https://svnweb.freebsd.org/changeset/base/334940 >>> >>> Log: >>>- Add bhyve virtio-scsi storage backend support. >>> Example of configuration: >>>ctl.conf: >>>portal-group pg0 { >>>discovery-auth-group no-authentication >>>listen 0.0.0.0 >>>listen [::] >>>} >>> target iqn.2012-06.com.example:target0 { >>>auth-group no-authentication >>>portal-group pg0 >>>port ioctl/5/3 >>> lun 0 { >>>path /z/test.img >>>size 8G >>>} >>>lun 1 { >>>path /z/test1.img >>>size 8G >>>} >>>} >>> bhyve <...> -s 4,virtio-scsi,/dev/cam/ctl5.3,iid=3 >>> From inside guest: >>>root@:~ # zpool status test >>> pool: test >>> state: ONLINE >>> scan: none requested >>>config: >>> NAMESTATE READ WRITE CKSUM >>>testONLINE 0 0 0 >>> da0 ONLINE 0 0 0 >>> da1 ONLINE 0 0 0 >>> dmesg: >>>da0 at vtscsi0 bus 0 scbus0 target 0 lun 0 >>>da0: Fixed Direct Access SPC-5 SCSI device >>>da0: Serial Number MYSERIAL >>>da0: 300.000MB/s transfers >>>da0: Command Queueing enabled >>>da0: 8192MB (16777216 512 byte sectors) >>>da1 at vtscsi0 bus 0 scbus0 target 0 lun 1 >>>da1: Fixed Direct Access SPC-5 SCSI device >>>da1: Serial Number MYSERIAL0001 >>>da1: 300.000MB/s transfers >>>da1: Command Queueing enabled >>>da1: 8192MB (16777216 512 byte sectors) >>> Discussed with: grehan >>>Reviewed by: mav >>>Obtained from: TrueOS >>>Relnotes:Yes >>>Sponsored by:iXsystems Inc. >>>Tested with: FreeBSD HEAD, Fedora 28 (Workstation) and >>> Ubuntu 18.04. >>>Differential Revision: https://reviews.freebsd.org/D15276 >>> >>> Added: >>>head/usr.sbin/bhyve/iov.c (contents, props changed) >>>head/usr.sbin/bhyve/iov.h (contents, props changed) >>>head/usr.sbin/bhyve/pci_virtio_scsi.c (contents, props changed) >>> Modified: >>>head/usr.sbin/bhyve/Makefile >>>head/usr.sbin/bhyve/bhyve.8 >>>head/usr.sbin/bhyve/virtio.h >>> >>> ... >>> >> >> Added: head/usr.sbin/bhyve/pci_virtio_scsi.c >>> >>> == >>> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >>> +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Mon Jun 11 02:09:20 >>> 2018(r334940) >>> @@ -0,0 +1,718 @@ >>> +/*- >>> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD >>> + * >>> + * Copyright (c) 2016 Jakub Klama >>> . >>> + * Copyright (c) 2018 Marcelo Araujo >>> . >>> + * All rights reserved. >>> + * >>> + * Redistribution and use in source and binary forms, with or without >>> + * modification, are permitted provided that the following conditions >>> + * are met: >>> + * 1. Redistributions of source code must retain the above copyright >>> + *notice, this list of conditions and the following disclaimer >>> + *in this position and unchanged. >>> + * 2. Redistributions in binary form must reproduce the above copyright >>> + *notice, this list of conditions and the following disclaimer in >>> the >>> + *documentation and/or other materials provided with the >>> distribution. >>> + * >>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' >>> AND >>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >>> + * IMPLIED WARRA
svn commit: r334951 - head/usr.sbin/bhyve
Author: araujo Date: Mon Jun 11 15:18:31 2018 New Revision: 334951 URL: https://svnweb.freebsd.org/changeset/base/334951 Log: More style(9) fixes, space vs tab. Modified: head/usr.sbin/bhyve/pci_virtio_block.c Modified: head/usr.sbin/bhyve/pci_virtio_block.c == --- head/usr.sbin/bhyve/pci_virtio_block.c Mon Jun 11 14:45:34 2018 (r334950) +++ head/usr.sbin/bhyve/pci_virtio_block.c Mon Jun 11 15:18:31 2018 (r334951) @@ -111,7 +111,7 @@ struct virtio_blk_hdr { #defineVBH_OP_FLUSH_OUT5 #defineVBH_OP_IDENT8 #defineVBH_FLAG_BARRIER0x8000 /* OR'ed into vbh_type */ - uint32_tvbh_type; + uint32_tvbh_type; uint32_tvbh_ioprio; uint64_tvbh_sector; } __packed; @@ -125,8 +125,8 @@ static int pci_vtblk_debug; struct pci_vtblk_ioreq { struct blockif_req io_req; - struct pci_vtblk_softc *io_sc; - uint8_t*io_status; + struct pci_vtblk_softc *io_sc; + uint8_t *io_status; uint16_tio_idx; }; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334940 - head/usr.sbin/bhyve
2018-06-11 10:25 GMT+08:00 Pedro Giffuni : > > > On 10/06/2018 21:09, Marcelo Araujo wrote: > >> Author: araujo >> Date: Mon Jun 11 02:09:20 2018 >> New Revision: 334940 >> URL: https://svnweb.freebsd.org/changeset/base/334940 >> >> Log: >>- Add bhyve virtio-scsi storage backend support. >> Example of configuration: >>ctl.conf: >>portal-group pg0 { >>discovery-auth-group no-authentication >>listen 0.0.0.0 >>listen [::] >>} >> target iqn.2012-06.com.example:target0 { >>auth-group no-authentication >>portal-group pg0 >>port ioctl/5/3 >> lun 0 { >>path /z/test.img >>size 8G >>} >>lun 1 { >>path /z/test1.img >>size 8G >>} >>} >> bhyve <...> -s 4,virtio-scsi,/dev/cam/ctl5.3,iid=3 >> From inside guest: >>root@:~ # zpool status test >> pool: test >> state: ONLINE >> scan: none requested >>config: >> NAMESTATE READ WRITE CKSUM >>testONLINE 0 0 0 >> da0 ONLINE 0 0 0 >> da1 ONLINE 0 0 0 >> dmesg: >>da0 at vtscsi0 bus 0 scbus0 target 0 lun 0 >>da0: Fixed Direct Access SPC-5 SCSI device >>da0: Serial Number MYSERIAL >>da0: 300.000MB/s transfers >>da0: Command Queueing enabled >>da0: 8192MB (16777216 512 byte sectors) >>da1 at vtscsi0 bus 0 scbus0 target 0 lun 1 >>da1: Fixed Direct Access SPC-5 SCSI device >>da1: Serial Number MYSERIAL0001 >>da1: 300.000MB/s transfers >>da1: Command Queueing enabled >>da1: 8192MB (16777216 512 byte sectors) >> Discussed with: grehan >>Reviewed by: mav >>Obtained from: TrueOS >>Relnotes:Yes >>Sponsored by:iXsystems Inc. >>Tested with: FreeBSD HEAD, Fedora 28 (Workstation) and >> Ubuntu 18.04. >>Differential Revision: https://reviews.freebsd.org/D15276 >> >> Added: >>head/usr.sbin/bhyve/iov.c (contents, props changed) >>head/usr.sbin/bhyve/iov.h (contents, props changed) >>head/usr.sbin/bhyve/pci_virtio_scsi.c (contents, props changed) >> Modified: >>head/usr.sbin/bhyve/Makefile >>head/usr.sbin/bhyve/bhyve.8 >>head/usr.sbin/bhyve/virtio.h >> >> ... >> > > Added: head/usr.sbin/bhyve/pci_virtio_scsi.c >> >> == >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Mon Jun 11 02:09:20 >> 2018(r334940) >> @@ -0,0 +1,718 @@ >> +/*- >> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD >> + * >> + * Copyright (c) 2016 Jakub Klama . >> + * Copyright (c) 2018 Marcelo Araujo . >> + * All rights reserved. >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions >> + * are met: >> + * 1. Redistributions of source code must retain the above copyright >> + *notice, this list of conditions and the following disclaimer >> + *in this position and unchanged. >> + * 2. Redistributions in binary form must reproduce the above copyright >> + *notice, this list of conditions and the following disclaimer in the >> + *documentation and/or other materials provided with the >> distribution. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND >> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >> PURPOSE >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE >> LIABLE >> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >> CONSEQUENTIAL >> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE >> GOODS >> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, >> STRICT >> + * LIABILITY, OR TORT (INCLUDING
svn commit: r334940 - head/usr.sbin/bhyve
T NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _IOV_H_ +#define_IOV_H_ + +void seek_iov(struct iovec *iov1, size_t niov1, struct iovec *iov2, +size_t *niov2, size_t seek); +size_t truncate_iov(struct iovec *iov, size_t niov, size_t length); +size_t count_iov(struct iovec *iov, size_t niov); +ssize_t iov_to_buf(struct iovec *iov, size_t niov, void **buf); +ssize_t buf_to_iov(void *buf, size_t buflen, struct iovec *iov, size_t niov, +size_t seek); + +#endif /* _IOV_H_ */ Added: head/usr.sbin/bhyve/pci_virtio_scsi.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Mon Jun 11 02:09:20 2018 (r334940) @@ -0,0 +1,718 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016 Jakub Klama . + * Copyright (c) 2018 Marcelo Araujo . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer + *in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bhyverun.h" +#include "pci_emul.h" +#include "virtio.h" +#include "iov.h" + +#define VTSCSI_RINGSZ 64 +#defineVTSCSI_REQUESTQ 1 +#defineVTSCSI_THR_PER_Q16 +#defineVTSCSI_MAXQ (VTSCSI_REQUESTQ + 2) +#defineVTSCSI_MAXSEG 64 + +#defineVTSCSI_IN_HEADER_LEN(_sc) \ + (sizeof(struct pci_vtscsi_req_cmd_rd) + _sc->vss_config.cdb_size) + +#defineVTSCSI_OUT_HEADER_LEN(_sc) \ + (sizeof(struct pci_vtscsi_req_cmd_wr) + _sc->vss_config.sense_size) + +#define VIRTIO_SCSI_MAX_CHANNEL 0 +#define VIRTIO_SCSI_MAX_TARGET 0 +#define VIRTIO_SCSI_MAX_LUN 16383 + +#defineVIRTIO_SCSI_F_INOUT (1 << 0) +#defineVIRTIO_SCSI_F_HOTPLUG (1 << 1) +#defineVIRTIO_SCSI_F_CHANGE(1 << 2) + +static int pci_vtscsi_debug = 0; +#define DPRINTF(params) if (pci_vtscsi_debug) printf params +#define WPRINTF(params) printf params + +struct pci_vtscsi_config { + uint32_t num_queues; + uint32_t seg_max; + uint32_t max_sectors; + uint32_t cmd_per_lun; + uint32_t event_info_size; + uint32_t sense_size; + uint32_t cdb_size; + uint16_t max_channel; + uint16_t max_target; + uint32_t max_lun; +} __attribute__((packed)); + +struct pci_vtscsi_queue { + struct pci_vtscsi_softc * vsq_sc; + struct vqueue_info * vsq_vq; + int vsq_ctl_fd; + pthread_mutex_t vsq_mtx; + pthread_mutex_t vsq_qmtx; +pthread_cond_tv
svn commit: r334307 - head/usr.sbin/bhyve
Author: araujo Date: Tue May 29 01:46:00 2018 New Revision: 334307 URL: https://svnweb.freebsd.org/changeset/base/334307 Log: Simplify macros EFPRINTF and EFFLUSH. [0] Also stdarg(3) says that each invocation of va_start() must be paired with a corresponding invocation of va_end() in the same function. [1] Reported by: Coverity CID: 1194318[0] and 1194332[1] Discussed with: jhb MFC after:4 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15548 Modified: head/usr.sbin/bhyve/acpi.c Modified: head/usr.sbin/bhyve/acpi.c == --- head/usr.sbin/bhyve/acpi.c Tue May 29 01:16:00 2018(r334306) +++ head/usr.sbin/bhyve/acpi.c Tue May 29 01:46:00 2018(r334307) @@ -118,18 +118,14 @@ struct basl_fio { }; #define EFPRINTF(...) \ - err = fprintf(__VA_ARGS__); if (err < 0) goto err_exit; + if (fprintf(__VA_ARGS__) < 0) goto err_exit; #define EFFLUSH(x) \ - err = fflush(x); if (err != 0) goto err_exit; + if (fflush(x) != 0) goto err_exit; static int basl_fwrite_rsdp(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve RSDP template\n"); EFPRINTF(fp, " */\n"); @@ -156,10 +152,6 @@ err_exit: static int basl_fwrite_rsdt(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve RSDT template\n"); EFPRINTF(fp, " */\n"); @@ -196,10 +188,6 @@ err_exit: static int basl_fwrite_xsdt(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve XSDT template\n"); EFPRINTF(fp, " */\n"); @@ -236,11 +224,8 @@ err_exit: static int basl_fwrite_madt(FILE *fp) { - int err; int i; - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve MADT template\n"); EFPRINTF(fp, " */\n"); @@ -326,10 +311,6 @@ err_exit: static int basl_fwrite_fadt(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve FADT template\n"); EFPRINTF(fp, " */\n"); @@ -547,10 +528,6 @@ err_exit: static int basl_fwrite_hpet(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve HPET template\n"); EFPRINTF(fp, " */\n"); @@ -596,8 +573,6 @@ err_exit: static int basl_fwrite_mcfg(FILE *fp) { - int err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve MCFG template\n"); EFPRINTF(fp, " */\n"); @@ -629,10 +604,6 @@ err_exit: static int basl_fwrite_facs(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve FACS template\n"); EFPRINTF(fp, " */\n"); @@ -666,7 +637,6 @@ void dsdt_line(const char *fmt, ...) { va_list ap; - int err; if (dsdt_error != 0) return; @@ -675,8 +645,10 @@ dsdt_line(const char *fmt, ...) if (dsdt_indent_level != 0) EFPRINTF(dsdt_fp, "%*c", dsdt_indent_level * 2, ' '); va_start(ap, fmt); - if (vfprintf(dsdt_fp, fmt, ap) < 0) + if (vfprintf(dsdt_fp, fmt, ap) < 0) { + va_end(ap); goto err_exit; + } va_end(ap); } EFPRINTF(dsdt_fp, "\n"); @@ -735,9 +707,6 @@ dsdt_fixed_mem32(uint32_t base, uint32_t length) static int basl_fwrite_dsdt(FILE *fp) { - int err; - - err = 0; dsdt_fp = fp; dsdt_error = 0; dsdt_indent_level = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334276 - head/lib/libc/string
Author: araujo Date: Mon May 28 06:01:02 2018 New Revision: 334276 URL: https://svnweb.freebsd.org/changeset/base/334276 Log: Remove unnecessary free(string) from EXAMPLES. Reported by: se Modified: head/lib/libc/string/strsep.3 Modified: head/lib/libc/string/strsep.3 == --- head/lib/libc/string/strsep.3 Mon May 28 05:01:42 2018 (r334275) +++ head/lib/libc/string/strsep.3 Mon May 28 06:01:02 2018 (r334276) @@ -91,7 +91,6 @@ if (string != NULL) printf("%s\en", token); free(tofree); -free(string); .Ed .Pp The following uses ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334275 - head/lib/libc/string
Author: araujo Date: Mon May 28 05:01:42 2018 New Revision: 334275 URL: https://svnweb.freebsd.org/changeset/base/334275 Log: Update strsep(3) EXAMPLE section regards the usage of assert(3). As many people has pointed out, using assert(3) shall be not the best approach to verify if strdup(3) has allocated memory to string. Reviewed by: imp MFC after:4 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15594 Modified: head/lib/libc/string/strsep.3 Modified: head/lib/libc/string/strsep.3 == --- head/lib/libc/string/strsep.3 Mon May 28 04:38:10 2018 (r334274) +++ head/lib/libc/string/strsep.3 Mon May 28 05:01:42 2018 (r334275) @@ -31,7 +31,7 @@ .\"@(#)strsep.38.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd December 5, 2008 +.Dd May 28, 2018 .Dt STRSEP 3 .Os .Sh NAME @@ -86,12 +86,12 @@ to parse a string, and prints each token in separate l char *token, *string, *tofree; tofree = string = strdup("abc,def,ghi"); -assert(string != NULL); +if (string != NULL) + while ((token = strsep(, ",")) != NULL) + printf("%s\en", token); -while ((token = strsep(, ",")) != NULL) - printf("%s\en", token); - free(tofree); +free(string); .Ed .Pp The following uses ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Sat, May 26, 2018, 4:22 AM Rodney W. Grimes < free...@pdx.rh.cn85.dnsmgr.net> wrote: > > On Sat, May 26, 2018, 4:09 AM Warner Losh <i...@bsdimp.com> wrote: > > > > > > > > > > > On Fri, May 25, 2018 at 2:02 PM, Ed Maste <ema...@freebsd.org> wrote: > > > > > >> On 25 May 2018 at 14:26, Marcelo Araujo <araujobsdp...@gmail.com> > wrote: > > >> > > > >> >> The fact that we don't do NDEBUG builds normally does not allow us > to > > >> >> ignore that it exists. It's perfectly reasonable for a user to > build > > >> >> with CFLAGS+=NDEBUG. That need to work. If code is going to fail > to > > >> >> handle resource errors with NDEBUG set then it needs something like > > >> this > > >> >> at the top of the file: > > >> > > > >> > Please document it in some place! > > >> > > >> NDEBUG is documented in assert(3). The man page should have more of an > > >> explanation (and examples) of the possible pitfalls of assert() > > >> though > > >> > > > > > > NDEBUG has been documented in the assert man page since it entered Unix > > > via PBW in the 7th Edition Unix from Bell Labs. It's part of the C > > > standard, as well as many POSIX and SVID docs. > > > > > > > Yes I can read that! Now tell me, do we build FreeBSD without assert? > > > > If we do, probably we can't run it without crash! > > So that makes it perfectly fine to continue what is a well known bad > practice? I do not think so. > > Many people have tried to persuade you that the *proper* way to check > the return from a function is with an if statement, not with an assert, > please try to accept that this is pretty much standard accepted portable > 'C' coding, and realize all those places you see assert(foo) checking > the return of a function are more than likely lurking bugs to be fixed. > I never said that I didn't accepted that! What I have been saying the issue is all around and we need to fix it. Please don't twist my words! Best, > > -- > Rod Grimes > rgri...@freebsd.org > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Sat, May 26, 2018, 4:09 AM Warner Losh <i...@bsdimp.com> wrote: > > > On Fri, May 25, 2018 at 2:02 PM, Ed Maste <ema...@freebsd.org> wrote: > >> On 25 May 2018 at 14:26, Marcelo Araujo <araujobsdp...@gmail.com> wrote: >> > >> >> The fact that we don't do NDEBUG builds normally does not allow us to >> >> ignore that it exists. It's perfectly reasonable for a user to build >> >> with CFLAGS+=NDEBUG. That need to work. If code is going to fail to >> >> handle resource errors with NDEBUG set then it needs something like >> this >> >> at the top of the file: >> > >> > Please document it in some place! >> >> NDEBUG is documented in assert(3). The man page should have more of an >> explanation (and examples) of the possible pitfalls of assert() >> though >> > > NDEBUG has been documented in the assert man page since it entered Unix > via PBW in the 7th Edition Unix from Bell Labs. It's part of the C > standard, as well as many POSIX and SVID docs. > Yes I can read that! Now tell me, do we build FreeBSD without assert? If we do, probably we can't run it without crash! > Warner > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334219 - head/usr.sbin/bhyve
Author: araujo Date: Fri May 25 19:12:30 2018 New Revision: 334219 URL: https://svnweb.freebsd.org/changeset/base/334219 Log: We don't need check if str is NULL as free(3) will handle NULL argument. Reported by: kib@ Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Fri May 25 19:00:28 2018 (r334218) +++ head/usr.sbin/bhyve/bhyverun.c Fri May 25 19:12:30 2018 (r334219) @@ -255,8 +255,7 @@ topology_parse(const char *opt) return(0); out: - if (str != NULL) - free(str); + free(str); return (-1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334216 - head/usr.sbin/bhyve
Fixed at r334219. Thanks. 2018-05-26 3:08 GMT+08:00 Konstantin Belousov <kostik...@gmail.com>: > On Fri, May 25, 2018 at 06:54:40PM +, Marcelo Araujo wrote: > > Author: araujo > > Date: Fri May 25 18:54:40 2018 > > New Revision: 334216 > > URL: https://svnweb.freebsd.org/changeset/base/334216 > > > > Log: > > After a long discussion about assert(3), we gonna use a HardenedBSD > > approach to chek strdup(3) memory allocation. > > > > Submitted by: Shaw Webb <shawn.w...@hardenedbsd.org> > > Reported by:brooks > > Obtained from: HardenedBSD > > > > Modified: > > head/usr.sbin/bhyve/bhyverun.c > > > > Modified: head/usr.sbin/bhyve/bhyverun.c > > > == > > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 18:11:13 2018 > (r334215) > > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 18:54:40 2018 > (r334216) > > @@ -193,7 +193,8 @@ topology_parse(const char *opt) > > c = 1, n = 1, s = 1, t = 1; > > ns = false, scts = false; > > str = strdup(opt); > > - assert(str != NULL); > > + if (str == NULL) > > + goto out; > > > > while ((cp = strsep(, ",")) != NULL) { > > if (sscanf(cp, "%i%n", , ) == 1) { > > @@ -225,6 +226,7 @@ topology_parse(const char *opt) > > goto out; > > } > > free(str); > > + str = NULL; > > > > /* > >* Range check 1 <= n <= UINT16_MAX all values > > @@ -253,7 +255,8 @@ topology_parse(const char *opt) > > return(0); > > > > out: > > - free(str); > > + if (str != NULL) > This check is useless. Free(3) is fine handling NULL argument. > > > + free(str); > > return (-1); > > } > > > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 3:01 GMT+08:00 Shawn Webb <shawn.w...@hardenedbsd.org>: > On Sat, May 26, 2018 at 02:57:29AM +0800, Marcelo Araujo wrote: > > Thanks Shawn, > > > > I think there are plenty of places to fix this case! Thanks for the extra > > work :D. > > Any time. I'm glad to help. If you'd like, I might have time on Sunday > to audit bhyve's code to find and fix more of these cases. > Doesn't hurt and I think it is very welcome! Best, > > Thanks, > > -- > Shawn Webb > Cofounder and Security Engineer > HardenedBSD > > Tor-ified Signal:+1 443-546-8752 > Tor+XMPP+OTR:latt...@is.a.hacker.sx > GPG Key ID: 0x6A84658F52456EEE > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
Thanks Shawn, I think there are plenty of places to fix this case! Thanks for the extra work :D. 2018-05-26 2:34 GMT+08:00 Shawn Webb <shawn.w...@hardenedbsd.org>: > On Sat, May 26, 2018 at 02:26:33AM +0800, Marcelo Araujo wrote: > > 2018-05-26 2:21 GMT+08:00 Brooks Davis <bro...@freebsd.org>: > > > > > On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote: > > > > 2018-05-26 1:44 GMT+08:00 Brooks Davis <bro...@freebsd.org>: > > > > > > > > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > > > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler <li...@eitanadler.com> > > > wrote: > > > > > > > > > > > > > On 25 May 2018 at 08:23, Marcelo Araujo < > araujobsdp...@gmail.com> > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis < > bro...@freebsd.org> > > > > > wrote: > > > > > > > >> > > > > > > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo > wrote: > > > > > > > >> > Author: araujo > > > > > > > >> > Date: Fri May 25 02:07:05 2018 > > > > > > > >> > New Revision: 334199 > > > > > > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199 > > > > > > > >> > > > > > > > > >> > Log: > > > > > > > >> > Fix a memory leak on topology_parse(). > > > > > > > >> > > > > > > > > >> > strdup(3) allocates memory for a copy of the string, > does > > > the > > > > > copy > > > > > > > and > > > > > > > >> > returns a pointer to it. If there is no sufficient > memory > > > NULL > > > > > is > > > > > > > >> > returned > > > > > > > >> > and the global errno is set to ENOMEM. > > > > > > > >> > We do a sanity check to see if it was possible to > allocate > > > > > enough > > > > > > > >> > memory. > > > > > > > >> > > > > > > > > >> > Also as we allocate memory, we need to free this memory > > > used. > > > > > Or it > > > > > > > >> > will > > > > > > > >> > going out of scope leaks the storage it points to. > > > > > > > >> > > > > > > > > >> > Reviewed by:rgrimes > > > > > > > >> > MFC after: 3 weeks. > > > > > > > >> > X-MFC: r332298 > > > > > > > >> > Sponsored by: iXsystems Inc. > > > > > > > >> > Differential Revision: > https://reviews.freebsd.org/ > > > D15550 > > > > > > > >> > > > > > > > > >> > Modified: > > > > > > > >> > head/usr.sbin/bhyve/bhyverun.c > > > > > > > >> > > > > > > > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c > > > > > > > >> > > > > > > > > >> > > > > > > > > > > > > > == > > > > > > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 > 2018 > > > > > > > >> > (r334198) > > > > > > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 > 2018 > > > > > > > >> > (r334199) > > > > > > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt) > > > > > > > >> > c = 1, n = 1, s = 1, t = 1; > > > > > > > >> > ns = false, scts = false; > > > > > > > >> > str = strdup(opt); > > > > > > > >> > + assert(str != NULL); > > > > > > > >> > > > > > > > >> Using assert seems like an odd choice when you've already > added > > > a > > > > > > > >> failu
svn commit: r334216 - head/usr.sbin/bhyve
Author: araujo Date: Fri May 25 18:54:40 2018 New Revision: 334216 URL: https://svnweb.freebsd.org/changeset/base/334216 Log: After a long discussion about assert(3), we gonna use a HardenedBSD approach to chek strdup(3) memory allocation. Submitted by: Shaw WebbReported by: brooks Obtained from:HardenedBSD Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Fri May 25 18:11:13 2018 (r334215) +++ head/usr.sbin/bhyve/bhyverun.c Fri May 25 18:54:40 2018 (r334216) @@ -193,7 +193,8 @@ topology_parse(const char *opt) c = 1, n = 1, s = 1, t = 1; ns = false, scts = false; str = strdup(opt); - assert(str != NULL); + if (str == NULL) + goto out; while ((cp = strsep(, ",")) != NULL) { if (sscanf(cp, "%i%n", , ) == 1) { @@ -225,6 +226,7 @@ topology_parse(const char *opt) goto out; } free(str); + str = NULL; /* * Range check 1 <= n <= UINT16_MAX all values @@ -253,7 +255,8 @@ topology_parse(const char *opt) return(0); out: - free(str); + if (str != NULL) + free(str); return (-1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 2:21 GMT+08:00 Brooks Davis <bro...@freebsd.org>: > On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote: > > 2018-05-26 1:44 GMT+08:00 Brooks Davis <bro...@freebsd.org>: > > > > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler <li...@eitanadler.com> > wrote: > > > > > > > > > On 25 May 2018 at 08:23, Marcelo Araujo <araujobsdp...@gmail.com> > > > wrote: > > > > > > > > > > > > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis <bro...@freebsd.org> > > > wrote: > > > > > >> > > > > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote: > > > > > >> > Author: araujo > > > > > >> > Date: Fri May 25 02:07:05 2018 > > > > > >> > New Revision: 334199 > > > > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199 > > > > > >> > > > > > > >> > Log: > > > > > >> > Fix a memory leak on topology_parse(). > > > > > >> > > > > > > >> > strdup(3) allocates memory for a copy of the string, does > the > > > copy > > > > > and > > > > > >> > returns a pointer to it. If there is no sufficient memory > NULL > > > is > > > > > >> > returned > > > > > >> > and the global errno is set to ENOMEM. > > > > > >> > We do a sanity check to see if it was possible to allocate > > > enough > > > > > >> > memory. > > > > > >> > > > > > > >> > Also as we allocate memory, we need to free this memory > used. > > > Or it > > > > > >> > will > > > > > >> > going out of scope leaks the storage it points to. > > > > > >> > > > > > > >> > Reviewed by:rgrimes > > > > > >> > MFC after: 3 weeks. > > > > > >> > X-MFC: r332298 > > > > > >> > Sponsored by: iXsystems Inc. > > > > > >> > Differential Revision: https://reviews.freebsd.org/ > D15550 > > > > > >> > > > > > > >> > Modified: > > > > > >> > head/usr.sbin/bhyve/bhyverun.c > > > > > >> > > > > > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c > > > > > >> > > > > > > >> > > > > > > > > > == > > > > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018 > > > > > >> > (r334198) > > > > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018 > > > > > >> > (r334199) > > > > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt) > > > > > >> > c = 1, n = 1, s = 1, t = 1; > > > > > >> > ns = false, scts = false; > > > > > >> > str = strdup(opt); > > > > > >> > + assert(str != NULL); > > > > > >> > > > > > >> Using assert seems like an odd choice when you've already added > a > > > > > >> failure path and the strsep will crash immediately if assert is > > > elided. > > > > > > > > > > > > > > > > > > Just to make a better point, I had the same discussion about > > > assert(3) in > > > > > > another review, we don't do NDEBUG even for RELEASE. > > > > > > > > > > IMHO we only use assert for asserting things ought to never be > false > > > > > except in buggy code. Using assert for handling is poor practice. > > > > > > > > > > > > > Again, in this case we are using it all over the place and we must > > > replace > > > > it. Also we should document it in somewhere perhaps in the assert(3) > > > > otherwise myself and others will keep using it. If you use find, not > only > > > > myself is using it to check strdup! So what is the suggestion to > handle > > > >
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 2:21 GMT+08:00 Brooks Davis <bro...@freebsd.org>: > On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote: > > 2018-05-26 1:44 GMT+08:00 Brooks Davis <bro...@freebsd.org>: > > > > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler <li...@eitanadler.com> > wrote: > > > > > > > > > On 25 May 2018 at 08:23, Marcelo Araujo <araujobsdp...@gmail.com> > > > wrote: > > > > > > > > > > > > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis <bro...@freebsd.org> > > > wrote: > > > > > >> > > > > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote: > > > > > >> > Author: araujo > > > > > >> > Date: Fri May 25 02:07:05 2018 > > > > > >> > New Revision: 334199 > > > > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199 > > > > > >> > > > > > > >> > Log: > > > > > >> > Fix a memory leak on topology_parse(). > > > > > >> > > > > > > >> > strdup(3) allocates memory for a copy of the string, does > the > > > copy > > > > > and > > > > > >> > returns a pointer to it. If there is no sufficient memory > NULL > > > is > > > > > >> > returned > > > > > >> > and the global errno is set to ENOMEM. > > > > > >> > We do a sanity check to see if it was possible to allocate > > > enough > > > > > >> > memory. > > > > > >> > > > > > > >> > Also as we allocate memory, we need to free this memory > used. > > > Or it > > > > > >> > will > > > > > >> > going out of scope leaks the storage it points to. > > > > > >> > > > > > > >> > Reviewed by:rgrimes > > > > > >> > MFC after: 3 weeks. > > > > > >> > X-MFC: r332298 > > > > > >> > Sponsored by: iXsystems Inc. > > > > > >> > Differential Revision: https://reviews.freebsd.org/ > D15550 > > > > > >> > > > > > > >> > Modified: > > > > > >> > head/usr.sbin/bhyve/bhyverun.c > > > > > >> > > > > > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c > > > > > >> > > > > > > >> > > > > > > > > > == > > > > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018 > > > > > >> > (r334198) > > > > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018 > > > > > >> > (r334199) > > > > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt) > > > > > >> > c = 1, n = 1, s = 1, t = 1; > > > > > >> > ns = false, scts = false; > > > > > >> > str = strdup(opt); > > > > > >> > + assert(str != NULL); > > > > > >> > > > > > >> Using assert seems like an odd choice when you've already added > a > > > > > >> failure path and the strsep will crash immediately if assert is > > > elided. > > > > > > > > > > > > > > > > > > Just to make a better point, I had the same discussion about > > > assert(3) in > > > > > > another review, we don't do NDEBUG even for RELEASE. > > > > > > > > > > IMHO we only use assert for asserting things ought to never be > false > > > > > except in buggy code. Using assert for handling is poor practice. > > > > > > > > > > > > > Again, in this case we are using it all over the place and we must > > > replace > > > > it. Also we should document it in somewhere perhaps in the assert(3) > > > > otherwise myself and others will keep using it. If you use find, not > only > > > > myself is using it to check strdup! So what is the suggestion to > handle > > > > a
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 1:44 GMT+08:00 Brooks Davis <bro...@freebsd.org>: > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > On Sat, May 26, 2018, 1:11 AM Eitan Adler <li...@eitanadler.com> wrote: > > > > > On 25 May 2018 at 08:23, Marcelo Araujo <araujobsdp...@gmail.com> > wrote: > > > > > > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis <bro...@freebsd.org> > wrote: > > > >> > > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote: > > > >> > Author: araujo > > > >> > Date: Fri May 25 02:07:05 2018 > > > >> > New Revision: 334199 > > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199 > > > >> > > > > >> > Log: > > > >> > Fix a memory leak on topology_parse(). > > > >> > > > > >> > strdup(3) allocates memory for a copy of the string, does the > copy > > > and > > > >> > returns a pointer to it. If there is no sufficient memory NULL > is > > > >> > returned > > > >> > and the global errno is set to ENOMEM. > > > >> > We do a sanity check to see if it was possible to allocate > enough > > > >> > memory. > > > >> > > > > >> > Also as we allocate memory, we need to free this memory used. > Or it > > > >> > will > > > >> > going out of scope leaks the storage it points to. > > > >> > > > > >> > Reviewed by:rgrimes > > > >> > MFC after: 3 weeks. > > > >> > X-MFC: r332298 > > > >> > Sponsored by: iXsystems Inc. > > > >> > Differential Revision: https://reviews.freebsd.org/D15550 > > > >> > > > > >> > Modified: > > > >> > head/usr.sbin/bhyve/bhyverun.c > > > >> > > > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c > > > >> > > > > >> > > > > > == > > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018 > > > >> > (r334198) > > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018 > > > >> > (r334199) > > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt) > > > >> > c = 1, n = 1, s = 1, t = 1; > > > >> > ns = false, scts = false; > > > >> > str = strdup(opt); > > > >> > + assert(str != NULL); > > > >> > > > >> Using assert seems like an odd choice when you've already added a > > > >> failure path and the strsep will crash immediately if assert is > elided. > > > > > > > > > > > > Just to make a better point, I had the same discussion about > assert(3) in > > > > another review, we don't do NDEBUG even for RELEASE. > > > > > > IMHO we only use assert for asserting things ought to never be false > > > except in buggy code. Using assert for handling is poor practice. > > > > > > > Again, in this case we are using it all over the place and we must > replace > > it. Also we should document it in somewhere perhaps in the assert(3) > > otherwise myself and others will keep using it. If you use find, not only > > myself is using it to check strdup! So what is the suggestion to handle > > assert(3)? Deprecated it? > > Code that uses assert() in place of error handling is wrong and should > be fixed. assert(condition) means that condition must never happen > and if it does a bug has occurred (or the programmers assumptions are > wrong). In this case failure would not be due to a bug, but do to > resource exhaustion which is expected to be handled. > I agree with you! We have plenty of place that use strdup(3) without check the errno ENOMEN return; so do you think would be better bypass a errno ENOMEN without check it and have a crash, or better abort(3) using assert(3) in case we have no memory available to allocated the memory for a copy of a string? Personally I don't mind make couple extra lines of code to call abort(3) or exit(3), but till there, if we don't make RELEASE using NDEBUG, what you guys are saying to me is more personal preference than anything else. > > -- Brooks > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Sat, May 26, 2018, 1:11 AM Eitan Adler <li...@eitanadler.com> wrote: > On 25 May 2018 at 08:23, Marcelo Araujo <araujobsdp...@gmail.com> wrote: > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis <bro...@freebsd.org> wrote: > >> > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote: > >> > Author: araujo > >> > Date: Fri May 25 02:07:05 2018 > >> > New Revision: 334199 > >> > URL: https://svnweb.freebsd.org/changeset/base/334199 > >> > > >> > Log: > >> > Fix a memory leak on topology_parse(). > >> > > >> > strdup(3) allocates memory for a copy of the string, does the copy > and > >> > returns a pointer to it. If there is no sufficient memory NULL is > >> > returned > >> > and the global errno is set to ENOMEM. > >> > We do a sanity check to see if it was possible to allocate enough > >> > memory. > >> > > >> > Also as we allocate memory, we need to free this memory used. Or it > >> > will > >> > going out of scope leaks the storage it points to. > >> > > >> > Reviewed by:rgrimes > >> > MFC after: 3 weeks. > >> > X-MFC: r332298 > >> > Sponsored by: iXsystems Inc. > >> > Differential Revision: https://reviews.freebsd.org/D15550 > >> > > >> > Modified: > >> > head/usr.sbin/bhyve/bhyverun.c > >> > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c > >> > > >> > > == > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018 > >> > (r334198) > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018 > >> > (r334199) > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt) > >> > c = 1, n = 1, s = 1, t = 1; > >> > ns = false, scts = false; > >> > str = strdup(opt); > >> > + assert(str != NULL); > >> > >> Using assert seems like an odd choice when you've already added a > >> failure path and the strsep will crash immediately if assert is elided. > > > > > > Just to make a better point, I had the same discussion about assert(3) in > > another review, we don't do NDEBUG even for RELEASE. > > IMHO we only use assert for asserting things ought to never be false > except in buggy code. Using assert for handling is poor practice. > Again, in this case we are using it all over the place and we must replace it. Also we should document it in somewhere perhaps in the assert(3) otherwise myself and others will keep using it. If you use find, not only myself is using it to check strdup! So what is the suggestion to handle assert(3)? Deprecated it? > > > > > -- > Eitan Adler > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Fri, May 25, 2018, 11:11 PM Brooks Davis <bro...@freebsd.org> wrote: > On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote: > > Author: araujo > > Date: Fri May 25 02:07:05 2018 > > New Revision: 334199 > > URL: https://svnweb.freebsd.org/changeset/base/334199 > > > > Log: > > Fix a memory leak on topology_parse(). > > > > strdup(3) allocates memory for a copy of the string, does the copy and > > returns a pointer to it. If there is no sufficient memory NULL is > returned > > and the global errno is set to ENOMEM. > > We do a sanity check to see if it was possible to allocate enough > memory. > > > > Also as we allocate memory, we need to free this memory used. Or it > will > > going out of scope leaks the storage it points to. > > > > Reviewed by:rgrimes > > MFC after: 3 weeks. > > X-MFC: r332298 > > Sponsored by: iXsystems Inc. > > Differential Revision: https://reviews.freebsd.org/D15550 > > > > Modified: > > head/usr.sbin/bhyve/bhyverun.c > > > > Modified: head/usr.sbin/bhyve/bhyverun.c > > > == > > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018 > (r334198) > > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018 > (r334199) > > @@ -193,6 +193,7 @@ topology_parse(const char *opt) > > c = 1, n = 1, s = 1, t = 1; > > ns = false, scts = false; > > str = strdup(opt); > > + assert(str != NULL); > > Using assert seems like an odd choice when you've already added a > failure path and the strsep will crash immediately if assert is elided. > Just to make a better point, I had the same discussion about assert(3) in another review, we don't do NDEBUG even for RELEASE. > > -- Brooks > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Fri, May 25, 2018, 11:11 PM Brooks Davis <bro...@freebsd.org> wrote: > On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote: > > Author: araujo > > Date: Fri May 25 02:07:05 2018 > > New Revision: 334199 > > URL: https://svnweb.freebsd.org/changeset/base/334199 > > > > Log: > > Fix a memory leak on topology_parse(). > > > > strdup(3) allocates memory for a copy of the string, does the copy and > > returns a pointer to it. If there is no sufficient memory NULL is > returned > > and the global errno is set to ENOMEM. > > We do a sanity check to see if it was possible to allocate enough > memory. > > > > Also as we allocate memory, we need to free this memory used. Or it > will > > going out of scope leaks the storage it points to. > > > > Reviewed by:rgrimes > > MFC after: 3 weeks. > > X-MFC: r332298 > > Sponsored by: iXsystems Inc. > > Differential Revision: https://reviews.freebsd.org/D15550 > > > > Modified: > > head/usr.sbin/bhyve/bhyverun.c > > > > Modified: head/usr.sbin/bhyve/bhyverun.c > > > == > > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018 > (r334198) > > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018 > (r334199) > > @@ -193,6 +193,7 @@ topology_parse(const char *opt) > > c = 1, n = 1, s = 1, t = 1; > > ns = false, scts = false; > > str = strdup(opt); > > + assert(str != NULL); > > Using assert seems like an odd choice when you've already added a > failure path and the strsep will crash immediately if assert is elided. > Why assert is an odd choice? Have a better suggestion? > > -- Brooks > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334199 - head/usr.sbin/bhyve
Author: araujo Date: Fri May 25 02:07:05 2018 New Revision: 334199 URL: https://svnweb.freebsd.org/changeset/base/334199 Log: Fix a memory leak on topology_parse(). strdup(3) allocates memory for a copy of the string, does the copy and returns a pointer to it. If there is no sufficient memory NULL is returned and the global errno is set to ENOMEM. We do a sanity check to see if it was possible to allocate enough memory. Also as we allocate memory, we need to free this memory used. Or it will going out of scope leaks the storage it points to. Reviewed by: rgrimes MFC after:3 weeks. X-MFC:r332298 Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15550 Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Fri May 25 01:38:59 2018 (r334198) +++ head/usr.sbin/bhyve/bhyverun.c Fri May 25 02:07:05 2018 (r334199) @@ -193,6 +193,7 @@ topology_parse(const char *opt) c = 1, n = 1, s = 1, t = 1; ns = false, scts = false; str = strdup(opt); + assert(str != NULL); while ((cp = strsep(, ",")) != NULL) { if (sscanf(cp, "%i%n", , ) == 1) { @@ -218,11 +219,13 @@ topology_parse(const char *opt) } else if (cp[0] == '\0') continue; else - return (-1); + goto out; /* Any trailing garbage causes an error */ if (cp[chk] != '\0') - return (-1); + goto out; } + free(str); + /* * Range check 1 <= n <= UINT16_MAX all values */ @@ -248,6 +251,10 @@ topology_parse(const char *opt) cores = c; threads = t; return(0); + +out: + free(str); + return (-1); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334084 - head/usr.sbin/bhyve
Author: araujo Date: Wed May 23 09:34:51 2018 New Revision: 334084 URL: https://svnweb.freebsd.org/changeset/base/334084 Log: pthread_rwlock_unlock(3) returns 0 if successful, otherwise an error number will be returned to indicate the error, so I'm applying an assert(3) to do a sanity check of the return value. Reported by: Coverity CID: 1391235, 1193654 and 1193651 Reviewed by: grehan MFC after:4 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15533 Modified: head/usr.sbin/bhyve/mem.c Modified: head/usr.sbin/bhyve/mem.c == --- head/usr.sbin/bhyve/mem.c Wed May 23 09:16:20 2018(r334083) +++ head/usr.sbin/bhyve/mem.c Wed May 23 09:34:51 2018(r334084) @@ -123,6 +123,7 @@ mmio_rb_add(struct mmio_rb_tree *rbt, struct mmio_rb_r static void mmio_rb_dump(struct mmio_rb_tree *rbt) { + int perror; struct mmio_rb_range *np; pthread_rwlock_rdlock(_rwlock); @@ -130,7 +131,8 @@ mmio_rb_dump(struct mmio_rb_tree *rbt) printf(" %lx:%lx, %s\n", np->mr_base, np->mr_end, np->mr_param.name); } - pthread_rwlock_unlock(_rwlock); + perror = pthread_rwlock_unlock(_rwlock); + assert(perror == 0); } #endif @@ -166,7 +168,7 @@ access_memory(struct vmctx *ctx, int vcpu, uint64_t pa void *arg) { struct mmio_rb_range *entry; - int err, immutable; + int err, perror, immutable; pthread_rwlock_rdlock(_rwlock); /* @@ -184,7 +186,8 @@ access_memory(struct vmctx *ctx, int vcpu, uint64_t pa /* Update the per-vCPU cache */ mmio_hint[vcpu] = entry; } else if (mmio_rb_lookup(_rb_fallback, paddr, )) { - pthread_rwlock_unlock(_rwlock); + perror = pthread_rwlock_unlock(_rwlock); + assert(perror == 0); return (ESRCH); } } @@ -203,14 +206,19 @@ access_memory(struct vmctx *ctx, int vcpu, uint64_t pa * config space window as 'immutable' the deadlock can be avoided. */ immutable = (entry->mr_param.flags & MEM_F_IMMUTABLE); - if (immutable) - pthread_rwlock_unlock(_rwlock); + if (immutable) { + perror = pthread_rwlock_unlock(_rwlock); + assert(perror == 0); + } err = cb(ctx, vcpu, paddr, >mr_param, arg); - if (!immutable) - pthread_rwlock_unlock(_rwlock); + if (!immutable) { + perror = pthread_rwlock_unlock(_rwlock); + assert(perror == 0); + } + return (err); } @@ -272,7 +280,7 @@ static int register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp) { struct mmio_rb_range *entry, *mrp; - int err; + int err, perror; err = 0; @@ -285,7 +293,8 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_ pthread_rwlock_wrlock(_rwlock); if (mmio_rb_lookup(rbt, memp->base, ) != 0) err = mmio_rb_add(rbt, mrp); - pthread_rwlock_unlock(_rwlock); + perror = pthread_rwlock_unlock(_rwlock); + assert(perror == 0); if (err) free(mrp); } else @@ -313,7 +322,7 @@ unregister_mem(struct mem_range *memp) { struct mem_range *mr; struct mmio_rb_range *entry = NULL; - int err, i; + int err, perror, i; pthread_rwlock_wrlock(_rwlock); err = mmio_rb_lookup(_rb_root, memp->base, ); @@ -330,7 +339,8 @@ unregister_mem(struct mem_range *memp) mmio_hint[i] = NULL; } } - pthread_rwlock_unlock(_rwlock); + perror = pthread_rwlock_unlock(_rwlock); + assert(perror == 0); if (entry) free(entry); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334021 - head/usr.sbin/bhyve
Author: araujo Date: Tue May 22 06:02:11 2018 New Revision: 334021 URL: https://svnweb.freebsd.org/changeset/base/334021 Log: Revert: r334016 Revert for now this change, it in somehow breaks init_pci. Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c == --- head/usr.sbin/bhyve/pci_emul.c Tue May 22 05:49:40 2018 (r334020) +++ head/usr.sbin/bhyve/pci_emul.c Tue May 22 06:02:11 2018 (r334021) @@ -231,7 +231,8 @@ pci_parse_slot(char *opt) si->si_funcs[fnum].fi_param = config; done: - free(str); + if (error) + free(str); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334019 - head/usr.sbin/bhyve
Author: araujo Date: Tue May 22 05:21:53 2018 New Revision: 334019 URL: https://svnweb.freebsd.org/changeset/base/334019 Log: Include atkbdc header where there are declared the prototype functions atkbdc_event and atkbdc_init. MFC after:4 weeks. Sponsored by: iXsystems Inc. Modified: head/usr.sbin/bhyve/atkbdc.c Modified: head/usr.sbin/bhyve/atkbdc.c == --- head/usr.sbin/bhyve/atkbdc.cTue May 22 05:09:33 2018 (r334018) +++ head/usr.sbin/bhyve/atkbdc.cTue May 22 05:21:53 2018 (r334019) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include "acpi.h" +#include "atkbdc.h" #include "inout.h" #include "pci_emul.h" #include "pci_irq.h" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334016 - head/usr.sbin/bhyve
Author: araujo Date: Tue May 22 04:08:08 2018 New Revision: 334016 URL: https://svnweb.freebsd.org/changeset/base/334016 Log: We must free the variable str. Spotted by: clang's static analyzer Submitted by: Tom Rix Reviewed by: grehan MFC after:4 weeks Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D10009 Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c == --- head/usr.sbin/bhyve/pci_emul.c Tue May 22 03:57:32 2018 (r334015) +++ head/usr.sbin/bhyve/pci_emul.c Tue May 22 04:08:08 2018 (r334016) @@ -231,8 +231,7 @@ pci_parse_slot(char *opt) si->si_funcs[fnum].fi_param = config; done: - if (error) - free(str); + free(str); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r333622 - head/usr.sbin/bhyve
Author: araujo Date: Tue May 15 05:55:29 2018 New Revision: 333622 URL: https://svnweb.freebsd.org/changeset/base/333622 Log: vq_getchain() can return -1 if some descriptor(s) are invalid and prints a diagnostic message. So we do a sanity checking on the return value of vq_getchain(). Spotted by: gcc49 Reviewed by: avg MFC after:4 weeks Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15388 Modified: head/usr.sbin/bhyve/pci_virtio_console.c Modified: head/usr.sbin/bhyve/pci_virtio_console.c == --- head/usr.sbin/bhyve/pci_virtio_console.cTue May 15 04:31:11 2018 (r333621) +++ head/usr.sbin/bhyve/pci_virtio_console.cTue May 15 05:55:29 2018 (r333622) @@ -579,6 +579,7 @@ pci_vtcon_notify_tx(void *vsc, struct vqueue_info *vq) while (vq_has_descs(vq)) { n = vq_getchain(vq, , iov, 1, flags); + assert(n >= 1); if (port != NULL) port->vsp_cb(port, port->vsp_arg, iov, 1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r333494 - head/share/man/man7
On Sat, May 12, 2018, 12:59 AM Rodney W. Grimes < free...@pdx.rh.cn85.dnsmgr.net> wrote: > > On Fri, May 11, 2018 at 8:26 AM, Rodney W. Grimes > >wrote: > > >> @@ -67,7 +72,8 @@ Changes are first committed to CURRENT and then > usuall > > >> to STABLE. > > >> Every few years the CURRENT branch is renamed to STABLE, and a new > > >> CURRENT is branched, with an incremented major version number. > > >> -Releases are then branched off STABLE and numbered with consecutive > minor numbers. > > >> +Releases are then branched off STABLE and numbered with consecutive > minor > > >> +numbers. > > > > > > Proper place to line break long lines is at conjuncatives such > > > as the "and" above, yeilding: > > > > What? Are you just inventing these rules out of blue sky? What > > possible reason is there to do as you have proposed? > > Well known and established man page style rules, documented someplace, > which I can not seem to locate right now. > Could you please find that if possible and share with us? Personally I'm about to rewrite some man page and that would be useful in my case! > > > Conrad > > -- > Rod Grimes > rgri...@freebsd.org > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r333446 - in head: sys/cam/ctl sys/sys usr.sbin/ctladm usr.sbin/ctld
Author: araujo Date: Thu May 10 03:50:20 2018 New Revision: 333446 URL: https://svnweb.freebsd.org/changeset/base/333446 Log: Rework CTL frontend & backend options to use nv(3), allow creating multiple ioctl frontend ports. This revision introduces two changes to CTL: - Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls. Removes ctl_be_arg structure and associated logic and replaces it with nv(3)-based logic for passing in and out arguments. - Allows creating multiple ioctl frontend ports using either ctladm(8) or ctld(8). New frontend ports are represented by /dev/cam/ctl. nodes, eg /dev/cam/ctl5.3. Those device nodes respond only to CTL_IO ioctl. New command-line options for ctladm: # creates new ioctl frontend port with using free pp and vp=0 ctladm port -c # creates new ioctl frontend port with pp=10 and vp=0 ctladm port -c -O pp=10 # creates new ioctl frontend port with pp=11 and vp=12 ctladm port -c -O pp=11 -O vp=12 # removes port with number 4 (it's a "targ_port" number, not pp number) ctladm port -r -p 4 New syntax for ctl.conf: target ... { port ioctl/ ... } target ... { port ioctl// ... Note: Most of this work was made by jceel@, thank you. Submitted by: jceel Reworked by: myself Reviewed by: mav (earlier versions and recently during the rework) Obtained from: FreeNAS and TrueOS Relnotes: Yes Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D9299 Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_backend.c head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_frontend.c head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_frontend_ioctl.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_ioctl.h head/sys/cam/ctl/ctl_tpc.c head/sys/sys/param.h head/usr.sbin/ctladm/Makefile head/usr.sbin/ctladm/ctladm.8 head/usr.sbin/ctladm/ctladm.c head/usr.sbin/ctld/Makefile head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/kernel.c head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/uclparse.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Thu May 10 02:31:54 2018(r333445) +++ head/sys/cam/ctl/ctl.c Thu May 10 03:50:20 2018(r333446) @@ -4,6 +4,8 @@ * Copyright (c) 2003-2009 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation * Copyright (c) 2014-2017 Alexander Motin <m...@freebsd.org> + * Copyright (c) 2017 Jakub Wojciech Klama <jc...@freebsd.org> + * Copyright (c) 2018 Marcelo Araujo <ara...@freebsd.org> * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -65,6 +67,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -1869,6 +1873,7 @@ ctl_init(void) args.mda_gid = GID_OPERATOR; args.mda_mode = 0600; args.mda_si_drv1 = softc; + args.mda_si_drv2 = NULL; error = make_dev_s(, >dev, "cam/ctl"); if (error != 0) { free(softc, M_DEVBUF); @@ -2468,105 +2473,6 @@ ctl_copyin_alloc(void *user_addr, unsigned int len, ch return (kptr); } -static void -ctl_free_args(int num_args, struct ctl_be_arg *args) -{ - int i; - - if (args == NULL) - return; - - for (i = 0; i < num_args; i++) { - free(args[i].kname, M_CTL); - free(args[i].kvalue, M_CTL); - } - - free(args, M_CTL); -} - -static struct ctl_be_arg * -ctl_copyin_args(int num_args, struct ctl_be_arg *uargs, - char *error_str, size_t error_str_len) -{ - struct ctl_be_arg *args; - int i; - - args = ctl_copyin_alloc(uargs, num_args * sizeof(*args), - error_str, error_str_len); - - if (args == NULL) - goto bailout; - - for (i = 0; i < num_args; i++) { - args[i].kname = NULL; - args[i].kvalue = NULL; - } - - for (i = 0; i < num_args; i++) { - uint8_t *tmpptr; - - if (args[i].namelen == 0) { - snprintf(error_str, error_str_len, "Argument %d " -"name length is zero", i); - goto bailout; - } - - args[i].kname = ctl_copyin_alloc(args[i].name, - args[i].namelen, error_str, error_str_len); - if (args[i].kname == NULL) - goto bailout; - - if (args[i].kname[args[i].namelen - 1] != '\0') { - snprintf(error_
svn commit: r329817 - in head/etc: . rc.d
Author: araujo Date: Thu Feb 22 08:25:39 2018 New Revision: 329817 URL: https://svnweb.freebsd.org/changeset/base/329817 Log: The firewall_type is ignored if not set in rc.conf or rc.conf.local, after r190575 there is an option to call rc.firewall with the firewall_type passed in as an argument. Submitted by: David P. DischerMFC after:3 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D14286 Modified: head/etc/rc.d/ipfw head/etc/rc.firewall Modified: head/etc/rc.d/ipfw == --- head/etc/rc.d/ipfw Thu Feb 22 05:44:00 2018(r329816) +++ head/etc/rc.d/ipfw Thu Feb 22 08:25:39 2018(r329817) @@ -40,7 +40,11 @@ ipfw_start() { local _firewall_type - _firewall_type=$1 + if [ -n "${1}" ]; then + _firewall_type=$1 + else + _firewall_type=${firewall_type} + fi # set the firewall rules script if none was specified [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall Modified: head/etc/rc.firewall == --- head/etc/rc.firewallThu Feb 22 05:44:00 2018(r329816) +++ head/etc/rc.firewallThu Feb 22 08:25:39 2018(r329817) @@ -112,12 +112,20 @@ setup_ipv6_mandatory() { ${fwcmd} add pass ipv6-icmp from any to any icmp6types 2,135,136 } +. /etc/rc.subr +. /etc/network.subr + if [ -n "${1}" ]; then firewall_type="${1}" fi +if [ -z "${firewall_rc_config_load}" ]; then +load_rc_config ipfw +else +for i in ${firewall_rc_config_load}; do +load_rc_config $i +done +fi -. /etc/rc.subr -. /etc/network.subr afexists inet6 ipv6_available=$? ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329193 - head
Author: araujo Date: Tue Feb 13 06:36:27 2018 New Revision: 329193 URL: https://svnweb.freebsd.org/changeset/base/329193 Log: - I'm not using nis(8) and ypldap(8) anymore, so I'm removing myself from MAINTAINERS list. Modified: head/MAINTAINERS Modified: head/MAINTAINERS == --- head/MAINTAINERSTue Feb 13 04:28:13 2018(r329192) +++ head/MAINTAINERSTue Feb 13 06:36:27 2018(r329193) @@ -65,7 +65,6 @@ lpr gad Pre-commit review requested, particularly for nanobsdimp Pre-commit phabricator review requested. net80211 adrian Pre-commit review requested, send to freebsd-wirel...@freebsd.org nfsfreebsd...@freebsd.org, rmacklem is best for reviews. -nis(8), yp(8) araujo Pre-commit review requested. nvd(4) jimharris Pre-commit review requested. nvme(4)jimharris Pre-commit review requested. nvmecontrol(8) jimharris Pre-commit review requested. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r321846 - head/usr.sbin/ypldap
Author: araujo Date: Tue Aug 1 05:26:20 2017 New Revision: 321846 URL: https://svnweb.freebsd.org/changeset/base/321846 Log: Log when we have finished pushing users and groups. Obtained from:OpenBSD (rev 1.4) MFC after:3 weeks. Modified: head/usr.sbin/ypldap/entries.c Modified: head/usr.sbin/ypldap/entries.c == --- head/usr.sbin/ypldap/entries.c Tue Aug 1 05:23:49 2017 (r321845) +++ head/usr.sbin/ypldap/entries.c Tue Aug 1 05:26:20 2017 (r321846) @@ -92,6 +92,7 @@ flatten_entries(struct env *env) free(tmp); } env->sc_user_lines = linep; + log_debug("done pushing users"); wrlen = env->sc_group_line_len; if ((linep = calloc(1, env->sc_group_line_len + 1)) == NULL) { @@ -117,6 +118,7 @@ flatten_entries(struct env *env) wrlen -= len; } env->sc_group_lines = linep; + log_debug("done pushing groups"); } int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r320390 - head/sys/geom/part
Author: araujo Date: Tue Jun 27 01:22:27 2017 New Revision: 320390 URL: https://svnweb.freebsd.org/changeset/base/320390 Log: With r318394 seems it breaks gpart(8) in some embedded systems such like PCEngines, RPI1-B, Alix and APU2 boards as well as NanoBSD with the following message: vnode_pager_generic_getpages_done: I/O read error 5 Seems the breakage was because it was missed to include acr in glabel update. Reported by: Peter Blok, madpilot, imp and trasz. Reviewed by: trasz Tested by:Peter Blok and madpilot. MFC after:3 days. Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D11365 Modified: head/sys/geom/part/g_part.c Modified: head/sys/geom/part/g_part.c == --- head/sys/geom/part/g_part.c Mon Jun 26 22:48:04 2017(r320389) +++ head/sys/geom/part/g_part.c Tue Jun 27 01:22:27 2017(r320390) @@ -890,7 +890,8 @@ g_part_ctl_commit(struct gctl_req *req, struct g_part_ if (!entry->gpe_deleted) { /* Notify consumers that provider might be changed. */ if (entry->gpe_modified && ( - entry->gpe_pp->acw + entry->gpe_pp->ace) == 0) + entry->gpe_pp->acw + entry->gpe_pp->ace + + entry->gpe_pp->acr) == 0) g_media_changed(entry->gpe_pp, M_NOWAIT); entry->gpe_created = 0; entry->gpe_modified = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319995 - head/usr.sbin/bhyve
Author: araujo Date: Fri Jun 16 01:26:01 2017 New Revision: 319995 URL: https://svnweb.freebsd.org/changeset/base/319995 Log: Check if pthread_create(3) successfully created the thread prior to call pthread_join(3). The variable tid is not yet initialized in case the authentication fails at early stage, that would lead pthread_join be called with an uninitialized variable. CID: 1375950 Reported by: Coverity, cem Reviewed by: cem MFC after:3 weeks. Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D11150 Modified: head/usr.sbin/bhyve/rfb.c Modified: head/usr.sbin/bhyve/rfb.c == --- head/usr.sbin/bhyve/rfb.c Fri Jun 16 00:44:23 2017(r319994) +++ head/usr.sbin/bhyve/rfb.c Fri Jun 16 01:26:01 2017(r319995) @@ -769,6 +769,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) pthread_t tid; uint32_t sres = 0; int len; + int perror = 1; rc->cfd = cfd; @@ -878,8 +879,9 @@ rfb_handle(struct rfb_softc *rc, int cfd) rfb_send_screen(rc, cfd, 1); - pthread_create(, NULL, rfb_wr_thr, rc); - pthread_set_name_np(tid, "rfbout"); + perror = pthread_create(, NULL, rfb_wr_thr, rc); + if (perror == 0) + pthread_set_name_np(tid, "rfbout"); /* Now read in client requests. 1st byte identifies type */ for (;;) { @@ -915,7 +917,8 @@ rfb_handle(struct rfb_softc *rc, int cfd) } done: rc->cfd = -1; - pthread_join(tid, NULL); + if (perror == 0) + pthread_join(tid, NULL); if (rc->enc_zlib_ok) deflateEnd(>zstream); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319970 - head/usr.sbin/ifmcstat
Author: araujo Date: Thu Jun 15 06:48:36 2017 New Revision: 319970 URL: https://svnweb.freebsd.org/changeset/base/319970 Log: Use nitems() from sys/param.h. MFC after:4 weeks. Modified: head/usr.sbin/ifmcstat/ifmcstat.c Modified: head/usr.sbin/ifmcstat/ifmcstat.c == --- head/usr.sbin/ifmcstat/ifmcstat.c Thu Jun 15 06:46:40 2017 (r319969) +++ head/usr.sbin/ifmcstat/ifmcstat.c Thu Jun 15 06:48:36 2017 (r319970) @@ -805,7 +805,7 @@ inm_print_sources_sysctl(uint32_t ifindex, struct in_a uint32_t fmode; const char *modestr; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet.ip.mcast.filters", mib, ) == -1) { perror("sysctlnametomib"); return; @@ -814,7 +814,7 @@ inm_print_sources_sysctl(uint32_t ifindex, struct in_a needed = 0; mib[5] = ifindex; mib[6] = gina.s_addr; /* 32 bits wide */ - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); do { if (sysctl(mib, mibsize, NULL, , NULL, 0) == -1) { perror("sysctl net.inet.ip.mcast.filters"); @@ -905,7 +905,7 @@ in6m_print_sources_sysctl(uint32_t ifindex, struct in6 uint32_t fmode; const char *modestr; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet6.ip6.mcast.filters", mib, ) == -1) { perror("sysctlnametomib"); @@ -918,7 +918,7 @@ in6m_print_sources_sysctl(uint32_t ifindex, struct in6 for (i = 0; i < 4; i++) mib[6 + i] = *pi++; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); do { if (sysctl(mib, mibsize, NULL, , NULL, 0) == -1) { perror("sysctl net.inet6.ip6.mcast.filters"); @@ -1145,7 +1145,7 @@ ifmcstat_getifmaddrs(void) size_t mibsize, len; int mib[5]; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet.igmp.ifinfo", mib, ) == -1) { perror("sysctlnametomib"); @@ -1170,7 +1170,7 @@ ifmcstat_getifmaddrs(void) size_t mibsize, len; int mib[5]; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet6.mld.ifinfo", mib, ) == -1) { perror("sysctlnametomib"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319969 - head/usr.sbin/ip6addrctl
Author: araujo Date: Thu Jun 15 06:46:40 2017 New Revision: 319969 URL: https://svnweb.freebsd.org/changeset/base/319969 Log: Use nitems() from sys/param.h. MFC after:4 weeks. Modified: head/usr.sbin/ip6addrctl/ip6addrctl.c Modified: head/usr.sbin/ip6addrctl/ip6addrctl.c == --- head/usr.sbin/ip6addrctl/ip6addrctl.c Thu Jun 15 06:21:01 2017 (r319968) +++ head/usr.sbin/ip6addrctl/ip6addrctl.c Thu Jun 15 06:46:40 2017 (r319969) @@ -111,7 +111,7 @@ get_policy(void) struct in6_addrpolicy *buf; struct in6_addrpolicy *pol, *ep; - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, , NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), NULL, , NULL, 0) < 0) { err(1, "sysctl(IPV6CTL_ADDRCTLPOLICY)"); /* NOTREACHED */ } @@ -123,7 +123,7 @@ get_policy(void) errx(1, "malloc failed"); /* NOTREACHED */ } - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, , NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), buf, , NULL, 0) < 0) { err(1, "sysctl(IPV6CTL_ADDRCTLPOLICY)"); /* NOTREACHED */ } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319968 - head/usr.sbin/bhyve
Author: araujo Date: Thu Jun 15 06:21:01 2017 New Revision: 319968 URL: https://svnweb.freebsd.org/changeset/base/319968 Log: Initialize variables and use byteorder(9) instead of aliasing char array buf via uint32_t pointer. CID: 1375949 Reported by: Coverity, cem Reviewed by: cem MFC after:3 weeks Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D11153 Modified: head/usr.sbin/bhyve/rfb.c Modified: head/usr.sbin/bhyve/rfb.c == --- head/usr.sbin/bhyve/rfb.c Thu Jun 15 04:49:12 2017(r319967) +++ head/usr.sbin/bhyve/rfb.c Thu Jun 15 06:21:01 2017(r319968) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include @@ -754,7 +755,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) { const char *vbuf = "RFB 003.008\n"; unsigned char buf[80]; - unsigned char *message; + unsigned char *message = NULL; #ifndef NO_OPENSSL unsigned char challenge[AUTH_LENGTH]; @@ -766,7 +767,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) #endif pthread_t tid; - uint32_t sres; + uint32_t sres = 0; int len; rc->cfd = cfd; @@ -858,7 +859,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) stream_write(cfd, , 4); if (sres) { - *((uint32_t *) buf) = htonl(strlen(message)); + be32enc(buf, strlen(message)); stream_write(cfd, buf, 4); stream_write(cfd, message, strlen(message)); goto done; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r319487 - head/usr.sbin/bhyve
2017-06-11 2:35 GMT+08:00 Conrad Meyer <c...@freebsd.org>: > On Sat, Jun 10, 2017 at 11:14 AM, Peter Grehan <gre...@freebsd.org> wrote: > > strncpy() is specified to zero-fill if the source is shorter than the > > length. Are we missing something ? > > > > The other issues you brought up look valid. > > Hi Peter, > > Oops — didn't realize that about strncpy()! Thanks for the correction. > > Best, > Conrad > Thanks guys, I will take a look on it very soon and will put you both into the review. Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319682 - head/usr.sbin/bhyve
Author: araujo Date: Thu Jun 8 04:54:15 2017 New Revision: 319682 URL: https://svnweb.freebsd.org/changeset/base/319682 Log: Make the VNC authentication build with LibreSSL on HardenedBSD and TrueOS. PR: 219790 Submitted by: ShirkdogReviewed by: grehan and rgrimes MFC after:4 weeks. Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D11071 Modified: head/usr.sbin/bhyve/rfb.c Modified: head/usr.sbin/bhyve/rfb.c == --- head/usr.sbin/bhyve/rfb.c Thu Jun 8 04:50:50 2017(r319681) +++ head/usr.sbin/bhyve/rfb.c Thu Jun 8 04:54:15 2017(r319682) @@ -832,12 +832,14 @@ rfb_handle(struct rfb_softc *rc, int cfd) memcpy(crypt_expected, challenge, AUTH_LENGTH); /* Encrypt the Challenge with DES */ - DES_set_key((C_Block *)keystr, ); - DES_ecb_encrypt((C_Block *)challenge, - (C_Block *)crypt_expected, , DES_ENCRYPT); - DES_ecb_encrypt((C_Block *)(challenge + PASSWD_LENGTH), - (C_Block *)(crypt_expected + PASSWD_LENGTH), + DES_set_key((const_DES_cblock *)keystr, ); + DES_ecb_encrypt((const_DES_cblock *)challenge, + (const_DES_cblock *)crypt_expected, , DES_ENCRYPT); + DES_ecb_encrypt((const_DES_cblock *)(challenge + PASSWD_LENGTH), + (const_DES_cblock *)(crypt_expected + + PASSWD_LENGTH), + , DES_ENCRYPT); if (memcmp(crypt_expected, buf, AUTH_LENGTH) != 0) { message = "Auth Failed: Invalid Password."; @@ -858,7 +860,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) if (sres) { *((uint32_t *) buf) = htonl(strlen(message)); stream_write(cfd, buf, 4); -stream_write(cfd, message, strlen(message)); + stream_write(cfd, message, strlen(message)); goto done; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319678 - in head/sys: kern sys x86/x86
Author: araujo Date: Thu Jun 8 04:02:14 2017 New Revision: 319678 URL: https://svnweb.freebsd.org/changeset/base/319678 Log: Allow sysctl kern.vm_guest to return bhyve when running under bhyve. Submitted by: Sean FaganReviewed by: grehan MFH: 4 weeks. Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D11090 Modified: head/sys/kern/subr_param.c head/sys/sys/systm.h head/sys/x86/x86/identcpu.c Modified: head/sys/kern/subr_param.c == --- head/sys/kern/subr_param.c Thu Jun 8 03:51:17 2017(r319677) +++ head/sys/kern/subr_param.c Thu Jun 8 04:02:14 2017(r319678) @@ -149,6 +149,7 @@ static const char *const vm_guest_sysctl_names[] = { "hv", "vmware", "kvm", + "bhyve", NULL }; CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST); Modified: head/sys/sys/systm.h == --- head/sys/sys/systm.hThu Jun 8 03:51:17 2017(r319677) +++ head/sys/sys/systm.hThu Jun 8 04:02:14 2017(r319678) @@ -76,7 +76,7 @@ extern int vm_guest; /* Running as virtual machine gu * Keep in sync with vm_guest_sysctl_names[]. */ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, - VM_GUEST_VMWARE, VM_GUEST_KVM, VM_LAST }; + VM_GUEST_VMWARE, VM_GUEST_KVM, VM_GUEST_BHYVE, VM_LAST }; #if defined(WITNESS) || defined(INVARIANT_SUPPORT) void kassert_panic(const char *fmt, ...) __printflike(1, 2); Modified: head/sys/x86/x86/identcpu.c == --- head/sys/x86/x86/identcpu.c Thu Jun 8 03:51:17 2017(r319677) +++ head/sys/x86/x86/identcpu.c Thu Jun 8 04:02:14 2017(r319678) @@ -1282,6 +1282,8 @@ identify_hypervisor(void) vm_guest = VM_GUEST_HV; else if (strcmp(hv_vendor, "KVMKVMKVM") == 0) vm_guest = VM_GUEST_KVM; + else if (strcmp(hv_vendor, "bhyve bhyve") == 0) + vm_guest = VM_GUEST_BHYVE; } return; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319488 - head/usr.sbin/bhyve
Author: araujo Date: Fri Jun 2 02:37:17 2017 New Revision: 319488 URL: https://svnweb.freebsd.org/changeset/base/319488 Log: Bump manpage date. Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Fri Jun 2 02:35:16 2017(r319487) +++ head/usr.sbin/bhyve/bhyve.8 Fri Jun 2 02:37:17 2017(r319488) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 22, 2017 +.Dd June 2, 2017 .Dt BHYVE 8 .Os .Sh NAME ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319487 - head/usr.sbin/bhyve
Author: araujo Date: Fri Jun 2 02:35:16 2017 New Revision: 319487 URL: https://svnweb.freebsd.org/changeset/base/319487 Log: Add VNC Authentication support based on RFC6143 section 7.2.2. Submitted by: Fabian FreyerReworked by: myself Reviewed by: grehan, rgrimes and jilles MFC after:1 week. Relnotes: Yes. Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D10818 Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/pci_fbuf.c head/usr.sbin/bhyve/rfb.c head/usr.sbin/bhyve/rfb.h Modified: head/usr.sbin/bhyve/Makefile == --- head/usr.sbin/bhyve/MakefileFri Jun 2 01:00:40 2017 (r319486) +++ head/usr.sbin/bhyve/MakefileFri Jun 2 02:35:16 2017 (r319487) @@ -2,6 +2,8 @@ # $FreeBSD$ # +.include + PROG= bhyve PACKAGE= bhyve @@ -62,6 +64,12 @@ SRCS=\ SRCS+= vmm_instruction_emul.c LIBADD=vmmapi md pthread z + +.if ${MK_OPENSSL} == "no" +CFLAGS+=-DNO_OPENSSL +.else +LIBADD+= crypto +.endif CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/e1000 CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/mii Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Fri Jun 2 01:00:40 2017(r319486) +++ head/usr.sbin/bhyve/bhyve.8 Fri Jun 2 02:35:16 2017(r319487) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2017 +.Dd May 22, 2017 .Dt BHYVE 8 .Os .Sh NAME @@ -309,7 +309,7 @@ Emergency write is advertised, but no-op at present. .Pp Framebuffer devices: .Bl -tag -width 10n -.It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc +.It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= Ns Ar password Oc .Bl -tag -width 8n .It Ar IP:port An @@ -368,6 +368,11 @@ Instruct to only boot upon the initiation of a VNC connection, simplifying the installation of operating systems that require immediate keyboard input. This can be removed for post-installation use. +.It password +This type of authentication is known to be cryptographically weak and is not +intended for use on untrusted networks. +Many implementations will want to use stronger security, such as running +the session over an encrypted channel provided by IPsec or SSH. .El .El .Pp Modified: head/usr.sbin/bhyve/pci_fbuf.c == --- head/usr.sbin/bhyve/pci_fbuf.c Fri Jun 2 01:00:40 2017 (r319486) +++ head/usr.sbin/bhyve/pci_fbuf.c Fri Jun 2 02:35:16 2017 (r319487) @@ -93,6 +93,7 @@ struct pci_fbuf_softc { /* rfb server */ char *rfb_host; + char *rfb_password; int rfb_port; int rfb_wait; int vga_enabled; @@ -285,7 +286,8 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o goto done; } else if (sc->memregs.height == 0) sc->memregs.height = 1080; - + } else if (!strcmp(xopts, "password")) { + sc->rfb_password = config; } else { pci_fbuf_usage(xopts); ret = -1; @@ -407,7 +409,7 @@ pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *p memset((void *)sc->fb_base, 0, FB_SIZE); - error = rfb_init(sc->rfb_host, sc->rfb_port, sc->rfb_wait); + error = rfb_init(sc->rfb_host, sc->rfb_port, sc->rfb_wait, sc->rfb_password); done: if (error) free(sc); Modified: head/usr.sbin/bhyve/rfb.c == --- head/usr.sbin/bhyve/rfb.c Fri Jun 2 01:00:40 2017(r319486) +++ head/usr.sbin/bhyve/rfb.c Fri Jun 2 02:35:16 2017(r319487) @@ -60,10 +60,23 @@ __FBSDID("$FreeBSD$"); #include "rfb.h" #include "sockstream.h" +#ifndef NO_OPENSSL +#include +#endif + static int rfb_debug = 0; #defineDPRINTF(params) if (rfb_debug) printf params #defineWPRINTF(params) printf params +#define AUTH_LENGTH16 +#define PASSWD_LENGTH 8 + +#define SECURITY_TYPE_NONE 1 +#define SECURITY_TYPE_VNC_AUTH 2 + +#define AUTH_FAILED_UNAUTH 1 +#define AUTH_FAILED_ERROR 2 + struct rfb_softc { int sfd; pthread_t tid; @@ -72,10 +85,12 @@ struct rfb_softc { int width, height; - boolenc_raw_ok; - boolenc_zlib_ok; - boolenc_resize_ok; + char*password; + boolenc_raw_ok; + bool
svn commit: r318915 - head/usr.sbin/ypldap
Author: araujo Date: Fri May 26 03:27:06 2017 New Revision: 318915 URL: https://svnweb.freebsd.org/changeset/base/318915 Log: Simplify parseval() by allocating a buffer the size of the input string, which will always be big enough to hold the output string. Obtained from:OpenBSD (revision 1.36) Modified: head/usr.sbin/ypldap/aldap.c Modified: head/usr.sbin/ypldap/aldap.c == --- head/usr.sbin/ypldap/aldap.cFri May 26 02:30:26 2017 (r318914) +++ head/usr.sbin/ypldap/aldap.cFri May 26 03:27:06 2017 (r318915) @@ -1212,30 +1212,19 @@ char * parseval(char *p, size_t len) { char hex[3]; - char*cp = p, *buffer, *newbuffer; - size_t size, newsize, i, j; + char*buffer; + size_t i, j; - size = 50; - if ((buffer = calloc(1, size)) == NULL) + if ((buffer = calloc(1, len + 1)) == NULL) return NULL; for (i = j = 0; j < len; i++) { - if (i >= size) { - newsize = size + 1024; - if ((newbuffer = realloc(buffer, newsize)) == NULL) { - free(buffer); - return (NULL); - } - buffer = newbuffer; - size = newsize; - } - - if (cp[j] == '\\') { - strlcpy(hex, cp + j + 1, sizeof(hex)); + if (p[j] == '\\') { + strlcpy(hex, p + j + 1, sizeof(hex)); buffer[i] = (char)strtoumax(hex, NULL, 16); j += 3; } else { - buffer[i] = cp[j]; + buffer[i] = p[j]; j++; } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317743 - head/usr.sbin/bsdinstall/partedit
Author: araujo Date: Wed May 3 14:03:46 2017 New Revision: 317743 URL: https://svnweb.freebsd.org/changeset/base/317743 Log: Use nitems() from sys/param.h. Reviewed by: ngie MFC after:2 weeks. Differential Revision:https://reviews.freebsd.org/D9942 Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c == --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Wed May 3 13:57:31 2017(r317742) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Wed May 3 14:03:46 2017(r317743) @@ -99,14 +99,14 @@ newfs_command(const char *fstype, char * if (!use_default) { int choice; choice = dlg_checklist("UFS Options", "", 0, 0, 0, - sizeof(items)/sizeof(items[0]), items, NULL, + nitems(items), items, NULL, FLAG_CHECK, ); if (choice == 1) /* Cancel */ return; } strcpy(command, "newfs "); - for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) { + for (i = 0; i < (int)nitems(items); i++) { if (items[i].state == 0) continue; if (strcmp(items[i].name, "UFS1") == 0) @@ -137,7 +137,7 @@ newfs_command(const char *fstype, char * if (!use_default) { int choice; choice = dlg_checklist("ZFS Options", "", 0, 0, 0, - sizeof(items)/sizeof(items[0]), items, NULL, + nitems(items), items, NULL, FLAG_CHECK, ); if (choice == 1) /* Cancel */ return; @@ -153,7 +153,7 @@ newfs_command(const char *fstype, char * sprintf(command, "%s -o cachefile=%s/zpool.cache ", command, zfsboot_path); } - for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) { + for (i = 0; i < (int)nitems(items); i++) { if (items[i].state == 0) continue; if (strcmp(items[i].name, "fletcher4") == 0) @@ -179,14 +179,14 @@ newfs_command(const char *fstype, char * if (!use_default) { int choice; choice = dlg_checklist("FAT Options", "", 0, 0, 0, - sizeof(items)/sizeof(items[0]), items, NULL, + nitems(items), items, NULL, FLAG_RADIO, ); if (choice == 1) /* Cancel */ return; } strcpy(command, "newfs_msdos "); - for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) { + for (i = 0; i < (int)nitems(items); i++) { if (items[i].state == 0) continue; if (strcmp(items[i].name, "FAT32") == 0) @@ -227,7 +227,7 @@ parttypemenu: dialog_vars.default_item = __DECONST(char *, def_scheme); cancel = dlg_menu("Partition Scheme", "Select a partition scheme for this volume:", 0, 0, 0, - sizeof(items) / sizeof(items[0]), items, , NULL); + nitems(items), items, , NULL); dialog_vars.default_item = NULL; if (cancel) @@ -662,7 +662,7 @@ endedit: "freebsd") == 0) gpart_partition(pp->lg_name, "BSD"); - for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) + for (i = 0; i < nitems(items); i++) if (items[i].text_free) free(items[i].text); } @@ -1200,7 +1200,7 @@ addpartform: set_default_part_metadata(newpartname, scheme, items[0].text, items[2].text, newfs); - for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) + for (i = 0; i < nitems(items); i++) if (items[i].text_free) free(items[i].text); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"