sophos / talpa

Talpa Kernel file access interception modules
GNU General Public License v2.0
17 stars 11 forks source link

Build fails due to designated_init attribute in linux_file.c #9

Closed fatdunky closed 6 years ago

fatdunky commented 6 years ago

Hi All,

My talpa build is failing.

[Talpa-select] Copyright 1989-2017 Sophos Limited. All rights reserved. Sun Jan 14 10:32:13 2018 GMT Linux distribution: [ubuntu] Product: [Pop!_OS 17.10 (Artful Aardvark)] Kernel: [4.13.0-25-generic] Multiprocessor support enabled. Searching for source pack... Searching for suitable binary pack... No suitable binary pack available. Preparing for build... Extracting sources... Configuring build of version 1.23.3... Building... Error: Failed to build from source.

When i ran make myself (under ~/sophos-av/talpa/build/talpa-1.23.3). The following errors were reported.

~/sophos-av/talpa/build/talpa-1.23.3/src/components/services/linux_filesystem_impl/linux_file.c:334:29: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init] struct path path = { mnt,dentry };

~/sophos-av/talpa/build/talpa-1.23.3/src/components/services/linux_filesystem_impl/linux_file.c:334:33: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init] struct path path = { mnt,dentry }

My under standing is Linux kernel has added -Werror=designated-init around 4.11 triggering build errors with gcc 5 and 6.

I was able to resolve the make errors by updating line 334 in linux_files.c from:

struct path path = {mnt, dentry}; to: struct path path = { .mnt = mnt, .dentry = dentry };

There are some other calls to the path struct in the files (that im guessing arent executed to my pre-defines)

Edit:

Sorry forgot my os details: Linux pop-os 4.13.0-25-generic #29-Ubuntu SMP Mon Jan 8 21:14:41 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

paperclip commented 6 years ago

That has been fixed by https://github.com/sophos/talpa/commit/493b7dc16f6e9f0c8ce46ceee638fbfb986533be on the Perforce branch.

Use autodeploy.sh to get the source from github into SAV. ( https://gist.github.com/paperclip/7892031 )