Commit graph

211 commits

Author SHA1 Message Date
Caolán McNamara
d078354eb7 cid#318955 Uninitialized scalar field
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2df245ffa6bf45536ebe4383033dcdd87f280bc2
2023-07-05 14:49:59 +02:00
Caolán McNamara
08f28aa8af cid#318956 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id2902a510e61c9ecf00f416908aa2a66f76547c0
2023-06-26 07:08:46 -04:00
Ashod Nakashian
9efc81a51b wsd: random device mounting
We now warn when we fail to use mknod
to create the random devices and have
stricter requirements to mounting
character-devices. Specifically,
we explicitly only allow mounting
the random devices.

Change-Id: Ib0dc300dedc40942ea52426af2b267f6a81fbeb8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-23 18:13:59 +02:00
Caolán McNamara
c617e14d67 cid#318956 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifcd6984042b50999a24f65479bc81428f710d38a
2023-06-21 08:40:21 +02:00
Ashod Nakashian
67c5dbb5de mount: support mounting from character device
And improve error reporting.

Change-Id: I28b5c21e1bc4f20fccd6d7f1dfca0240b91e71fd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00
Caolán McNamara
a5c000fa35 cid#318941 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I256c1f61ed997615e3277817ba60db4971783dab
2023-06-14 10:10:46 +02:00
Caolán McNamara
13ed88a547 cid#318930 Resource leak
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I12cdbe749b2f46422f329e9da39427ede7feb436
2023-06-14 10:10:46 +02:00
Ashod Nakashian
ff1657934a wsd: simplify log streaming
Change-Id: Id22de0bc06680f957e7475f142bcaf1131fdbdb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Michael Meeks
7987af35c4 coolmap: accelerate handling large ascii strings without \0 termination.
Change-Id: I6831f455da038a20eb611fbbb0902dc495dc31d7
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-03-10 17:08:59 +00:00
Ashod Nakashian
9c39ebad1f wsd: string::empty() is clearer than size() == 0
Change-Id: If2e25d344b5718c35cb9ae7b7519010ee88f0f60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-10 07:45:12 -05:00
Ashod Nakashian
0c6413bf87 wsd: fix multi-part logging
This was a regression introduced in
14d96957cd.

The result was that multi-part logs were
not flushed and therefore not written to
the output.

Change-Id: Ib22a1da83209b00872d91ca05a940226cbb4552d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-09-13 09:45:43 +02:00
Michael Meeks
0ff45bd461 coolstress: remove redundant load.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I2656fb58a0fb9ce566a47656b2080a07d980869d
2022-09-01 13:33:20 +01:00
Ashod Nakashian
4e9b836ea6 wsd: always use Util::forcedExit to properly cleanup
We need to flush and shutdown logging before exiting,
so we can't use _exit/_Exit directly.

In addition, with profiling (e.g. code-coverage) we
must flush the profile data, lest it's all for naught.

Change-Id: I726c5a2f4e699c17dd0d7d5b1c86d856e0118b3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 07:51:52 -04:00
Ashod Nakashian
e3deda303b wsd: fix warnings on GCC 12
Change-Id: Ia61f45d83223a65d1f7c444250230006a4ac098f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-13 09:37:07 +01:00
Michael Meeks
a5aeac6eeb stress: dump connection count.
Change-Id: I3a1a4202d8f3cbabaf46794fa1c3452af1470016
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-10 10:10:05 +01:00
Michael Meeks
fe5100183c reply: record more statistics.
Count data sent as well as received, re-factor, and measure B/W
usage too.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I5d00f0568c774cc03d2b8e4f730bfe4a8fb5b06f
2022-06-08 09:18:05 +01:00
Michael Meeks
55a47214d1 stress: account for the size of each message.
Change-Id: Ie94add7197672106a2c0684405a1b15c307470e4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-06 09:58:15 +01:00
Ashod Nakashian
14d96957cd wsd: log macro cleanup
* Simplify log macros.
* Reduce expanded lines (faster compilation).
* Avoid flushing (since we always use ostringstream).

