0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00
Commit Graph

4698 Commits

Author SHA1 Message Date
Maria Matejka
deb303a451 NEWS and version update 2023-05-11 11:41:01 +02:00
Maria Matejka
92d934f0d1 Fix use-after free in thread stopping code 2023-05-11 11:41:01 +02:00
Maria Matejka
794f555f63 BGP: fix listen socket cleanup 2023-05-11 11:41:01 +02:00
Maria Matejka
2623b7ba5d ID Maps are checking whether their pool is locked 2023-05-11 11:41:01 +02:00
Maria Matejka
fcbf22d1f6 Properly protecting the route src global index by RCU read lock and atomic operations
There was a bug occuring when one thread sought for a src by its global id
and another one was allocating another src with such an ID that it caused
route src global index reallocation. This brief moment of inconsistency
led to a rare use-after-free of the old global index block.
2023-05-11 11:41:01 +02:00
Maria Matejka
b36d284788 Threads take loops faster 2023-05-11 11:41:01 +02:00
Maria Matejka
a818a3011e Channel: configurable feed block size 2023-05-11 11:41:01 +02:00
Maria Matejka
bb28b16fd6 BGP: proactively rehash prefix hash up to shorten collision lists 2023-05-11 11:41:01 +02:00
Maria Matejka
318ac8720f OLocks in BGP must be freed early 2023-05-09 10:33:23 +02:00
Maria Matejka
cb51ff1fbb IO Loop / Thread Groups Lock moved to level -attrs- to allow for page allocation while locked 2023-05-07 16:59:19 +02:00
Maria Matejka
62432affd9 Fixed loop movement to not collide on LTT_MOVE 2023-05-07 16:58:56 +02:00
Maria Matejka
e0c09e6bee Fix loop dropping routines 2023-05-07 16:58:52 +02:00
Maria Matejka
a95141111c Fixed a bug in hot page global storage
The original algorithm was suffering from an ABA race condition:

A: fp = page_stack
B: completely allocates the same page and writes into it some data
A: unsuspecting, loads (invalid) next = fp->next
B: finishes working with the page and returns it back to page_stack
A: compare-exchange page_stack: fp => next succeeds and writes garbage
to page_stack

Fixed this by using an implicit spinlock in hot page allocator.
2023-05-06 10:50:32 +02:00
Maria Matejka
00f30ac40b Debug: keep a circular log of memory page operations 2023-05-06 10:50:32 +02:00
Maria Matejka
1e998a4349 Fixed cold page cache leak
The empty_pages pointer wasn't being propagated into the ->next pointer
when more empty_pages were to be stored
2023-05-06 10:50:31 +02:00
Maria Matejka
ed91d884d3 Hostentry: fix pool locking 2023-05-06 10:50:31 +02:00
Maria Matejka
7d8e541057 Linpool state save and restore refactoring 2023-05-06 10:50:31 +02:00
Maria Matejka
b21909c6ee Debug: Explicit mprotect() on freed pages to better locate use-after-free bugs 2023-05-06 10:50:31 +02:00
Maria Matejka
fac6405669 Page allocator: indentation of messy ifdef blocks 2023-05-06 10:50:31 +02:00
Maria Matejka
fa973c2c15 First try of loop balancing
If a thread encounters timeout == 0 for poll, it considers itself
"busy" and with some hysteresis it tries to drop loops for others to
pick and thus better distribute work between threads.
2023-05-06 10:50:26 +02:00
Maria Matejka
9f25dd79b8 Allocation from linpools and slabs requires the appropriate lock to be taken 2023-05-03 21:30:29 +02:00
Maria Matejka
010c26c296 Linpool flushes unused pages even on lp_restore() 2023-05-03 21:30:29 +02:00
Maria Matejka
91471531a1 Fixed race condition in hostentry allocation 2023-05-03 21:30:29 +02:00
Maria Matejka
9bc5cbd3c7 Show threads: Fixed problems with CLI buffer reallocation
... by allocating all the output locally and then sending it out at
once.
2023-05-03 21:30:29 +02:00
Maria Matejka
8bc27583ff Explicitly counting loops and threads 2023-05-03 21:30:29 +02:00
Maria Matejka
9c22310612 Loop spent time refactored to separate structures and functions 2023-05-03 21:30:29 +02:00
Ondrej Zajicek
aa3c35498d BMP: Use OPEN messages stored in BGP
The BMP protocol needs OPEN messages of established BGP sessions to
construct appropriate Peer Up messages. Instead of saving them internally
we use OPEN messages stored in BGP instances. This allows BMP instances
to be restarted or enabled later.

Because of this change, we can simplify BMP data structures. No need to
keep track of BGP sessions when we are not started. We have to iterate
over all (established) BGP sessions when the BMP session is established.
This is just a scaffolding now, but some kind of iteration would be
necessary anyway.

