Skip to content

Commit

Permalink
[Actions] Patch the Linux workflows after GitHub runners update, disa…
Browse files Browse the repository at this point in the history
…ble one warning (#841)

* Use the develop branch for testing

* Update the multilib version, use venv for jsonref

* Bluetooth::UUID can be unitilized by design

* The warning supression has to take place elsewhere

* Test the bluetooth uuid changes in Thunder

* Try to use ::copy instead of ::memcpy

Looks like the compiler doesn't understand no array bound issues can happen in that case, but apparently the ::copy can help compiler to see that, let's try it out. Here is the error given with ::memcpy:

 [67/176] Building CXX object DHCPServer/CMakeFiles/ThunderDHCPServer.dir/DHCPServer.cpp.o
FAILED: DHCPServer/CMakeFiles/ThunderDHCPServer.dir/DHCPServer.cpp.o 
/usr/bin/c++ -DBLUEZ_HAS_NO_INCLUSIVE_LANGUAGE -DNO_INCLUSIVE_LANGUAGE -DPROCESSCONTAINERS_ENABLED=1 -DTHUNDER_PLATFORM_PC_UNIX=1 -DThunderDHCPServer_EXPORTS -DWARNING_REPORTING_ENABLED -D_TRACE_LEVEL=0 -D__CORE_BLUETOOTH_SUPPORT__ -D__CORE_MESSAGING__ -D__CORE_NO_WCHAR_SUPPORT__ -D__CORE_WARNING_REPORTING__ -isystem /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include/Thunder -isystem /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include -isystem /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include/Thunder/processcontainers -Wall -Wextra -Wpedantic -Werror -m64 -O3 -DNDEBUG -std=gnu++11 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT DHCPServer/CMakeFiles/ThunderDHCPServer.dir/DHCPServer.cpp.o -MF DHCPServer/CMakeFiles/ThunderDHCPServer.dir/DHCPServer.cpp.o.d -o DHCPServer/CMakeFiles/ThunderDHCPServer.dir/DHCPServer.cpp.o -c /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServer.cpp
In file included from /usr/include/string.h:548,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include/Thunder/core/Portability.h:406,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include/Thunder/core/Module.h:26,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include/Thunder/core/core.h:27,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include/Thunder/plugins/Module.h:26,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/Release/install/usr/include/Thunder/plugins/plugins.h:30,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/Module.h:26,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServerImplementation.h:23,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServer.h:22,
                 from /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServer.cpp:20:
In function ‘void* memcpy(void*, const void*, size_t)’,
    inlined from ‘Thunder::Plugin::DHCPServerImplementation::Identifier::Identifier(const uint8_t*, uint8_t)’ at /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServerImplementation.h:170:29,
    inlined from ‘Thunder::Plugin::DHCPServerImplementation::Identifier::Identifier(const uint8_t*, uint8_t)’ at /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServerImplementation.h:164:13,
    inlined from ‘Thunder::Plugin::DHCPServerImplementation::Lease Thunder::Plugin::DHCPServer::Data::Server::Lease::Get() const’ at /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServer.h:89:97,
    inlined from ‘void Thunder::Plugin::DHCPServer::LoadLeases(const string&, Thunder::Plugin::DHCPServerImplementation&)’ at /home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServer.cpp:242:63:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:33: error: ‘void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)’ forming offset 16 is out of the bounds [0, 16] of object ‘buffer’ with type ‘uint8_t [16]’ {aka ‘unsigned char [16]’} [-Werror=array-bounds=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServer.h: In member function ‘void Thunder::Plugin::DHCPServer::LoadLeases(const string&, Thunder::Plugin::DHCPServerImplementation&)’:
/home/runner/work/ThunderNanoServices/ThunderNanoServices/ThunderNanoServices/DHCPServer/DHCPServer.h:84:33: note: ‘buffer’ declared here
   84 |                         uint8_t buffer[DHCPServerImplementation::Identifier::maxLength];
      |                                 ^~~~~~
cc1plus: all warnings being treated as errors

* Bluetooth changes were already merged in Thunder, use the master workflow

* Adding std in front of ::copy

* Using std::copy instead of memcpy doesn't help the compiler

So it looks like we will have to disable this warning in this case

* Use the develop branch of Thunder to test the new macro

* Use the new macro to disable false positive array bound warnings

* Make sure to check out the develop branch to test the patches

* Use the macro on the whole constructor, but do not use it anywhere else since it seems not necessary

* Use the master branch of Thunder as the PR with macro was created

* Check out the master branch again as development is over
  • Loading branch information
VeithMetro authored Oct 17, 2024
1 parent a4903f9 commit b776da9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build ThunderNanoServices on Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:

ThunderNanoServices:
needs: ThunderInterfaces
uses: rdkcentral/ThunderNanoServices/.github/workflows/Linux build template.yml@master
uses: rdkcentral/ThunderNanoServices/.github/workflows/Linux build template.yml@development/actions-runners-update
9 changes: 6 additions & 3 deletions .github/workflows/Linux build template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
ThunderNanoServices:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
matrix:
Expand All @@ -28,8 +28,10 @@ jobs:
echo "deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev zlib1g-dev:i386 libssl-dev gcc-11-multilib g++-11-multilib
sudo pip install jsonref
sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev ${{matrix.architecture == '32' && 'zlib1g-dev:i386 libssl-dev:i386 gcc-13-multilib g++-13-multilib' || 'zlib1g-dev libssl-dev'}}
python3 -m venv venv
source venv/bin/activate
pip install jsonref
- name: Download artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -61,6 +63,7 @@ jobs:
# ----- Building & uploading -----
- name: Build ThunderNanoServices
run: |
source venv/bin/activate
cmake -G Ninja -S ThunderNanoServices -B ${{matrix.build_type}}/build/ThunderNanoServices \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
Expand Down
2 changes: 2 additions & 0 deletions DHCPServer/DHCPServerImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ namespace Plugin {
{
_id._allocation = nullptr;
}
PUSH_WARNING(DISABLE_WARNING_ARRAY_BOUNDS)
Identifier(const uint8_t id[], const uint8_t length)
: _length(length)
{
Expand All @@ -172,6 +173,7 @@ namespace Plugin {
::memcpy(_id._buffer, id, _length);
}
}
POP_WARNING()
Identifier(const Identifier& copy)
: _length(copy._length)
{
Expand Down

0 comments on commit b776da9

Please sign in to comment.