Change-Id: Id10c1a75b5af5d8cdba62d768192ab0a6a9e0aca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-26 11:13:44 +03:00
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Michael Meeks
6548759fde replay: re-connect after a timeout for various errors.
Change-Id: I06cb01a0ab826b5723e634bb03e1bca6d99c4db2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-03-04 10:06:33 +00:00
Michael Meeks
019913666d Replay: log which client a message is from / for; and improve errors.
Change-Id: Id9e7d9680a0c33d79c8f691222829406754eaf94
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-03-03 09:04:06 +00:00
Michael Meeks
0678082db4 Detect trace replay errors & exit and cleanup traces.
Change-Id: I15c04eb9eef02f3f6002c35dc5701b7dbe9a1398
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-02-21 15:37:05 +00:00
Gleb Popov
34574724b4 Teach coolmount to mount devfs on FreeBSD.
Use it to create /dev/{u}random devices instead of calling mknod().

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I6ae7842c89255f3f43a8ac7f082a275d5496690a
2022-02-21 10:20:01 +01:00
Michael Meeks
60b76efe82 Count bandwidth use during stress testing.
Change-Id: I48e1540795f0992833d4c4365d4a9d0da7a48442
2022-02-15 19:44:08 +00:00
Miklos Vajna
8e2829fee7 tools: fix -Werror,-Wfortify-source
'sscanf' may overflow; destination buffer in 'smap_key' has size 20, but
the corresponding specifier in tools/map.cpp:570 may require size 21.

Change-Id: Ie7356db924193777869a39b882512a864c0e10c5
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-24 12:33:23 +01:00
Aron Budea
2faa5459ce coolconfig: migrate missing entries in special cases
Also fix ssl.hpkp.pins.pin handling.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I48ffe3db9ec0ff2db53f5e8cac5ec3d7aa55e66c
2022-01-17 10:16:06 +01:00
Andras Timar
e543581887 coolconfig: allow set command to create new config settings
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I1efcca7a773df366a2cca1d56f1d6fb967402deb
2022-01-17 07:00:58 +01:00
Aron Budea
3ec29a474e coolconfig: Updated "host" entry handling in migration tool
- new method for migrating "host" entries:
  only done if there are new entries in the old config,
  and then replace the list in the new config with the old one

- other small changes, eg.
  don't migrate special default values if they match target value

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Idf43db4068c163077109825486855a259666181c
2022-01-12 09:49:43 +01:00
Aron Budea
c6155a3513 coolconfig: Add config migration tool
Usage:
coolconfig migrateconfig [--old-config-file=<path>]
  [--config-file=<path>] [--write]

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I44e16bd07588887e01732b430e4c6e368a034cd1
2022-01-10 20:11:26 +01:00
Gleb Popov
a169580d53 Actually pass freebsd_flags variable to nmount() call.
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I5149b30e8dc6c2ed13c964f8bcf44399565c4f66
2021-12-09 15:24:47 +01:00
Miklos Vajna
dcfe16eec1 coolconvert: fix stack-use-after-scope
The vector is allocated on the stack in a for loop, so it's not valid to
refer to its address in the lambda that is executed on a thread. Rather
copy it.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ie1f85d6efb27a4aa44b181f8d9f134e9fa41d508
2021-11-19 12:41:28 +01:00
Andras Timar
f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Andras Timar
504c05df3b rename: loolwsd-systemplate-setup -> coolwsd-systemplate-setup
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I699db87f94f9080909c2ca783e04ad8b4dd98025
2021-11-17 22:10:58 +01:00
Mert Tumer
b59fbe8d4c rename: loolmap -> coolmap
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I3136305d5733c5c7a886baa230fd4c1e1401b734
2021-11-17 21:51:05 +01:00
Mert Tumer
c9a4d2f6f3 rename: loolmount -> coolmount
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ic025c5a76c6f27cdf1a6267f24cf8052733f1f24
2021-11-17 21:51:05 +01:00
Gleb Popov
fdfdd59097 loolmount: Mimic the Linux behavior of umount2() on FreeBSD.
On FreeBSD the mounting operations are allowed to be performed only by root
by default. When `loolwsd --cleanup` is called during normal compilation process,
it tries to unmount "jails" directory and spits EPERM-related errors.

