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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r351541 - stable/12/sys/dev/sound/pci/hda
Author: araujo Date: Tue Aug 27 07:17:31 2019 New Revision: 351541 URL: https://svnweb.freebsd.org/changeset/base/351541 Log: MFC r350433: 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] Yuri 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: stable/12/sys/dev/sound/pci/hda/hdaa_patches.c stable/12/sys/dev/sound/pci/hda/hdac.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/pci/hda/hdaa_patches.c == --- stable/12/sys/dev/sound/pci/hda/hdaa_patches.c Tue Aug 27 04:19:40 2019(r351540) +++ stable/12/sys/dev/sound/pci/hda/hdaa_patches.c Tue Aug 27 07:17:31 2019(r351541) @@ -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: stable/12/sys/dev/sound/pci/hda/hdac.h == --- stable/12/sys/dev/sound/pci/hda/hdac.h Tue Aug 27 04:19:40 2019 (r351540) +++ stable/12/sys/dev/sound/pci/hda/hdac.h Tue Aug 27 07:17:31 2019 (r351541) @@ -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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r345171 - head/usr.sbin/bhyve
> > > > Warner > > > > > 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(&pciecap, 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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&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, > > > > &
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&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(&pciecap, 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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&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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&mdctx); - MD5Update(&mdctx, vmname, strnlen(vmname, PATH_MAX)); + MD5Update(&mdctx, vmname, strlen(vmname)); MD5Update(&mdctx, hostname, sizeof(hostname)); MD5Final(digest, &mdctx); 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&mdctx); >> > - MD5Update(&mdctx, vmname, strlen(vmname)); >> > + MD5Update(&mdctx, vmname, strnlen(vmname, PATH_MAX)); >> > MD5Update(&mdctx, hostname, sizeof(hostname)); >> > MD5Final(digest, &mdctx); >> > >> > >> > 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&mdctx); - MD5Update(&mdctx, vmname, strlen(vmname)); + MD5Update(&mdctx, vmname, strnlen(vmname, PATH_MAX)); MD5Update(&mdctx, hostname, sizeof(hostname)); MD5Final(digest, &mdctx); 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343602 - stable/12/usr.sbin/bhyve
Author: araujo Date: Thu Jan 31 07:08:37 2019 New Revision: 343602 URL: https://svnweb.freebsd.org/changeset/base/343602 Log: MFC r343077: Fix broken uart on Win2016 guest. Obtained from:Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4) Modified: stable/12/usr.sbin/bhyve/uart_emul.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/uart_emul.c == --- stable/12/usr.sbin/bhyve/uart_emul.cThu Jan 31 05:20:11 2019 (r343601) +++ stable/12/usr.sbin/bhyve/uart_emul.cThu Jan 31 07:08:37 2019 (r343602) @@ -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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&rights, CAP_IOCTL, CAP_MMAP_RW); - if (cap_rights_limit(vm_get_device_fd(ctx), &rights) == -1 && - errno != ENOSYS) + if (caph_rights_limit(vm_get_device_fd(ctx), &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); vm_get_ioctls(&ncmds); 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(&rights, CAP_FSYNC, CAP_WRITE); - if (cap_rights_limit(fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(fd, &rights) == -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(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); - if (cap_rights_limit(STDIN_FILENO, &rights) == -1 && - errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, &rights) == -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 @@ i
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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342184 - stable/12/usr.sbin/bhyve
Author: araujo Date: Tue Dec 18 03:00:12 2018 New Revision: 342184 URL: https://svnweb.freebsd.org/changeset/base/342184 Log: MFC r340707: 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 Modified: stable/12/usr.sbin/bhyve/pci_ahci.c stable/12/usr.sbin/bhyve/pci_virtio_block.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_ahci.c == --- stable/12/usr.sbin/bhyve/pci_ahci.c Tue Dec 18 01:12:30 2018 (r342183) +++ stable/12/usr.sbin/bhyve/pci_ahci.c Tue Dec 18 03:00:12 2018 (r342184) @@ -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(&mdctx); MD5Update(&mdctx, opts, strlen(opts)); MD5Final(digest, &mdctx); - 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: stable/12/usr.sbin/bhyve/pci_virtio_block.c == --- stable/12/usr.sbin/bhyve/pci_virtio_block.c Tue Dec 18 01:12:30 2018 (r342183) +++ stable/12/usr.sbin/bhyve/pci_virtio_block.c Tue Dec 18 03:00:12 2018 (r342184) @@ -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(&mdctx); MD5Update(&mdctx, opts, strlen(opts)); MD5Final(digest, &mdctx); - 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r342083 - stable/12/usr.sbin/bhyve
Your mfc was quite fast less than 1 week, usually we take a bit more of time before we do the mfc! On Fri, Dec 14, 2018, 10:49 PM Alexander Motin Author: mav > Date: Fri Dec 14 14:49:04 2018 > New Revision: 342083 > URL: https://svnweb.freebsd.org/changeset/base/342083 > > Log: > MFC r341829: Allow CTL device specification in bhyve virtio-scsi. > > There was a large refactoring done in CTL to allow multiple ioctl > frontend > ports (and respective devices) to be created, particularly for bhyve. > Unfortunately, respective part of bhyve functionality got lost somehow > from > the original virtio-scsi commit. This change allows wanted device path > to > be specified in either of two ways: >-s 6,virtio-scsi,/dev/cam/ctl1.1 >-s 6,virtio-scsi,dev=/dev/cam/ctl2.3 > If neither is specified, the default /dev/cam/ctl device is used. > > While there, remove per-queue CTL device opening, which makes no sense at > this point. > > Modified: > stable/12/usr.sbin/bhyve/bhyve.8 > stable/12/usr.sbin/bhyve/pci_virtio_scsi.c > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/usr.sbin/bhyve/bhyve.8 > > == > --- stable/12/usr.sbin/bhyve/bhyve.8Fri Dec 14 14:46:35 2018 > (r342082) > +++ stable/12/usr.sbin/bhyve/bhyve.8Fri Dec 14 14:49:04 2018 > (r342083) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd October 24, 2018 > +.Dd December 11, 2018 > .Dt BHYVE 8 > .Os > .Sh NAME > @@ -298,7 +298,16 @@ if not explicitly specified. > .Pp > SCSI devices: > .Bl -tag -width 10n > -.It Pa /dev/cam/ Ns Oo , Ns Ar port and initiator_id Oc > +.It Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc Ns Oo , Ns Ar > scsi-device-options Oc > +.El > +.Pp > +The > +.Ar scsi-device-options > +are: > +.Bl -tag -width 10n > +.It Li iid= Ns Ar IID > +Initiator ID to use when sending requests to specified CTL port. > +The default value is 0. > .El > .Pp > TTY devices: > > Modified: stable/12/usr.sbin/bhyve/pci_virtio_scsi.c > > == > --- stable/12/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 14 14:46:35 2018 > (r342082) > +++ stable/12/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 14 14:49:04 2018 > (r342083) > @@ -105,7 +105,6 @@ struct pci_vtscsi_config { > 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_tvsq_cv; > @@ -529,7 +528,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, > sbuf_delete(sb); > } > > - err = ioctl(q->vsq_ctl_fd, CTL_IO, io); > + err = ioctl(sc->vss_ctl_fd, CTL_IO, io); > if (err != 0) { > WPRINTF(("CTL_IO: err=%d (%s)\n", errno, strerror(errno))); > cmd_wr->response = VIRTIO_SCSI_S_FAILURE; > @@ -639,14 +638,8 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, > int i; > > queue->vsq_sc = sc; > - queue->vsq_ctl_fd = open("/dev/cam/ctl", O_RDWR); > queue->vsq_vq = &sc->vss_vq[num + 2]; > > - if (queue->vsq_ctl_fd < 0) { > - WPRINTF(("cannot open /dev/cam/ctl: %s\n", > strerror(errno))); > - return (-1); > - } > - > pthread_mutex_init(&queue->vsq_mtx, NULL); > pthread_mutex_init(&queue->vsq_qmtx, NULL); > pthread_cond_init(&queue->vsq_cv, NULL); > @@ -672,24 +665,34 @@ static int > pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) > { > struct pci_vtscsi_softc *sc; > - char *optname = NULL; > - char *opt; > - int i; > + char *opt, *optname; > + const char *devname; > + int i, optidx = 0; > > sc = calloc(1, sizeof(struct pci_vtscsi_softc)); > - sc->vss_ctl_fd = open("/dev/cam/ctl", O_RDWR); > + devname = "/dev/cam/ctl"; > + while ((opt = strsep(&opts, ",")) != NULL) { > + optname = strsep(&opt, "="); > + if (opt == NULL && optidx == 0) { > + if (optname[0] != 0) > + devname = optname; > + } else if (strcmp(optname, "dev") == 0 && opt != NULL) { > + devname = opt; > + } else if (strcmp(optname, "iid") == 0 && opt != NULL) { > + sc->vss_iid = strtoul(opt, NULL, 10); > + } else { > + fprintf(stderr, "Invalid option %s\n", optname); > + free(sc); > + return (1); > + } > + optidx++; > + } > > + sc->vss_ctl_fd = open(devname, O_RDWR); > if (sc->vss_ctl_fd < 0) { > -
svn commit: r341757 - stable/12/usr.sbin/bhyve
Author: araujo Date: Sun Dec 9 06:41:57 2018 New Revision: 341757 URL: https://svnweb.freebsd.org/changeset/base/341757 Log: MFC r340046, r340050 r340046: Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad keys. PR: 213835 Submitted by: Vasily Postnicov Relnotes: Yes Sponsored by: iXsystems Inc. r340050: Remove printf for debug purpose forgotten on r340046. Reported by: Dmitry Luhtionov Modified: stable/12/usr.sbin/bhyve/ps2kbd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/ps2kbd.c == --- stable/12/usr.sbin/bhyve/ps2kbd.c Sun Dec 9 06:16:54 2018 (r341756) +++ stable/12/usr.sbin/bhyve/ps2kbd.c Sun Dec 9 06:41:57 2018 (r341757) @@ -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
svn commit: r341758 - stable/11/usr.sbin/bhyve
Author: araujo Date: Sun Dec 9 06:42:06 2018 New Revision: 341758 URL: https://svnweb.freebsd.org/changeset/base/341758 Log: MFC r340046, r340050 r340046: Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad keys. PR: 213835 Submitted by: Vasily Postnicov Relnotes: Yes Sponsored by: iXsystems Inc. r340050: Remove printf for debug purpose forgotten on r340046. Reported by: Dmitry Luhtionov Modified: stable/11/usr.sbin/bhyve/ps2kbd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/ps2kbd.c == --- stable/11/usr.sbin/bhyve/ps2kbd.c Sun Dec 9 06:41:57 2018 (r341757) +++ stable/11/usr.sbin/bhyve/ps2kbd.c Sun Dec 9 06:42:06 2018 (r341758) @@ -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
svn commit: r341761 - stable/12/usr.sbin/bhyve
Author: araujo Date: Sun Dec 9 06:48:44 2018 New Revision: 341761 URL: https://svnweb.freebsd.org/changeset/base/341761 Log: MFC r340211: 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: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c == --- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Dec 9 06:46:53 2018 (r341760) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Dec 9 06:48:44 2018 (r341761) @@ -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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&mdctx); > > MD5Update(&mdctx, opts, strlen(opts)); > > MD5Final(digest, &mdctx); > > - 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(&mdctx); > > MD5Update(&mdctx, opts, strlen(opts)); > > MD5Final(digest, &mdctx); > > - 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&mdctx); MD5Update(&mdctx, opts, strlen(opts)); MD5Final(digest, &mdctx); - 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(&mdctx); MD5Update(&mdctx, opts, strlen(opts)); MD5Final(digest, &mdctx); - 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340210 - head/usr.sbin/bhyve
Author: araujo Date: Wed Nov 7 04:20:29 2018 New Revision: 340210 URL: https://svnweb.freebsd.org/changeset/base/340210 Log: Revert my bogus attempt to silence coverity on r340045, it created more bad side effects than good. PR: 233038 Submitted by: We Maag Modified: head/usr.sbin/bhyve/pci_fbuf.c Modified: head/usr.sbin/bhyve/pci_fbuf.c == --- head/usr.sbin/bhyve/pci_fbuf.c Wed Nov 7 01:42:00 2018 (r340209) +++ head/usr.sbin/bhyve/pci_fbuf.c Wed Nov 7 04:20:29 2018 (r340210) @@ -319,7 +319,6 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } done: - free(uopts); return (ret); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r340046 - head/usr.sbin/bhyve
Em sex, 2 de nov de 2018 às 21:37, Dmitry Luhtionov < dmitryluhtio...@gmail.com> escreveu: > I think you need to remove `printf("keysym 0x%x\n", keysym);` from line > 322 > Done at: https://svnweb.freebsd.org/changeset/base/340050 Thank you to spot that. Best, -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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, &v, sizeof(v)); if (len <= 0) { WPRINTF(("vtrnd: /dev/random not ready, read(): %d", len)); + close(fd); return (1); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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->sc_ports)) + oldmtu = -1; + if (CK_SLIST_EMPTY(&sc->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)&ifr); + 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)&ifr); 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)&ifr); 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)&ifr); 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->sc_ports, lp_entries) { + if (lp->lp_ioctl != NULL) +
Re: svn commit: r338451 - stable/11/usr.bin/last
2018-09-04 18:09 GMT+08:00 Philip Paeps : > On 2018-09-04 17:59:30 (+0800), Marcelo Araujo wrote: > >> 2018-09-04 17:53 GMT+08:00 Philip Paeps : >> >> Author: philip >>> Date: Tue Sep 4 09:53:45 2018 >>> New Revision: 338451 >>> URL: https://svnweb.freebsd.org/changeset/base/338451 >>> >>> Log: >>> MFC r319508: >>> Fix a memory leak with last >>> free memory allocated to 'buf' >>> >> >> Is that the right patch? Or the commit message missed adding support to >> libxo(3)? >> > > I merged two changes: > > * r319508 plugs a memory leak. This was originally committed by stevek in > June 2017 but apparently never MFCed. > > * rr338352 adds libxo support. > > I mentioned both changes in the commit message. I'm not sure what's > unclear. > Ops, my bad! I just read the first MFC! Sorry for the noise! > > Philip > > -- > Philip Paeps > Senior Reality Engineer > Ministry of Information > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r338451 - stable/11/usr.bin/last
- printf("- %s", crmsg); > + xo_emit("- {:logout-reason/%s}", crmsg); > } else { > tm = localtime(&tt->logout); > (void) strftime(ct, sizeof(ct), "%R", tm); > - printf("- %s", ct); > + xo_attr("seconds", "%lu", (unsigned long)tt->logout); > + xo_emit("- {:logout-time/%s}", ct); > } > delta = tt->logout - bp->ut_tv.tv_sec; > + xo_attr("seconds", "%ld", (long)delta); > if (sflag) { > - printf(" (%8ld)\n", (long)delta); > + xo_emit(" ({:session-length/%8ld})\n", (long)delta); > } else { > tm = gmtime(&delta); > (void) strftime(ct, sizeof(ct), width >= 8 ? "%T" : "%R", > tm); > if (delta < 86400) > - printf(" (%s)\n", ct); > + xo_emit(" ({:session-length/%s})\n", ct); > else > - printf(" (%ld+%s)\n", (long)delta / 86400, ct); > + xo_emit(" ({:session-length/%ld+%s})\n", > + (long)delta / 86400, ct); > } > + > +end: > + xo_close_instance("last"); > } > > /* > @@ -423,7 +446,7 @@ addarg(int type, char *arg) > ARG *cur; > > if ((cur = malloc(sizeof(ARG))) == NULL) > - errx(1, "malloc failure"); > + xo_errx(1, "malloc failure"); > cur->next = arglist; > cur->type = type; > cur->name = arg; > @@ -448,7 +471,7 @@ hostconv(char *arg) > if (first) { > first = 0; > if (gethostname(name, sizeof(name))) > - err(1, "gethostname"); > + xo_err(1, "gethostname"); > hostdot = strchr(name, '.'); > } > if (hostdot && !strcasecmp(hostdot, argdot)) > @@ -471,7 +494,7 @@ ttyconv(char *arg) > if (strlen(arg) == 2) { > /* either 6 for "ttyxx" or 8 for "console" */ > if ((mval = malloc(8)) == NULL) > - errx(1, "malloc failure"); > + xo_errx(1, "malloc failure"); > if (!strcmp(arg, "co")) > (void)strcpy(mval, "console"); > else { > @@ -501,9 +524,9 @@ dateconv(char *arg) > > /* Start with the current time. */ > if (time(&timet) < 0) > -err(1, "time"); > +xo_err(1, "time"); > if ((t = localtime(&timet)) == NULL) > -err(1, "localtime"); > +xo_err(1, "localtime"); > > /* [[CC]YY]MMDDhhmm[.SS] */ > if ((p = strchr(arg, '.')) == NULL) > @@ -552,7 +575,7 @@ dateconv(char *arg) > t->tm_isdst = -1; /* Figure out DST. */ > timet = mktime(t); > if (timet == -1) > -terr: errx(1, > +terr: xo_errx(1, > "out of range or illegal time specification: > [[CC]YY]MMDDhhmm[.SS]"); > return timet; > } > > -- -- Marcelo Araujo(__)ara...@freebsd.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/s
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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&tq.tv_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
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(&xopts[4], NULL, 10); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&sc->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(&sc->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(&sc->mtx); + pci_nvme_reset_locked(sc); + pthread_mutex_unlock(&sc->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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&status, code); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&vmmdev_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
svn commit: r336704 - stable/11/usr.sbin/bhyve
Author: araujo Date: Wed Jul 25 04:33:56 2018 New Revision: 336704 URL: https://svnweb.freebsd.org/changeset/base/336704 Log: MFC r336188: 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 Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D16161 Modified: stable/11/usr.sbin/bhyve/bhyve.8 stable/11/usr.sbin/bhyve/bhyverun.c stable/11/usr.sbin/bhyve/dbgport.c stable/11/usr.sbin/bhyve/fwctl.c stable/11/usr.sbin/bhyve/mevent_test.c stable/11/usr.sbin/bhyve/pci_e82545.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/bhyve.8 == --- stable/11/usr.sbin/bhyve/bhyve.8Wed Jul 25 04:06:09 2018 (r336703) +++ stable/11/usr.sbin/bhyve/bhyve.8Wed Jul 25 04:33:56 2018 (r336704) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2017 +.Dd Jul 11, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -428,6 +428,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: stable/11/usr.sbin/bhyve/bhyverun.c == --- stable/11/usr.sbin/bhyve/bhyverun.c Wed Jul 25 04:06:09 2018 (r336703) +++ stable/11/usr.sbin/bhyve/bhyverun.c Wed Jul 25 04:33:56 2018 (r336704) @@ -338,7 +338,7 @@ fbsdrun_deletecpu(struct vmctx *ctx, int vcpu) if (!CPU_ISSET(vcpu, &cpumask)) { fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu); - exit(1); + exit(4); } CPU_CLR_ATOMIC(vcpu, &cpumask); @@ -672,7 +672,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, &vmexit[vcpu], &vcpu); @@ -683,7 +683,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); @@ -715,7 +715,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) err = vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, &tmp); 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) @@ -730,7 +730,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) @@ -744,7 +744,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); @@ -780,7 +780,7 @@ do_open(const char *vmname) } } else { perror("vm_create"); - exit(1); + exit(4); } } else { if (!romboot) { @@ -789,14 +789,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);
svn commit: r336192 - in stable/11/usr.sbin: bhyvectl bhyveload
Author: araujo Date: Wed Jul 11 07:33:19 2018 New Revision: 336192 URL: https://svnweb.freebsd.org/changeset/base/336192 Log: MFC r335026: style(9) remove unnecessary blank tabs. Obtained from:TrueOS Sponsored by: iXsystems Inc. Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.c stable/11/usr.sbin/bhyveload/bhyveload.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.c == --- stable/11/usr.sbin/bhyvectl/bhyvectl.c Wed Jul 11 07:22:05 2018 (r336191) +++ stable/11/usr.sbin/bhyvectl/bhyvectl.c Wed Jul 11 07:33:19 2018 (r336192) @@ -846,7 +846,7 @@ get_all_registers(struct vmctx *ctx, int vcpu) if (error == 0) printf("rflags[%d]\t0x%016lx\n", vcpu, rflags); } - + return (error); } @@ -1113,7 +1113,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, @@ -1131,7 +1131,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, &ctl); if (error == 0) @@ -1179,7 +1179,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, &addr); if (error == 0) Modified: stable/11/usr.sbin/bhyveload/bhyveload.c == --- stable/11/usr.sbin/bhyveload/bhyveload.cWed Jul 11 07:22:05 2018 (r336191) +++ stable/11/usr.sbin/bhyveload/bhyveload.cWed Jul 11 07:33:19 2018 (r336192) @@ -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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r336191 - stable/11/usr.sbin/bhyve
Author: araujo Date: Wed Jul 11 07:22:05 2018 New Revision: 336191 URL: https://svnweb.freebsd.org/changeset/base/336191 Log: MFC r335027, r335050 r335027: 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. Sponsored by: iXsystems Inc. r335050: 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 Sponsored by: iXsystems Inc. Modified: stable/11/usr.sbin/bhyve/bhyvegc.c stable/11/usr.sbin/bhyve/mem.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/bhyvegc.c == --- stable/11/usr.sbin/bhyve/bhyvegc.c Wed Jul 11 07:19:42 2018 (r336190) +++ stable/11/usr.sbin/bhyve/bhyvegc.c Wed Jul 11 07:22:05 2018 (r336191) @@ -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$"); Modified: stable/11/usr.sbin/bhyve/mem.c == --- stable/11/usr.sbin/bhyve/mem.c Wed Jul 11 07:19:42 2018 (r336190) +++ stable/11/usr.sbin/bhyve/mem.c Wed Jul 11 07:22:05 2018 (r336191) @@ -38,15 +38,16 @@ __FBSDID("$FreeBSD$"); #include -#include #include +#include #include #include -#include -#include #include +#include #include +#include +#include #include "mem.h" @@ -230,8 +231,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; @@ -242,8 +246,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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r336190 - in stable/11/sys/amd64/vmm: . amd intel io
Author: araujo Date: Wed Jul 11 07:19:42 2018 New Revision: 336190 URL: https://svnweb.freebsd.org/changeset/base/336190 Log: MFC r335030: Add SPDX tags to vmm(4). Sponsored by: iXsystems Inc. Modified: stable/11/sys/amd64/vmm/amd/npt.c stable/11/sys/amd64/vmm/amd/npt.h stable/11/sys/amd64/vmm/amd/svm.c stable/11/sys/amd64/vmm/amd/svm.h stable/11/sys/amd64/vmm/amd/svm_genassym.c stable/11/sys/amd64/vmm/amd/svm_msr.c stable/11/sys/amd64/vmm/amd/svm_msr.h stable/11/sys/amd64/vmm/amd/svm_softc.h stable/11/sys/amd64/vmm/amd/svm_support.S stable/11/sys/amd64/vmm/amd/vmcb.c stable/11/sys/amd64/vmm/amd/vmcb.h stable/11/sys/amd64/vmm/intel/vmx_support.S stable/11/sys/amd64/vmm/io/vatpic.c stable/11/sys/amd64/vmm/io/vatpit.h stable/11/sys/amd64/vmm/io/vpmtmr.c stable/11/sys/amd64/vmm/io/vpmtmr.h stable/11/sys/amd64/vmm/io/vrtc.c stable/11/sys/amd64/vmm/io/vrtc.h stable/11/sys/amd64/vmm/vmm_ioport.c stable/11/sys/amd64/vmm/vmm_ioport.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/vmm/amd/npt.c == --- stable/11/sys/amd64/vmm/amd/npt.c Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/npt.c Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/npt.h == --- stable/11/sys/amd64/vmm/amd/npt.h Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/npt.h Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/svm.c == --- stable/11/sys/amd64/vmm/amd/svm.c Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/svm.c Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013, Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/svm.h == --- stable/11/sys/amd64/vmm/amd/svm.h Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/svm.h Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/svm_genassym.c == --- stable/11/sys/amd64/vmm/amd/svm_genassym.c Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/svm_genassym.c Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/svm_msr.c == --- stable/11/sys/amd64/vmm/amd/svm_msr.c Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/svm_msr.c Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014, Neel Natu (n...@freebsd.org) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/svm_msr.h == --- stable/11/sys/amd64/vmm/amd/svm_msr.h Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/svm_msr.h Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 Neel Natu (n...@freebsd.org) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/svm_softc.h == --- stable/11/sys/amd64/vmm/amd/svm_softc.h Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/svm_softc.h Wed Jul 11 07:19:42 2018 (r336190) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com) * All rights reserved. * Modified: stable/11/sys/amd64/vmm/amd/svm_support.S == --- stable/11/sys/amd64/vmm/amd/svm_support.S Wed Jul 11 07:16:13 2018 (r336189) +++ stable/11/sys/amd64/vmm/amd/svm_support.S Wed Ju
svn commit: r336189 - stable/11/usr.sbin/bhyve
Author: araujo Date: Wed Jul 11 07:16:13 2018 New Revision: 336189 URL: https://svnweb.freebsd.org/changeset/base/336189 Log: MFC r335025: Add SPDX tags to bhyve(8). Discussed with: rgrimes, pfg and mav. Obtained from:TrueOS Sponsored by: iXsystems Inc. Modified: stable/11/usr.sbin/bhyve/atkbdc.c stable/11/usr.sbin/bhyve/bhyvegc.h stable/11/usr.sbin/bhyve/bootrom.c stable/11/usr.sbin/bhyve/bootrom.h stable/11/usr.sbin/bhyve/console.c stable/11/usr.sbin/bhyve/console.h stable/11/usr.sbin/bhyve/fwctl.c stable/11/usr.sbin/bhyve/fwctl.h stable/11/usr.sbin/bhyve/pci_e82545.c stable/11/usr.sbin/bhyve/pci_fbuf.c stable/11/usr.sbin/bhyve/pci_irq.c stable/11/usr.sbin/bhyve/pci_irq.h stable/11/usr.sbin/bhyve/pci_virtio_console.c stable/11/usr.sbin/bhyve/pci_virtio_rnd.c stable/11/usr.sbin/bhyve/pci_xhci.c stable/11/usr.sbin/bhyve/pci_xhci.h stable/11/usr.sbin/bhyve/ps2kbd.c stable/11/usr.sbin/bhyve/ps2kbd.h stable/11/usr.sbin/bhyve/ps2mouse.c stable/11/usr.sbin/bhyve/ps2mouse.h stable/11/usr.sbin/bhyve/rfb.c stable/11/usr.sbin/bhyve/rfb.h stable/11/usr.sbin/bhyve/sockstream.c stable/11/usr.sbin/bhyve/sockstream.h stable/11/usr.sbin/bhyve/task_switch.c stable/11/usr.sbin/bhyve/usb_emul.c stable/11/usr.sbin/bhyve/usb_emul.h stable/11/usr.sbin/bhyve/usb_mouse.c stable/11/usr.sbin/bhyve/vga.c stable/11/usr.sbin/bhyve/vga.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/atkbdc.c == --- stable/11/usr.sbin/bhyve/atkbdc.c Wed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/atkbdc.c Wed Jul 11 07:16:13 2018 (r336189) @@ -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: stable/11/usr.sbin/bhyve/bhyvegc.h == --- stable/11/usr.sbin/bhyve/bhyvegc.h Wed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/bhyvegc.h Wed Jul 11 07:16:13 2018 (r336189) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Tycho Nightingale * All rights reserved. * Modified: stable/11/usr.sbin/bhyve/bootrom.c == --- stable/11/usr.sbin/bhyve/bootrom.c Wed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/bootrom.c Wed Jul 11 07:16:13 2018 (r336189) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Neel Natu * All rights reserved. * Modified: stable/11/usr.sbin/bhyve/bootrom.h == --- stable/11/usr.sbin/bhyve/bootrom.h Wed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/bootrom.h Wed Jul 11 07:16:13 2018 (r336189) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Neel Natu * All rights reserved. * Modified: stable/11/usr.sbin/bhyve/console.c == --- stable/11/usr.sbin/bhyve/console.c Wed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/console.c Wed Jul 11 07:16:13 2018 (r336189) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Tycho Nightingale * All rights reserved. * Modified: stable/11/usr.sbin/bhyve/console.h == --- stable/11/usr.sbin/bhyve/console.h Wed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/console.h Wed Jul 11 07:16:13 2018 (r336189) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Tycho Nightingale * All rights reserved. * Modified: stable/11/usr.sbin/bhyve/fwctl.c == --- stable/11/usr.sbin/bhyve/fwctl.cWed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/fwctl.cWed Jul 11 07:16:13 2018 (r336189) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Peter Grehan * All rights reserved. * Modified: stable/11/usr.sbin/bhyve/fwctl.h == --- stable/11/usr.sbin/bhyve/fwctl.hWed Jul 11 03:23:09 2018 (r336188) +++ stable/11/usr.sbin/bhyve/fwctl.hWed Jul 11 07:16:13 2018 (r336189) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Peter Grehan * All rights reserved. * Modified: s
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-h...@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, &cpumask)) { > fprintf(stderr, "Attempting to delete unknown cpu %d\n", > vcpu); > - exit(1); > + exit(4); > } > > CPU_CLR_ATOMIC(vcpu, &cpumask); > @@ -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, &vmexit[vcpu], &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, &tmp); > if
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, &cpumask)) { fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu); - exit(1); + exit(4); } CPU_CLR_ATOMIC(vcpu, &cpumask); @@ -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, &vmexit[vcpu], &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, &tmp); 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
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(&mdctx); MD5Update(&mdctx, opts, strlen(opts)); - MD5Final(digest, &mdctx); + MD5Final(digest, &mdctx); 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r336161 - in stable/11: lib/libvmmapi usr.sbin/bhyve
Author: araujo Date: Tue Jul 10 04:26:32 2018 New Revision: 336161 URL: https://svnweb.freebsd.org/changeset/base/336161 Log: MFC r334307, r335103-r335104 r334307: 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 Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15548 r335103: Fix style(9) space vs tab. Reviewed by: jhb Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15774 r335104: Fix style(9) space vs tab. Reviewed by: jhb Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15768 Modified: stable/11/lib/libvmmapi/vmmapi.c stable/11/usr.sbin/bhyve/acpi.c stable/11/usr.sbin/bhyve/ahci.h stable/11/usr.sbin/bhyve/bhyverun.c stable/11/usr.sbin/bhyve/block_if.c stable/11/usr.sbin/bhyve/bootrom.h stable/11/usr.sbin/bhyve/console.h stable/11/usr.sbin/bhyve/consport.c stable/11/usr.sbin/bhyve/inout.c stable/11/usr.sbin/bhyve/mem.h stable/11/usr.sbin/bhyve/mevent.c stable/11/usr.sbin/bhyve/mevent_test.c stable/11/usr.sbin/bhyve/pci_e82545.c stable/11/usr.sbin/bhyve/pci_emul.c stable/11/usr.sbin/bhyve/pci_virtio_net.c stable/11/usr.sbin/bhyve/pci_xhci.c stable/11/usr.sbin/bhyve/rfb.c stable/11/usr.sbin/bhyve/rtc.c stable/11/usr.sbin/bhyve/sockstream.c stable/11/usr.sbin/bhyve/uart_emul.c stable/11/usr.sbin/bhyve/usb_mouse.c stable/11/usr.sbin/bhyve/vga.h stable/11/usr.sbin/bhyve/virtio.c stable/11/usr.sbin/bhyve/virtio.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libvmmapi/vmmapi.c == --- stable/11/lib/libvmmapi/vmmapi.cTue Jul 10 03:49:48 2018 (r336160) +++ stable/11/lib/libvmmapi/vmmapi.cTue Jul 10 04:26:32 2018 (r336161) @@ -83,19 +83,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 @@ -840,7 +840,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, &vmcap)); } @@ -1457,4 +1457,3 @@ vm_get_ioctls(size_t *len) *len = nitems(vm_ioctl_cmds); return (NULL); } - Modified: stable/11/usr.sbin/bhyve/acpi.c == --- stable/11/usr.sbin/bhyve/acpi.c Tue Jul 10 03:49:48 2018 (r336160) +++ stable/11/usr.sbin/bhyve/acpi.c Tue Jul 10 04:26:32 2018 (r336161) @@ -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: stati
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, INCLUDING
svn commit: r335688 - stable/11/usr.sbin/bhyve
Author: araujo Date: Wed Jun 27 03:58:02 2018 New Revision: 335688 URL: https://svnweb.freebsd.org/changeset/base/335688 Log: MFC r333622, r334019, r334084 r333622: 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 Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15388 r334019: Include atkbdc header where there are declared the prototype functions atkbdc_event and atkbdc_init. Sponsored by: iXsystems Inc. r334084: 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 Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15533 Modified: stable/11/usr.sbin/bhyve/atkbdc.c stable/11/usr.sbin/bhyve/mem.c stable/11/usr.sbin/bhyve/pci_virtio_console.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/atkbdc.c == --- stable/11/usr.sbin/bhyve/atkbdc.c Wed Jun 27 03:50:11 2018 (r335687) +++ stable/11/usr.sbin/bhyve/atkbdc.c Wed Jun 27 03:58:02 2018 (r335688) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include "acpi.h" +#include "atkbdc.h" #include "inout.h" #include "pci_emul.h" #include "pci_irq.h" Modified: stable/11/usr.sbin/bhyve/mem.c == --- stable/11/usr.sbin/bhyve/mem.c Wed Jun 27 03:50:11 2018 (r335687) +++ stable/11/usr.sbin/bhyve/mem.c Wed Jun 27 03:58:02 2018 (r335688) @@ -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(&mmio_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(&mmio_rwlock); + perror = pthread_rwlock_unlock(&mmio_rwlock); + assert(perror == 0); } #endif @@ -164,7 +166,7 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd { struct mmio_rb_range *entry; - int err, immutable; + int err, perror, immutable; pthread_rwlock_rdlock(&mmio_rwlock); /* @@ -182,7 +184,8 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd /* Update the per-vCPU cache */ mmio_hint[vcpu] = entry; } else if (mmio_rb_lookup(&mmio_rb_fallback, paddr, &entry)) { - pthread_rwlock_unlock(&mmio_rwlock); + perror = pthread_rwlock_unlock(&mmio_rwlock); + assert(perror == 0); return (ESRCH); } } @@ -201,15 +204,20 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd * config space window as 'immutable' the deadlock can be avoided. */ immutable = (entry->mr_param.flags & MEM_F_IMMUTABLE); - if (immutable) - pthread_rwlock_unlock(&mmio_rwlock); + if (immutable) { + perror = pthread_rwlock_unlock(&mmio_rwlock); + assert(perror == 0); + } err = vmm_emulate_instruction(ctx, vcpu, paddr, vie, paging, mem_read, mem_write, &entry->mr_param); - if (!immutable) - pthread_rwlock_unlock(&mmio_rwlock); + if (!immutable) { + perror = pthread_rwlock_unlock(&mmio_rwlock); + assert(perror == 0); + } + return (err); } @@ -217,7 +225,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; @@ -230,7 +238,8 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_ pthread_rwlock_wrlock(&mmio_rwlock); if (mmio_rb_lookup(rbt, memp->base, &entry) != 0) err = mmio_rb_add(rbt, mrp); - pthread_rwlock_unlock(&mmio_rwlock); + perror = pthread_rwlock_unlock(&mmio_rwlock); + assert(perror == 0); if (err) free(mrp); } else @@ -258,7 +267,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
svn commit: r335111 - svnadmin/conf
Author: araujo Date: Thu Jun 14 06:24:29 2018 New Revision: 335111 URL: https://svnweb.freebsd.org/changeset/base/335111 Log: Restore miwi's src commit bit. Welcome back Martin Wilke! Martin Wilke will be mentored by myself for a brief period. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access == --- svnadmin/conf/accessThu Jun 14 06:14:48 2018(r335110) +++ svnadmin/conf/accessThu Jun 14 06:24:29 2018(r335111) @@ -148,6 +148,7 @@ mav maxim mckusick melifaro +miwi mizhka mjg mjoras Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Thu Jun 14 06:14:48 2018(r335110) +++ svnadmin/conf/mentors Thu Jun 14 06:24:29 2018(r335111) @@ -27,6 +27,7 @@ kadesai ken Co-mentor: scottl, ambrisko leitao jhibbitsCo-mentor: nwhitehorn luporl jhibbitsCo-mentor: nwhitehorn mahrensmckusick +miwi araujo mjoras rstone peterj jhb Co-mentor: grog ramken Co-mentor: mav ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
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, &vmcap)); } @@ -1580,4 +1580,3 @@ vm_get_ioctls(size_t *len) *len = nitems(vm_ioctl_cmds); return (NULL); } - ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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, Nee
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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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, &ctl); 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, &addr); 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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 (r335
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 >>> + * IMP
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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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 (
svn commit: r334940 - head/usr.sbin/bhyve
MPLIED 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. + * + * $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; +p
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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&string, ",")) != NULL) + printf("%s\en", token); -while ((token = strsep(&string, ",")) != NULL) - printf("%s\en", token); - free(tofree); +free(string); .Ed .Pp The following uses ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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 wrote: > > > > > > > > > > > On Fri, May 25, 2018 at 2:02 PM, Ed Maste wrote: > > > > > >> On 25 May 2018 at 14:26, Marcelo Araujo > 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Sat, May 26, 2018, 4:09 AM Warner Losh wrote: > > > On Fri, May 25, 2018 at 2:02 PM, Ed Maste wrote: > >> On 25 May 2018 at 14:26, Marcelo Araujo 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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 : > On Fri, May 25, 2018 at 06:54:40PM +0000, 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 > > 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(&str, ",")) != NULL) { > > if (sscanf(cp, "%i%n", &tmp, &chk) == 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 3:01 GMT+08:00 Shawn Webb : > 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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 : > On Sat, May 26, 2018 at 02:26:33AM +0800, Marcelo Araujo wrote: > > 2018-05-26 2:21 GMT+08:00 Brooks Davis : > > > > > On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote: > > > > 2018-05-26 1:44 GMT+08:00 Brooks Davis : > > > > > > > > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > > > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler > > > 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. > > > > > &
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 Webb 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.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(&str, ",")) != NULL) { if (sscanf(cp, "%i%n", &tmp, &chk) == 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 2:21 GMT+08:00 Brooks Davis : > On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote: > > 2018-05-26 1:44 GMT+08:00 Brooks Davis : > > > > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler > wrote: > > > > > > > > > On 25 May 2018 at 08:23, Marcelo Araujo > > > wrote: > > > > > > > > > > > > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis > > > 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 &g
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 2:21 GMT+08:00 Brooks Davis : > On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote: > > 2018-05-26 1:44 GMT+08:00 Brooks Davis : > > > > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler > wrote: > > > > > > > > > On 25 May 2018 at 08:23, Marcelo Araujo > > > wrote: > > > > > > > > > > > > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis > > > 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 > >
Re: svn commit: r334199 - head/usr.sbin/bhyve
2018-05-26 1:44 GMT+08:00 Brooks Davis : > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote: > > On Sat, May 26, 2018, 1:11 AM Eitan Adler wrote: > > > > > On 25 May 2018 at 08:23, Marcelo Araujo > wrote: > > > > > > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis > 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Sat, May 26, 2018, 1:11 AM Eitan Adler wrote: > On 25 May 2018 at 08:23, Marcelo Araujo wrote: > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Fri, May 25, 2018, 11:11 PM Brooks Davis wrote: > On Fri, May 25, 2018 at 02:07:05AM +0000, 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r334199 - head/usr.sbin/bhyve
On Fri, May 25, 2018, 11:11 PM Brooks Davis wrote: > On Fri, May 25, 2018 at 02:07:05AM +0000, 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&str, ",")) != NULL) { if (sscanf(cp, "%i%n", &tmp, &chk) == 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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(&mmio_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(&mmio_rwlock); + perror = pthread_rwlock_unlock(&mmio_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(&mmio_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(&mmio_rb_fallback, paddr, &entry)) { - pthread_rwlock_unlock(&mmio_rwlock); + perror = pthread_rwlock_unlock(&mmio_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(&mmio_rwlock); + if (immutable) { + perror = pthread_rwlock_unlock(&mmio_rwlock); + assert(perror == 0); + } err = cb(ctx, vcpu, paddr, &entry->mr_param, arg); - if (!immutable) - pthread_rwlock_unlock(&mmio_rwlock); + if (!immutable) { + perror = pthread_rwlock_unlock(&mmio_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(&mmio_rwlock); if (mmio_rb_lookup(rbt, memp->base, &entry) != 0) err = mmio_rb_add(rbt, mrp); - pthread_rwlock_unlock(&mmio_rwlock); + perror = pthread_rwlock_unlock(&mmio_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(&mmio_rwlock); err = mmio_rb_lookup(&mmio_rb_root, memp->base, &entry); @@ -330,7 +339,8 @@ unregister_mem(struct mem_range *memp) mmio_hint[i] = NULL; } } - pthread_rwlock_unlock(&mmio_rwlock); + perror = pthread_rwlock_unlock(&mmio_rwlock); + assert(perror == 0); if (entry) free(entry); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"