View Issue Details

IDProjectCategoryView StatusLast Update
0006365unrealircdpublic2023-11-13 09:51
Reportersyzop Assigned Tosyzop  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version6.1.2.3 
Target Version6.1.3-rc1Fixed in Version6.1.3-rc1 
Summary0006365: Not recompiling third party modules when running git version (and recompiling unrealircd)
DescriptionSometimes include files get changed, for example include/struct.h is changed like the user struct getting a new member or the like. It seems when you run "make" and "make install" the 3rd party modules do not get recompiled. This can be rather dangerous because the 3rd party modules would be accessing structs and things like that with the old struct / old memory layout in mind (and old functions etc). This can easily lead up to a crash. Even worse: it may take a while to crash and corrupt memory silently.. then ultimately crashing with no clear reason.

This is because we don't have a Makefile rule for src/modules/third/*.so since these are handled by a custom step in the Makefile (the buildmod script). Therefore it does not detect that the modules need to be recompiled because a .h file is newer than the .so file.

This is mostly an issue when running 'git' and forgetting to do 'make clean'. For normal upgrades this is no issue because we do 'make clean' from './Config'.
Additional InformationI'm tagging this as "major", not because it affects many users but because of the potential effects.

That being said, when running git it is easy to make a mistake anyway, like thinking you can REHASH after a "git pull". Which can result in the exact memory corruption and issues. We don't detect that case.
TagsNo tags attached.
3rd party modules

Activities

syzop

2023-11-13 09:26

administrator   ~0023085

This is caused by Makefile using the src/buildmod script, the script is there so we can upgrade modules (get latest version), can have 'make' fail silently and I think the idea was that we could possible support things like linking with specific libraries on a per-module basis, but that never got implemented.

syzop

2023-11-13 09:37

administrator   ~0023086

An alternative would be to use the wildcard rules, like we do for *.so in src/modules/Makefile.in, then the make system can properly track .h dependencies and the like.
Before that, we must run module upgrade. And then, for each file (so the wildcard rule), instead of $(CC) we call src/buildmod for each module if we still want that library idea implemented someday, otherwise $CC directly like the rest of UnrealIRCd.

syzop

2023-11-13 09:41

administrator   ~0023087

Last edited: 2023-11-13 09:46

Oh now I remember, we could have that %.so rule but not have it in like the build: rule, some chicken-and-egg-problem.

Ah well I am going for my quick fix which causes 3rd party modules to be compiled always in 'make' and again in 'make install' (the latter is unintended).
Can look for something better later, I want to work on other stuff now ;D

https://github.com/unrealircd/unrealircd/commit/8e450bb7fc5f3dcb69dfccd7f4131483df57f325

Commit 8e450bb7fc5f3dcb69dfccd7f4131483df57f325 (HEAD -> unreal60_dev, origin/unreal60_dev, origin/HEAD)
Author: Bram Matthys <[email protected]>
Date: Mon Nov 13 09:41:25 2023 +0100

    Fix not recompiling third party modules when running git version 'git pull'
    This is a quick fix for https://bugs.unrealircd.org/view.php?id=6365
    The quick fix which causes 3rd party modules to be compiled always in
    'make' and again in 'make install' (the latter is unintended).
    Can look for something better later, I want to work on other stuff now ;D

syzop

2023-11-13 09:51

administrator   ~0023088

Fixed completely now.

https://github.com/unrealircd/unrealircd/commit/5b6617406e9c49620dc26b4858d12e5988555e39

commit 5b6617406e9c49620dc26b4858d12e5988555e39 (HEAD -> unreal60_dev, origin/unreal60_dev, origin/HEAD)
Author: Bram Matthys <[email protected]>
Date: Mon Nov 13 09:49:04 2023 +0100

    Actually completely fix 0006365, replaces previous temporary fix.
    Nevermind, the solution to that problem was easy, can just
    compare with the 'ircd' binary and in that way, leverage the
    Makefile system decisions :D
    https://bugs.unrealircd.org/view.php?id=6365

Issue History

Date Modified Username Field Change
2023-11-13 09:23 syzop New Issue
2023-11-13 09:26 syzop Note Added: 0023085
2023-11-13 09:37 syzop Note Added: 0023086
2023-11-13 09:41 syzop Note Added: 0023087
2023-11-13 09:46 syzop Note Edited: 0023087
2023-11-13 09:46 syzop Note Edited: 0023087
2023-11-13 09:51 syzop Assigned To => syzop
2023-11-13 09:51 syzop Status new => resolved
2023-11-13 09:51 syzop Resolution open => fixed
2023-11-13 09:51 syzop Fixed in Version => 6.1.3-rc1
2023-11-13 09:51 syzop Note Added: 0023088