what size should NBD_OPT_INFO report?
by Eric Blake
I noticed during integration testing that nbd-server blindly reports a
size of 0 for all NBD_OPT_INFO requests, unless I pass a size argument
on the command line to nbd-server. At first, I thought it was a side
effect of me trying to use nbd-server on a block device (an LVM
partition), as it is a common bug to rely on stat().st_size which only
works for regular files (a block device has to use lseek(SEEK_END));
but then I noticed it happening when using nbd-server to serve regular
files as well.
I then turned to the source code, where I see that client->exportsize
is set in just these places:
commit_client()
- exportsize = OFFT_MAX, then try setupexport()
setupexport()
- default to client->server->expected_size (if one was provided),
further validating that actual size is large enough when actual size
can be computed
- if neither treefile or F_WAIT is set, compute actual size by opening
one or more files and using size_autodetect() (which does the right
thing for block devices, so my earlier thought about over-reliance
on stat() was wrong)
but these functions are only reached for NBD_OPT_EXPORT_NAME and
NBD_OPT_GO, not NBD_OPT_INFO. The upshot is that for NBD_OPT_GO,
there are some scenarios (treefile, F_WAIT) where nbd-server
advertises a size of 9223372036854775807 (0x7fffffff_ffffffff) meaning
unknown, but a size of 0 there is only possible if the file was
successfully opened and really is zero bytes in length. Conversely,
NBD_OPT_INFO is always advertising a size of 0, which means most of
the time, the size changes between NBD_OPT_INFO and NBD_OPT_GO.
For comparison, both nbdkit and qemu as an NBD server always advertise
the same size for both NBD_OPT_INFO and NBD_OPT_GO (but it should also
be noted that neither of these has the complexity of multifile like
nbd-server).
Should we tweak the NBD standard to recommend that a server advertise
a size of OFFT_MAX for NBD_OPT_INFO if it is prohibitive to determine
an actual size, rather than 0? Furthermore, is it worth adding code
to make NBD_OPT_INFO try harder to provide a sensible value when
possible (if expected_size was set, or if we are not multifile or
F_WAIT, then a stat() is enough to get the size for serving a regular
file; and if stat() says we have a block device, we can still try the
open/lseek/close)?
Also, is it worth trying to specify that since no known NBD servers
allow exports with sizes larger than OFFT_MAX, a server MUST NOT
report a size equal or larger than 9223372036854775808
(0x80000000_00000000)? There are definitely a few places that I could
simplify in libnbd if we have a protocol guarantee that a valid export
size will never have the most significant bit set, and therefore we
don't have to worry about whether size is represented as a signed or
unsigned value (which also implies that libnbd's function
nbd_get_size() returning ssize_t instead of size_t is acceptable).
But if we do that, then maybe 0x80000000_00000000 or even
0xffffffff_ffffffff would serve as a better recommended sentinel than
0x7fffffff_ffffffff for representing an indeterminate size.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
6 months, 1 week
[PATCH nbdkit] tests: gcs: skip tests without google cloud module
by Thomas Weißschuh
The gcs plugin uses the google cloud module and can't work without it.
Skip the test if the module is unavailable.
Signed-off-by: Thomas Weißschuh <thomas(a)t-8ch.de>
---
tests/test-gcs.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/test-gcs.sh b/tests/test-gcs.sh
index ed823377dc5a..9b165e8159be 100755
--- a/tests/test-gcs.sh
+++ b/tests/test-gcs.sh
@@ -40,6 +40,7 @@ requires $PYTHON --version
requires_nbdcopy
requires_plugin python
skip_if_valgrind "because Python code leaks memory"
+requires $PYTHON -c 'import google.cloud'
# Skip this test if the real google-cloud-storage module is installed,
# since that module abuses pth files to insert itself into the module
base-commit: ffa62d30fe6dcd29ae8e20df5c86d48505550614
--
2.44.0
6 months, 3 weeks
[PATCH libguestfs] test-data/binaries: Regenerate LoongArch files with stripping
by Richard W.M. Jones
These were regenerated by Dan Berrange from a known good Debian
container image. In addition they are stripped. The commands were:
$ podman run -it registry.gitlab.com/qemu-project/qemu/qemu/debian-loongarch-cross
# echo 'int main(){}' > bin.c
# loongarch64-unknown-linux-gnu-gcc bin.c -o bin-loongarch64
# loongarch64-unknown-linux-gnu-strip --strip-all bin-loongarch64
# echo '' > lib.c
# loongarch64-unknown-linux-gnu-gcc -shared lib.c -o lib-loongarch64.so
# loongarch64-unknown-linux-gnu-strip --strip-all lib-loongarch64.so
Signed-off-by: Richard W.M. Jones <rjones(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
test-data/binaries/bin-loongarch64-dynamic | Bin 20352 -> 18392 bytes
test-data/binaries/lib-loongarch64.so | Bin 19320 -> 18064 bytes
2 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/test-data/binaries/bin-loongarch64-dynamic b/test-data/binaries/bin-loongarch64-dynamic
index 645a5744a8eea77df243e5268264c2e0dcba0afb..5795de300d8b46a038723f0e00da047cb10816d6 100644
GIT binary patch
delta 259
zcmXBPzbk}s00!{y^E$(I2IZC9ax#d)<uKfEdERfz-TTudWHsn!saxc&vnlcn$|9w#
zr<cw0hQ(m9$f8?hG?^8j|KM|QfwyCvOpk3?^Jm!@<C(fC8qbu?_zi20yEl1xUHbVv
zJ1jqR2G{$~JKLLgS=V`N;5+j<ilJt*HZxIMsLogCOs3{698*%>B1QzCn3DC0x>BE5
zRPGZ?LO`s@20RT4>IMyLDG!LY5E8qxA<<D968p+SqANtik!(bqD~*UN<q^>nV&Yyl
pCZ3eW#EbHncoh=jT{a;;lqMD34h*Z8xGJo=#kTjK{ZhYG`32xgP-*}G
delta 1856
zcmZ`(U1%It6#mXmHck3t{+n#8X{ry_VwR+lQlWD9Z+5eElazELT^~G|-JQhM{fRRZ
zNQ$@-gD6TBuc8Zu)+faWX^9Ua3Vra+f|RNxAR_cdics_BTV!TuYPuP}m$~!Z?|kQ;
zbI;7?`?PkIJ~%PBHVFrD01=!)Cn9(hM{kJnK>xjK7sdDWp36TUxqtSjuBSh~6Zw07
zV?FT0S=!u4ivb!;==qXX9T}epp9+tSKKqorlDFwtT>;@tplQAv3Idq-<rS>^@@@FS
zmk;7kU%nk33hKLaI#93=-EDhlDCoetFW-r4zWjdN^yLrW)1c?y?JevC2XQ?pdzFOJ
zg(VqPM$h$N<n{jq9u)NAgfHKRF<-tPkgqBO$^eG!r>rU`<(kq?L-MLJP;bNbj_2*6
z69DaM^@zLC2f$B13?P6*h_rhSP1tcZzuv-6xcqPJEmx3s5)b0yTGN1BqdAA)Tlj0P
z(KGv8p^LX2{oV$CzNdgEn-Tw4*;kHHH#TKd>GSQ?caCCv=lX+NZQ@slKaBHkDIV^+
z`qsPp%Mo;8sihSAatH$$TEj`t!@&WvH@0_%S`r*5U_{=gzTk5N^xCV(ULc?whadFS
zgXSsf1_3>I1Z6k9H@j~*k%O3T$?~opi9`6qEqmUze9P5)H|XI*SD$hHy^;FFJ}n^c
zP*3m%0gubu)L*|)Fs$)#4a{1;#Fn;*f?=7~^1?#6fTC{bizU<24Yn#=DA%gG3Fcyr
z7t6K0R_3BrGfdW&S5T-`mdd)N7sF%z3SKBxORO1&w#s_dGFGu*XqCFo#pOz670mXl
z`^Kee$$Cg@>82GffH^rEol;qyPB4Sd&(6fv#N4dPne_CzXiDX5G?r1>K7m=|m$YiJ
ztb-G|>F88C4(8PK9IKPA$z);{$C<NJanCQ6nTbU+Jd;dbP_wR=%(M;Hxm?N@*t9gm
z;)+(PMpBt{EY7FG6Q{v?QL{8?`I=!p#HVN2w2GxFFPnN1tXGR*&YNb_2euD5ot<K@
z$=Rv6-Quj4w@=N570qs%RxS-+(sw%}Y_3);EswBi8J3pccsVjkbW}E?f}W6DQ9-9=
zC?;r9=3;^pvJn$BEw^HVo|mDxpciE>F6b56hzq(Tx8j1<Whf!&9hplAx-1(BK_AJj
zgrF-jqzd{{=2Ssn%Z4iGrrc5m-IAfCpkHJzDd>0END8_uw~~VH$xuqreVI!gqha}(
z(kI_bbyL9pGDcS-%?XXTb9@BAD1Z)kaEIKd{YzBri2dKFP3lLI-$sXnJ>Ev=o2ll;
LKTe8U(S!d2$&g3}
diff --git a/test-data/binaries/lib-loongarch64.so b/test-data/binaries/lib-loongarch64.so
index 92ba696580b3943bd6e4dad11d25b4acb18c8737..45dbdc1e2bb48612b174d20975543921336c0ccd 100644
GIT binary patch
delta 1250
zcmZ`(T}V@L6hHraH$QUdbcHU(xjp1oa@o{ud)d94>`Tm6lw?8^B}|ZsNs<q#qt^<@
z0l|WZUJA*Ogh1$Hz6;??^bpir^fY@2lAy)^?i^V`=jC_L{h#wY=luR3KUc-dJ+b0d
z?2-J*zNNGkOk)J2><a*>0stdi_K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ai>J8y6E>WRYIa_u;w`d<~UqZ%IC<&)t
zcb0`)_3FzsS9dC|C@xki%Or%75~XU%yRB%sl(!2c#Mt!kWL9LSMui|T`oh%k<irRG
zF*7-WOi^sq#DY^T$|w)dO`jOaj-H;*irmE1v%}+AF*AHDmlY(&b0>}s=fsJzu~XTZ
zIQRD04`Bd__CX@<5?X@n#&X4T@?<x>dSn;yuUhk5d%n78=NC)m;=xjp!qkG(SRlK&
zTx~2@BJ0)3uDfMNX7azYWshvnUGm6w7oyoBdt;)=-k9I84yRHokUd}XBISI|BfC*_
zJcsOjqd|6|R;jpE58LWLBhO`dmhrI}f5#D51#whB;xj;pIgSPNIIm%kun;<&lStb{
z^ji?rpvU<Ri+cgeLl1_C!m}NEod2*s7eu@b=y5K~a5VC$gdX<^Slk}~zGvV#$D@HB
z_W@Yk2a^3q`_rsH#uegz0gG}{FTcgf{+|iICs7O@3BEV5$+H`AZD3zY=n)qNwmUIk
zj05CZkMSdZ3~aJ|GF|3z;a-IMBI4~}yZ~v~B_i6*Ybe2e@&d;dLOFmm?0KF$w2$vT
z;u0bL5bm4MVgBCY@k5XMB;p)l{Q&f^7ZZA%3w<0XDH$6FI@suZi}tVt_qid~qZ~-4
zFY%s2{}In8(?Oru4)g){Ke^AKe*_IP(5n`EM`f1V$9o{}<MLaC{$pO{JsW*j**Y4f
VGH8fNB&oN9{y4|Ux&mPb{oihP(+~gv
--
2.44.0
7 months
[PATCH libguestfs] test-data/binaries: Remove +x attribute
by Richard W.M. Jones
These binaries are not meant to be run, they are purely data files
used for testing. Remove the +x attribute to prevent accidentally
running them.
However to avoid breaking the phony guests, we need to chmod +x the
files when we upload them into those guests.
---
test-data/binaries/bin-aarch64-dynamic | Bin
test-data/binaries/bin-armv7-dynamic | Bin
test-data/binaries/bin-i586-dynamic | Bin
test-data/binaries/bin-ia64-dynamic | Bin
test-data/binaries/bin-mipsel-dynamic | Bin
test-data/binaries/bin-ppc64-dynamic | Bin
test-data/binaries/bin-ppc64le-dynamic | Bin
test-data/binaries/bin-riscv64-dynamic | Bin
test-data/binaries/bin-s390x-dynamic | Bin
test-data/binaries/bin-sparc-dynamic | Bin
test-data/binaries/bin-win32.exe | Bin
test-data/binaries/bin-win64.exe | Bin
test-data/binaries/bin-x86_64-dynamic | Bin
test-data/binaries/lib-aarch64.so | Bin
test-data/binaries/lib-armv7.so | Bin
test-data/binaries/lib-i586.so | Bin
test-data/binaries/lib-ia64.so | Bin
test-data/binaries/lib-mipsel.so | Bin
test-data/binaries/lib-ppc64.so | Bin
test-data/binaries/lib-ppc64le.so | Bin
test-data/binaries/lib-riscv64.so | Bin
test-data/binaries/lib-s390x.so | Bin
test-data/binaries/lib-sparc.so | Bin
test-data/binaries/lib-win32.dll | Bin
test-data/binaries/lib-win64.dll | Bin
test-data/binaries/lib-x86_64.so | Bin
test-data/phony-guests/make-archlinux-img.sh | 1 +
test-data/phony-guests/make-debian-img.sh | 1 +
test-data/phony-guests/make-fedora-img.pl | 1 +
test-data/phony-guests/make-ubuntu-img.sh | 1 +
30 files changed, 4 insertions(+)
diff --git a/test-data/binaries/bin-aarch64-dynamic b/test-data/binaries/bin-aarch64-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-armv7-dynamic b/test-data/binaries/bin-armv7-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-i586-dynamic b/test-data/binaries/bin-i586-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-ia64-dynamic b/test-data/binaries/bin-ia64-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-mipsel-dynamic b/test-data/binaries/bin-mipsel-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-ppc64-dynamic b/test-data/binaries/bin-ppc64-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-ppc64le-dynamic b/test-data/binaries/bin-ppc64le-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-riscv64-dynamic b/test-data/binaries/bin-riscv64-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-s390x-dynamic b/test-data/binaries/bin-s390x-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-sparc-dynamic b/test-data/binaries/bin-sparc-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-win32.exe b/test-data/binaries/bin-win32.exe
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-win64.exe b/test-data/binaries/bin-win64.exe
old mode 100755
new mode 100644
diff --git a/test-data/binaries/bin-x86_64-dynamic b/test-data/binaries/bin-x86_64-dynamic
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-aarch64.so b/test-data/binaries/lib-aarch64.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-armv7.so b/test-data/binaries/lib-armv7.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-i586.so b/test-data/binaries/lib-i586.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-ia64.so b/test-data/binaries/lib-ia64.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-mipsel.so b/test-data/binaries/lib-mipsel.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-ppc64.so b/test-data/binaries/lib-ppc64.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-ppc64le.so b/test-data/binaries/lib-ppc64le.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-riscv64.so b/test-data/binaries/lib-riscv64.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-s390x.so b/test-data/binaries/lib-s390x.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-sparc.so b/test-data/binaries/lib-sparc.so
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-win32.dll b/test-data/binaries/lib-win32.dll
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-win64.dll b/test-data/binaries/lib-win64.dll
old mode 100755
new mode 100644
diff --git a/test-data/binaries/lib-x86_64.so b/test-data/binaries/lib-x86_64.so
old mode 100755
new mode 100644
diff --git a/test-data/phony-guests/make-archlinux-img.sh b/test-data/phony-guests/make-archlinux-img.sh
index 066df09d57..e0e3d3de7d 100755
--- a/test-data/phony-guests/make-archlinux-img.sh
+++ b/test-data/phony-guests/make-archlinux-img.sh
@@ -50,6 +50,7 @@ write /etc/hostname "archlinux.test"
upload $SRCDIR/archlinux-package /var/lib/pacman/local/test-package-1:0.1-1/desc
upload $SRCDIR/../binaries/bin-x86_64-dynamic /bin/ls
+chmod 0755 /bin/ls
mkdir /boot/grub
touch /boot/grub/grub.conf
diff --git a/test-data/phony-guests/make-debian-img.sh b/test-data/phony-guests/make-debian-img.sh
index 637bd4bc88..27c68e6ece 100755
--- a/test-data/phony-guests/make-debian-img.sh
+++ b/test-data/phony-guests/make-debian-img.sh
@@ -85,6 +85,7 @@ write /etc/hostname "debian.invalid"
upload $SRCDIR/debian-packages /var/lib/dpkg/status
upload $SRCDIR/../binaries/bin-x86_64-dynamic /bin/ls
+chmod 0755 /bin/ls
upload $SRCDIR/debian-syslog /var/log/syslog
diff --git a/test-data/phony-guests/make-fedora-img.pl b/test-data/phony-guests/make-fedora-img.pl
index 6362e225b3..b7dc902e2b 100755
--- a/test-data/phony-guests/make-fedora-img.pl
+++ b/test-data/phony-guests/make-fedora-img.pl
@@ -331,6 +331,7 @@ $g->write ('/usr/lib/rpm/macros', <<EOF);
EOF
$g->upload ($ENV{SRCDIR}.'/../binaries/bin-x86_64-dynamic', '/bin/ls');
+$g->chmod (0755, '/bin/ls');
$g->tar_in ($ENV{SRCDIR}.'/fedora-journal.tar.xz', '/var/log/journal', compress => "xz");
diff --git a/test-data/phony-guests/make-ubuntu-img.sh b/test-data/phony-guests/make-ubuntu-img.sh
index a3aa61050c..5e7a3a9686 100755
--- a/test-data/phony-guests/make-ubuntu-img.sh
+++ b/test-data/phony-guests/make-ubuntu-img.sh
@@ -76,6 +76,7 @@ write /etc/hostname "ubuntu.invalid"
upload $SRCDIR/debian-packages /var/lib/dpkg/status
upload $SRCDIR/../binaries/bin-x86_64-dynamic /bin/ls
+chmod 0755 /bin/ls
mkdir /boot/grub
touch /boot/grub/grub.conf
--
2.44.0
7 months
[PATCH nbdkit v2 1/2] server: Reserve more characters from plugin/filter short names
by Richard W.M. Jones
The plugin/filter short name detection is very liberal, reserving only
'.' and '/'. Thus, at least in theory, short plugin names containing
almost arbitrary symbols and characters are permitted.
Backslash ought to have been reserved when we added Windows support.
We should probably reserve more characters, but in this commit I only
reserve:
* backslash (ie. directory separator on Windows)
* ':' and ';' (common path separators)
* '=' (used in nbdkit parameters)
* space and comma (commonly used to separate lists)
* non-printable ASCII characters
Also DIR_SEPARATOR_STR, but that's likely to be already covered by the
other tests so probably does nothing here.
This commit is mainly about tightening up corner cases with possible
security implications, for example if you managed to trick a program
to invoke 'nbdkit "plugin param"' that might have an ambiguous parsing
that you could use to your advantage. It should have no effect on
normal, non-adversarial usage.
---
server/options.h | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/server/options.h b/server/options.h
index 7d0730bae7..8b1bd679e9 100644
--- a/server/options.h
+++ b/server/options.h
@@ -117,7 +117,23 @@ static const struct option long_options[] = {
static inline bool
is_short_name (const char *filename)
{
- return strchr (filename, '.') == NULL && strchr (filename, '/') == NULL;
+ const size_t n = strlen (filename);
+ size_t i;
+
+ for (i = 0; i < n; ++i) {
+ switch (filename[i]) {
+ case '\0'...31: case 127: /* non-printable ASCII */
+ case '/': case '\\': /* directory separators */
+ case ':': case ';': /* path separators */
+ case ' ':
+ case '.':
+ case ',':
+ case '=':
+ return false;
+ }
+ }
+
+ return strstr (filename, DIR_SEPARATOR_STR) == NULL;
}
#endif /* NBDKIT_OPTIONS_H */
--
2.44.0
7 months
[PATCH nbdkit 1/2] server: Reject more characters in plugin/filter short names
by Richard W.M. Jones
The plugin/filter short name detection is very liberal, disallowing
only '.' and '/'. Thus, at least in theory, short plugin names
containing almost arbitrary symbols and characters are permitted.
We should probably reserve more characters, but in this commit I only
reserve:
* backslash (ie. dir separator on Windows)
* ':' and ';' (common path separators)
* space
* non-printable ASCII characters
Also DIR_SEPARATOR_STR, but that's likely to be already covered by the
other tests so probably does nothing here.
This commit is mainly about tightening up corner cases with possible
security implications, for example if you managed to trick a program
to invoke 'nbdkit "plugin param"' that might have an ambiguous parsing
that you could use to your advantage. It should have no effect on
normal, non-adversarial usage.
---
server/options.h | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/server/options.h b/server/options.h
index 7d0730bae7..55e6abc28c 100644
--- a/server/options.h
+++ b/server/options.h
@@ -117,7 +117,21 @@ static const struct option long_options[] = {
static inline bool
is_short_name (const char *filename)
{
- return strchr (filename, '.') == NULL && strchr (filename, '/') == NULL;
+ const size_t n = strlen (filename);
+ size_t i;
+
+ for (i = 0; i < n; ++i) {
+ switch (filename[i]) {
+ case '\0'...31: case 127: /* non-printable ASCII */
+ case ' ':
+ case '.':
+ case '/': case '\\': /* directory separators */
+ case ':': case ';': /* path separators */
+ return false;
+ }
+ }
+
+ return strstr (filename, DIR_SEPARATOR_STR) == NULL;
}
#endif /* NBDKIT_OPTIONS_H */
--
2.44.0
7 months