Yep. I can look at it in a few days.
I'm assuming that the vm was stopped before running the check?
On April 18, 2022 3:42:50 PM EDT, Mike Larkin wrote:
>On Mon, Apr 18, 2022 at 12:21:39PM -0400, Dave Voutila wrote:
>>
>> "Thomas L." writes:
>>
>> > Hi,
>> >
>> > I recently tried to use qemu-
On Sun, 13 Jun 2021 11:09:20 -0400, Dave Voutila wrote:
> Was about to add a test for something I'm hacking on when I noticed the
> diskfmt regress test wasn't enabled. I took a look and it's rotted. :(
>
> It was originally written by Ori Bernstein and imported by c
_print_setfield(const u_char *bp, u_int length)
> {
> struct ofp_action_set_field *asf;
> - struct ofp_ox_match *oxm;
> int omlen;
>
> if (length < (sizeof(*asf) - AH_UNPADDED)) {
> @@ -1030,27 +1000,7 @@ action_print_setfield(const u_char *bp,
> if (omlen == 0)
> return;
>
> - parse_next_oxm:
> - if (length < sizeof(*oxm)) {
> - printf(" [|OpenFlow]");
> - return;
> - }
> -
> - oxm = (struct ofp_ox_match *)bp;
> - bp += sizeof(*oxm);
> - length -= sizeof(*oxm);
> - if (length < oxm->oxm_length) {
> - printf(" [|OpenFlow]");
> - return;
> - }
> -
> - ofp_print_oxm(oxm, bp, length);
> -
> - bp += oxm->oxm_length;
> - length -= oxm->oxm_length;
> - omlen -= min(sizeof(*oxm) + oxm->oxm_length, omlen);
> - if (omlen)
> - goto parse_next_oxm;
> + ofp_print_oxm_field(bp, length, omlen, 1);
> }
>
> void
> @@ -1094,6 +1044,7 @@ ofp_print_action(struct ofp_action_heade
> break;
>
> case OFP_ACTION_SET_FIELD:
> + action_print_setfield(bp, length);
> break;
>
> case OFP_ACTION_COPY_TTL_OUT:
>
--
Ori Bernstein
On Fri, 16 Nov 2018 16:15:14 +0100, Reyk Floeter wrote:
> On Sat, Oct 27, 2018 at 02:53:16PM -0700, Ori Bernstein wrote:
> > On Fri, 26 Oct 2018 01:57:15 +0200, Reyk Floeter wrote:
> >
> > > On Tue, Oct 23, 2018 at 10:21:08PM -0700, Ori Bernstein wrote:
> > &
On Sat, 27 Oct 2018 14:53:16 -0700, Ori Bernstein wrote:
> On Fri, 26 Oct 2018 01:57:15 +0200, Reyk Floeter wrote:
>
> > On Tue, Oct 23, 2018 at 10:21:08PM -0700, Ori Bernstein wrote:
> > > On Mon, 8 Oct 2018 07:59:15 -0700, Bob Beck wrote:
> > >
> >
On Tue, 30 Oct 2018 23:01:50 -0700, Mike Larkin wrote:
> On Tue, Oct 30, 2018 at 10:41:21PM -0700, o...@eigenstate.org wrote:
> > > On Tue, Oct 30, 2018 at 10:32:37PM -0700, Ori Bernstein wrote:
> > >> On Tue, 30 Oct 2018 22:29:01 -0700, Mi
ail if we could
not open a disk image -- especially since these ones are actually *parts* of
a disk image, meaning that we've got a corrupt image.
I can easily change these back to warns + error returns.
--
Ori Bernstein
- log_warn("%s: refs block grow fail", __func__);
- return -1;
- }
+ if (ftruncate(disk->fd, disk->end) < 0)
+ fatal("%s: failed to allocate ref block", __func__);
buf = htobe64(l2cluster);
- if (pwrite(disk->fd, &buf, sizeof(buf), l1off) != 8) {
- return -1;
- }
+ if (pwrite(disk->fd, &buf, sizeof(buf), l1off) != 8)
+ fatal("%s: failed to write ref block", __func__);
}
refs = 1;
if (!newcluster) {
if (pread(disk->fd, &refs, sizeof(refs),
l2cluster + 2 * l2idx) != 2)
- return -1;
+ fatal("could not read ref cluster");
refs = be16toh(refs) + 1;
}
refs = htobe16(refs);
- if (pwrite(disk->fd, &refs, sizeof(refs), l2cluster + 2 * l2idx) != 2) {
- log_warn("%s: could not write ref block", __func__);
- return -1;
- }
- return 0;
+ if (pwrite(disk->fd, &refs, sizeof(refs), l2cluster + 2 * l2idx) != 2)
+ fatal("%s: could not write ref block", __func__);
}
--
Ori Bernstein
ange it, I think it's better as an independent patch that
converts all of vmd.
--
Ori Bernstein
On Fri, 26 Oct 2018 01:57:15 +0200, Reyk Floeter wrote:
> On Tue, Oct 23, 2018 at 10:21:08PM -0700, Ori Bernstein wrote:
> > On Mon, 8 Oct 2018 07:59:15 -0700, Bob Beck wrote:
> >
> > > works here and I like it. but probably for after unlock
> > >
> >
On Wed, 24 Oct 2018 16:23:29 +0800, Michael Mikonos wrote:
> On Tue, Oct 23, 2018 at 09:44:24PM -0700, Ori Bernstein wrote:
> > This patch turns most warnings into errors, and uses the
> > appropriate fatal/fatalx so that we don't print bogus error
> > string
On Mon, 8 Oct 2018 07:59:15 -0700, Bob Beck wrote:
> works here and I like it. but probably for after unlock
>
It's after unlock -- pinging for OKs.
--
Ori Bernstein
)
+ fatalx("write would clobber header");
return cluster + clusteroff;
-
-fail:
- pthread_rwlock_unlock(&disk->lock);
- return -1;
}
/* Copies a cluster containing src to dst. Src and dst need not be aligned. */
@@ -630,7 +597,7 @@ inc_refs(struct qcdisk *disk, off_t off, int newcluster)
l2cluster = disk->end;
disk->end += disk->clustersz;
if (ftruncate(disk->fd, disk->end) < 0) {
- log_warn("%s: refs block grow fail", __func__);
+ fatalx("%s: refs block grow fail", __func__);
return -1;
}
buf = htobe64(l2cluster);
@@ -648,7 +615,7 @@ inc_refs(struct qcdisk *disk, off_t off, int newcluster)
}
refs = htobe16(refs);
if (pwrite(disk->fd, &refs, sizeof(refs), l2cluster + 2 * l2idx) != 2) {
- log_warn("%s: could not write ref block", __func__);
+ fatalx("%s: could not write ref block", __func__);
return -1;
}
return 0;
--
Ori Bernstein
On Mon, 22 Oct 2018 22:57:39 -0700, Ori Bernstein wrote:
> While I'm at it, this patch fixes up a few nits around logging, where
> warn was used instead of warnx, leading to some bogus error strings
> being printed, and adds a few checks that we should have been doing.
> This p
;
l2tab = disk->l1[l1off];
@@ -584,6 +587,8 @@ mkcluster(struct qcdisk *disk, struct qcdisk *base, off_t
off, off_t src_phys)
pthread_rwlock_unlock(&disk->lock);
clusteroff = off % disk->clustersz;
+ if (cluster + clusteroff < disk->clustersz)
+ fatalx("write would clobber header");
return cluster + clusteroff;
fail:
--
Ori Bernstein
vmd {
uint32_t vmd_nvm;
struct vmlist *vmd_vms;
+ struct name2idlist *vmd_known;
uint32_t vmd_nswitches;
struct switchlist *vmd_switches;
struct userlist *vmd_users;
--
Ori Bernstein
On Wed, 3 Oct 2018 07:27:17 +0100, Jason McIntyre wrote:
> On Tue, Oct 02, 2018 at 11:13:35PM -0700, Ori Bernstein wrote:
> >
> > Updated version. Changes from the last diff:
> >
> > - Merge in syntax changes.
> > - Don't over-read when getting the ba
On Wed, 3 Oct 2018 11:36:53 +0200, Reyk Floeter wrote:
> On Tue, Oct 02, 2018 at 11:13:35PM -0700, Ori Bernstein wrote:
> > On Mon, 1 Oct 2018 11:24:01 -0700, Ori Bernstein
> > wrote:
> >
> > > On Mon, 1 Oct 2018 12:55:12 +0200
> > > Rey
On Mon, 1 Oct 2018 11:24:01 -0700, Ori Bernstein wrote:
> On Mon, 1 Oct 2018 12:55:12 +0200
> Reyk Floeter wrote:
>
> > Hi Ori,
> >
> > On Sun, Sep 30, 2018 at 12:27:00PM -0700, Ori Bernstein wrote:
> > > I've added support to vmd for external sna
On Mon, 1 Oct 2018 12:55:12 +0200
Reyk Floeter wrote:
> Hi Ori,
>
> On Sun, Sep 30, 2018 at 12:27:00PM -0700, Ori Bernstein wrote:
> > I've added support to vmd for external snapshots. That is,
> > snapshots that are derived from a base image. Data lookups
> > st
On Sun, 30 Sep 2018 12:27:00 -0700, Ori Bernstein wrote:
> I've added support to vmd for external snapshots. That is,
> snapshots that are derived from a base image. Data lookups
> start in the derived image, and if the derived image does not
> contain some data, the search pro
t vm_tty;
@@ -412,4 +413,7 @@ int parse_config(const char *);
int cmdline_symset(char *);
int host(const char *, struct address *);
+/* virtio.c */
+int virtio_get_base(int, char *, size_t, int);
+
#endif /* VMD_H */
diff --git usr.sbin/vmd/vmm.c usr.sbin/vmd/vmm.c
index 7757856323f..3176fd85713 100644
--- usr.sbin/vmd/vmm.c
+++ usr.sbin/vmd/vmm.c
@@ -608,7 +608,7 @@ vmm_start_vm(struct imsg *imsg, uint32_t *id, pid_t *pid)
struct vmd_vm *vm;
int ret = EINVAL;
int fds[2];
- size_t i;
+ size_t i, j;
if ((vm = vm_getbyvmid(imsg->hdr.peerid)) == NULL) {
log_warnx("%s: can't find vm", __func__);
@@ -643,8 +643,11 @@ vmm_start_vm(struct imsg *imsg, uint32_t *id, pid_t *pid)
close(fds[1]);
for (i = 0 ; i < vcp->vcp_ndisks; i++) {
- close(vm->vm_disks[i]);
- vm->vm_disks[i] = -1;
+ for (j = 0; j < VMM_MAX_BASE_PER_DISK; j++) {
+ if (vm->vm_disks[i][j] != -1)
+ close(vm->vm_disks[i][j]);
+ vm->vm_disks[i][j] = -1;
+ }
}
for (i = 0 ; i < vcp->vcp_nnics; i++) {
close(vm->vm_ifs[i].vif_fd);
--
Ori Bernstein
On Fri, 14 Sep 2018 13:50:40 +0800, Michael Mikonos wrote:
> On Thu, Sep 13, 2018 at 10:08:16PM -0700, Ori Bernstein wrote:
> > On Thu, 13 Sep 2018 10:30:54 +0800, Michael Mikonos wrote:
> >
> I think a check for !disk->base belongs here as done above for disk->
tio_dump(int);
int virtio_restore(int, struct vmd_vm *, int, int *, int *);
uint32_t vring_size(uint32_t);
diff --git usr.sbin/vmd/vm.c usr.sbin/vmd/vm.c
index 046b2be8503..491ca2eae3f 100644
--- usr.sbin/vmd/vm.c
+++ usr.sbin/vmd/vm.c
@@ -371,6 +371,9 @@ start_vm(struct vmd_vm *vm, int fd)
/* Execute the vcpu run loop(s) for this VM */
ret = run_vm(vm->vm_cdrom, vm->vm_disks, nicfds, &vm->vm_params, &vrs);
+ /* Ensure that any in-flight data is written back */
+ virtio_shutdown(vm);
+
return (ret);
}
--
2.18.0
--
Ori Bernstein
On Wed, 12 Sep 2018 15:36:32 +0800
Michael Mikonos wrote:
> On Wed, Sep 12, 2018 at 12:13:35AM -0700, Ori Bernstein wrote:
> > On Tue, 11 Sep 2018 23:29:53 -0700, Ori Bernstein
> > wrote:
> >
> > > static ssize_t
> > > @@ -362,8 +377,9 @@ qc2_clo
On Tue, 11 Sep 2018 23:29:53 -0700, Ori Bernstein wrote:
> static ssize_t
> @@ -362,8 +377,9 @@ qc2_close(void *p)
> struct qcdisk *disk;
>
> disk = p;
> - pwrite(disk->fd, disk->l1, disk->l1sz, disk->l1off);
> - close(
On Wed, 12 Sep 2018 12:04:21 +0800, Michael Mikonos wrote:
> On Tue, Sep 11, 2018 at 11:25:52AM -0700, Ori Bernstein wrote:
> > On Tue, 11 Sep 2018 15:36:49 +0800
> > Michael Mikonos wrote:
> >
> > > Hello,
> > >
> > > Sometimes vmd doesn'
-p -u -r1.1 vioraw.c
> --- vioraw.c 25 Aug 2018 04:16:09 - 1.1
> +++ vioraw.c 11 Sep 2018 07:29:10 -
> @@ -62,6 +62,8 @@ virtio_init_raw(struct virtio_backing *f
> return -1;
>
> fdp = malloc(sizeof(int));
> + if (fdp == NULL)
> + return -1;
> *fdp = fd;
> file->p = fdp;
> file->pread = raw_pread;
>
--
Ori Bernstein
think I changed that in
my (WIP) cluster reuse change, but if you're touching the code it might
as well go in here.
--
Ori Bernstein
TS} scribble-images
+
+.include
diff --git regress/usr.sbin/vmd/diskfmt/vioscribble.c
regress/usr.sbin/vmd/diskfmt/vioscribble.c
new file mode 100644
index 000..3821c3b277b
--- /dev/null
+++ regress/usr.sbin/vmd/diskfmt/vioscribble.c
@@ -0,0 +1,165 @@
+/* $OpenBSD: $ */
+
+/*
+ * Copy
On Wed, 15 Aug 2018 23:02:16 -0700, Ori Bernstein wrote:
> Updated style from feedback from off-list. Also added checks and
> erroring for incompatible extensions.
One more update. This revision adds explicit definitions of the
disk format, and adds regress tests for parsing it. The synt
On Tue, 21 Aug 2018 23:03:36 -0700, Carlos Cardenas
wrote:
> On Sun, Aug 19, 2018 at 11:46:12PM -0700, Ori Bernstein wrote:
> > One more minor update to this patch:
> >
> > - Remove unused enum
> > - Remove unused function prototype
> > - Move som
ding is that the oxm_value
itself is not at the start of the packet, and is not aligned within the
ofp_ox_match. I'm not familiar enough with the open flowz to know if
ofp_ox_match is guaranteed to start at a 4-byte alignment (which would
push oxm_value out to an 8 byte alignment), but I suspect that's not the
case.
--
Ori Bernstein
On Sun, 12 Aug 2018 22:51:24 -0700, Ori Bernstein wrote:
>
This patch adds preliminary support for creating qcow2 disk images. It gives
the 'vmctl create' command an option '-f', which can be given arguments of
either 'raw' (defualt) or 'qcow2', and
On Sun, 12 Aug 2018 22:51:24 -0700, Ori Bernstein wrote:
> On Sun, 5 Aug 2018 00:52:32 -0700, Ori Bernstein wrote:
>
> And, now something that actually appears to work. You can create a
> disk on OpenBSD using qemu:
>
> qemu-img create foo.qc2 16G
>
>
index 000..d377546de67
--- /dev/null
+++ usr.sbin/vmd/vioraw.c
@@ -0,0 +1,73 @@
+/* $OpenBSD: $ */
+/*
+ * Copyright (c) 2018 Ori Bernstein
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
mode 100644
index 000..f951fcbd99a
--- /dev/null
+++ usr.sbin/vmd/vioqcow2.c
@@ -0,0 +1,546 @@
+/* $OpenBSD: $ */
+
+/*
+ * Copyright (c) 2018 Ori Bernstein
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby
00644
index 000..409974003f8
--- /dev/null
+++ usr.sbin/vmd/vioraw.c
@@ -0,0 +1,68 @@
+/* $OpenBSD: $ */
+/*
+ * Copyright (c) 2018 Ori Bernstein
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided
On Sun, 5 Aug 2018 00:52:32 -0700, Ori Bernstein wrote:
> This change introduces a 'struct virtio_backing' which makes the
> disk i/o pluggable, providing 'backing->{pread,pwrite}' calls that
> can be replaced by different disk i/o drivers.
>
> This is
553506d467f
--- /dev/null
+++ usr.sbin/vmd/vioqcow2.c
@@ -0,0 +1,612 @@
+/* $OpenBSD: $ */
+
+/*
+ * Copyright (c) 2018 Ori Bernstein
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ *
;
/* last block address read */
@@ -241,10 +255,10 @@ struct vmmci_dev {
};
struct ioinfo {
+ struct virtio_backing *file;
uint8_t *buf;
ssize_t len;
off_t offset;
- int fd;
int error;
};
@@ -261,6 +275,9 @@ void viornd_update_qs(void);
void viornd_update_qa(void);
int viornd_notifyq(void);
+int virtio_init_raw(struct virtio_backing *dev, off_t *sz, int fd);
+int virtio_init_qcow2(struct virtio_backing *dev, off_t *sz, int fd);
+
int virtio_blk_io(int, uint16_t, uint32_t *, uint8_t *, void *, uint8_t);
int vioblk_dump(int);
int vioblk_restore(int, struct vm_create_params *, int *);
--
Ori Bernstein
uot;the quick the brown the fox";
^^^^^
matches.sm_match[0] = "the quick the brown the fox"
matches.sm_match[1] = "qu"
matches.sm_match[2] = "the"
The choice to capture implicitly, I think, is confusing, but the behavior
seems to me to be correct.
--
Ori Bernstein
e it instead.
>
> Dust is not yet settled.
>
In this specific case, the line is already activated. It's just duplicated
in a comment one line before the pledge gets called.
--
Ori Bernstein
s of the cited thread, it seemed like something that
might be accepted if implemented.
It was easy to implement, so I added it and sent a patch. If
it's not a desirable feature for httpd, no problem.
--
Ori Bernstein
> + continue;
> }
> - *p = '\0';
> + *nl = '\0';
> s->line = line_co;
> s->cmd_offset = line_co;
> strunvis(line, encoded);
> histsave(line_co, line, 0);
> + line_co++;
> }
>
> history_write();
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
>
--
Ori Bernstein
Pinging this patch.
On Tue, 10 Oct 2017 21:31:20 -0700
Ori Bernstein wrote:
> My website generator is a little stupid at times. It generates
> files with .html suffixes, but urls without them.
>
> I worked around this with some redirects, but it never felt
> quite right doing
istfh);
> + } while (p != NULL && strchr(p, '\n') == NULL);
> +
> + continue;
> }
> - *p = '\0';
> + *nl = '\0';
> s->line = line_co;
> s->cmd_offset = line_co;
> strunvis(line, encoded);
> histsave(line_co, line, 0);
> + line_co++;
> }
>
> history_write();
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
>
--
Ori Bernstein
My website generator is a little stupid at times. It generates
files with .html suffixes, but urls without them.
I worked around this with some redirects, but it never felt
quite right doing an extra round trip. Therefore, I added
internal redirects, processing the rewrite before responding to
an
Just move the assignment up a bit.
diff --git usr.bin/awk/main.c usr.bin/awk/main.c
index 82996bc6f71..ebff17d240a 100644
--- usr.bin/awk/main.c
+++ usr.bin/awk/main.c
@@ -64,13 +64,13 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C
And pax, because I can
diff --git bin/pax/ar_io.c bin/pax/ar_io.c
index 40a6492405e..ce53a9ae51b 100644
--- bin/pax/ar_io.c
+++ bin/pax/ar_io.c
@@ -1281,6 +1281,11 @@ ar_start_gzip(int fd, const char *path, int wr)
/* System compressors are more likely to use pledge(
Slowcgi. Because if someone could fool it into
running the wrong binary, the outcome may be
suboptimal.
diff --git usr.sbin/slowcgi/slowcgi.8 usr.sbin/slowcgi/slowcgi.8
index d3ab4030bed..f8f07630204 100644
--- usr.sbin/slowcgi/slowcgi.8
+++ usr.sbin/slowcgi/slowcgi.8
@@ -24,6 +24,7
GS+= -Wall -Werror
+
+.include
diff --git usr.bin/pledge/pledge.1 usr.bin/pledge/pledge.1
new file mode 100644
index 000..e049277fdff
--- /dev/null
+++ usr.bin/pledge/pledge.1
@@ -0,0 +1,44 @@
+.\" $OpenBSD$
+.\"
+.\"Copyright (c) 2017 Ori Bernstein
+.\"
+.\"Permis
I wrote some patches to allow pledging across execs.
Currently, the exec pledge passes down the process tree.
The initial version simply inherited the current pledge when
execing with the `pledge("rexec")` promise, but after
discussing with Theo at EuroBSD, a better design was
suggested. Because
On Sat, 22 Jul 2017 02:25:29 -0400
Todd Mortimer wrote:
> xor [rsp], rsp
>
> at the start of each function, and before every RET.
Wouldn't this break with alloca() or C99 VLAs?
%rbp may work better, if the frame pointer is
retained.
--
Ori Bernstein
54 matches
Mail list logo