Fix this by checking if the directory being unmounted is actually mounted and
return EINVAL in this case, just like Linux unmount2() does.

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I0f72d265e33fb1e6129332bfa8e17e7d888d30b5
2021-11-17 12:07:33 +01:00
Henry Castro
85ba63ddce misc: more renames 'lool' -> 'cool'
Change-Id: Ic9fbae88d92921b9081e7067347852e385f45af3
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:46 +01:00
Henry Castro
d4a69adf9e tools: rename 'lool' -> 'cool'
Change-Id: If567c65742df325d9999ea711ac642c07cd232c8
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:12 +01:00
Mert Tumer
78ccaa845e rename: loolconfig -> coolconfig
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ied23cb46a668f754931fc125745b674b546a0195
2021-11-15 22:07:53 +01:00
Luboš Luňák
897c5df270 make Socket use Buffer for input buffer too
SteamSocket::eraseFirstInputBytes() removes from the beginning
of std::vector, which is generally slow. If the buffer becomes
too big, which it may under a load, then the function will get
slow, which in turn will likely lead to the buffer getting even
bigger because of accumulated backlog.

The Buffer class is optimized for removal at the beginning,
so use it instead of std::vector, including some API additions
for it to be an in-place replacement where it's used.

Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: I4cf7ec56c908c7d3df391dc3f8e230ad32abb162
2021-10-26 12:11:58 +02:00
Michael Meeks
b043b6213d Move LOOLWebSocket into test/ - where it can be slowly removed.
Change-Id: I388690261d323377648a1502b927e73f862ad802
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-11 13:40:20 +01:00
Michael Meeks
a2055d2023 Move StressSocketHandler into Replay.hpp and share with wsd's fuzzing.
Change-Id: I01e0fd0b666651101055b1e78ec6c10e721d114b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-11 13:40:20 +01:00
Michael Meeks
4b200a11b5 stress: remove older code-paths and make the help helpful.
Change-Id: I3fe58c4e3e1a6b633fa4e94ba66db2d4bb465699
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-05 15:59:54 +01:00
Michael Meeks
fa3a975a59 stress: replay slowly when running under valgrind.
Change-Id: Iecd58e3929b3801e7ba7ce3ae171758d91f1037b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-02 21:24:15 +01:00
Michael Meeks
72f8f5d30e stress: store and dump some statistics.
Change-Id: Ied5eb12888b1466c155ecfd291785a95ea897db9
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-02 21:24:15 +01:00
Miklos Vajna
4b88948741 stress: dix disable-ssl build
test/test.cpp and wsd/Storage.cpp has the same pattern.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic1dfbd3a5368eb9831bde9d77ea1bb813834d42b
2021-10-01 09:50:38 +02:00
Michael Meeks
e5bbfc6397 stress: Initialize SSL
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I014d6a357f5d089f7c89f2d2441c5a30df5a0df4
2021-09-30 10:34:34 +01:00
Michael Meeks
2186a97b95 trace: re-write load url=<foo> to the requested file.
Change-Id: Ia446199ef97d2cdc6768af93a605bc8f67aef238
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-13 14:54:00 +01:00
Michael Meeks
61325af304 trace: finish when all traces are played.
Change-Id: Ib20169b54fcd5b8656470ed4cee89170c85ee7a0
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-13 14:54:00 +01:00
Michael Meeks
ac74ed5f91 trace: respond to tile: messages with tileprocessed:
Change-Id: Ie35b901e643172a05c2cf3a325d878f54cf6fff4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-13 14:54:00 +01:00