Also, the commit cleans up handling of msg/msg_length arguments to be
body/body_length consistently in both rx/tx and peer_up/peer_down calls.
2023-05-01 04:01:16 +02:00
Ondrej Zajicek
1be0be1b71 BGP: Save sent and received OPEN messages
These are necessary for BMP Peer UP message and it is better to keep them
in BGP than in BMP (so BMP could be restarted or added later).
2023-05-01 04:01:16 +02:00
Ondrej Zajicek
a8a64ca0fe Conf: Improve handling of keywords
For whatever reason, parser allocated a symbol for every parsed keyword
in each scope. That wasted time and memory. The effect is worsened with
recent changes allowing local scopes, so keywords often promote soft
scopes (with no symbols) to real scopes.

Do not allocate a symbol for a keyword. Take care of keywords that could
be promoted to symbols (kw_sym) and do it explicitly.
2023-04-27 18:41:01 +02:00
Ondrej Zajicek
9b471e72d7 Conf: Fix symbol lookup
The symbol table used just symbol name as a key, and used a trick with
active flag to find symbols in active scopes with one hash table lookup.

The disadvantage is that it can degenerate to O(n) for negative queries
in situations where are many symbols with the same name in different
scopes.

Thanks to Yanko Kaneti for the bugreport.
2023-04-27 17:09:00 +02:00
Maria Matejka
ab83bab9d1 Loops track also locking time 2023-04-26 19:34:29 +02:00
Maria Matejka
2ddb34c9d1 IO loops now actually measuring their time (show threads all works) 2023-04-26 19:10:52 +02:00
Maria Matejka
ce7495b49a Refactoring of domains connected to pools 2023-04-25 09:52:28 +02:00
Maria Matejka
19e79eb8ad Fix of failing show threads command 2023-04-24 11:35:05 +02:00
Maria Matejka
db2b67268c Merge commit 'd61505b039bf0aa6697e28b2a4e07907c89ba1fb' into thread-next 2023-04-24 10:40:53 +02:00
Maria Matejka
fa8848aca3 Merge branch 'mq-resource-locking' into thread-next 2023-04-24 10:39:13 +02:00
Maria Matejka
942d3cbcdd Removed duplicate version 3.0-alpha0 news 2023-04-24 10:39:08 +02:00
Maria Matejka
22f54eaee6 Resource pools are now bound with domains.
Memory allocation is a fragile part of BIRD and we need checking that
everybody is using the resource pools in an appropriate way. To assure
this, all the resource pools are associated with locking domains and
every resource manipulation is thoroughly checked whether the
appropriate locking domain is locked.

With transitive resource manipulation like resource dumping or mass free
operations, domains are locked and unlocked on the go, thus we require
pool domains to have higher order than their parent to allow for this
transitive operations.

Adding pool locking revealed some cases of insecure memory manipulation
and this commit fixes that as well.
2023-04-24 10:33:28 +02:00
Maria Matejka
6230d87c74 Protocols and tables now use the birdloop pools as primary 2023-04-22 21:20:19 +02:00
Maria Matejka
1141ce4e2d Resource pool closing has its dedicated function 2023-04-22 20:49:58 +02:00
Maria Matejka
b3f805ce29 Socket closing has its dedicated function 2023-04-22 20:48:42 +02:00
Maria Matejka
074739e0e9 Global protocol list is typed to avoid typecast confusion 2023-04-22 20:48:42 +02:00
Maria Matejka
48dfcb60d6 Typed lists: added add_after() and unit tests 2023-04-22 20:48:42 +02:00
Ondrej Zajicek
ca0f239c72 NEWS and version update 2023-04-21 20:26:47 +02:00
Ondrej Zajicek
1a1e13cc2f Filter: Disable some trie formatting tests
Trie formatting works slightly different with 4-way tries than with
16-way ones, so these tests generated false error. Block them for now.
2023-04-21 19:31:16 +02:00
Ondrej Filip
2c809894dc Alpha0 news added 2023-04-21 09:08:54 +02:00
Ondrej Zajicek
52450bc96d Merge branch 'bmp' 2023-04-21 04:47:55 +02:00
Ondrej Zajicek
f3b599afe5 BMP: Add some basic documentation 2023-04-21 04:42:13 +02:00
Luiz Amaral
d61505b039 BSD: IPv4 over IPv6 nexthop support on FreeBSD
The support for IPv4 routes with IPv6 nexthops was implemented in FreeBSD
13.1, this patch allows to import and export such routes from/to kernel.

Minor change from committer.
2023-04-21 02:03:31 +02:00
Maria Matejka
335409248e Linpool: Fix lp_restore()
When lp_save() is called on an empty linpool, then some allocation is
done, then lp_restore() is called, the linpool is restored but the used
chunks are inaccessible. Fix it.
2023-04-20 19:33:00 +02:00