Linux kernel 5.18 breaks OSS

OSS specific Linux discussion (x86/amd64)

Moderators: dev, hannu, cesium

seawright
Known Member
Posts: 118
Joined: Sat Jan 06, 2007 9:10 pm
Location: Hampshire UK

Linux kernel 5.18 breaks OSS

Postby seawright » Tue Dec 27, 2022 4:24 pm

Kernel v15.18 and later breaks the osscore module which won't install due to a macro called "memmove" being defined in <linux/fortify-string.h>.

When the installation script tries to build the osscore module GCCs pre-processor replaces the function name memmove in osscore.c with the expanded macro thereby creating a syntax error which prevents the compiler producing "osscore.o".
The following patch will cure and problem and have no effect on earlier kernel versions.

Code: Select all

--- a/setup/Linux/oss/build/osscore.c
+++ b/setup/Linux/oss/build/osscore.c
@@ -138,6 +138,9 @@
   return t;
 }
 
+#ifdef memmove
+#undef memmove
+#endif
 void *memmove(void *dest, const void *src, size_t n)
 {
         return oss_memcpy(dest, src, n);
regards
Clive

Nexus
Member
Posts: 11
Joined: Sun Sep 16, 2018 8:14 pm
Sound Card: M-Audio Delta 44, Ap 2496
OS: MX-21.2

Re: Linux kernel 5.18 breaks OSS

Postby Nexus » Wed Dec 28, 2022 11:44 pm

Thanks for the quick patch!

Was wondering about that one warning though

Code: Select all

$ sudo soundon

OSS not loaded.
Relinking OSS kernel modules for "5.18.0-4mx-amd64 SMP preempt mod_unload modversions "
This may take few moments - please stand by...

OSS build environment set up for REGPARM kernels

Building module osscore
Failed to compile OSS
make -C /lib/modules/5.18.0-4mx-amd64/build M=/usr/lib/oss/build modules
make[1]: Entering directory ”/usr/src/linux-headers-5.18.0-4mx-amd64”
  CC [M]  /usr/lib/oss/build/osscore_lnk.o
/usr/lib/oss/build/osscore_lnk.c: In function ‘oss_get_time’:
/usr/lib/oss/build/osscore_lnk.c:95:10: warning: returning ‘time64_t (*)(void)’ {aka ‘long long int (*)(void)’} from a function with return type ‘oss_time_t’ {aka ‘long unsigned int’} makes integer from pointer without a cast [-Wint-conversion]
   95 |   return ktime_get_real_seconds;
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/string.h:253,
                 from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/bitmap.h:11,
                 from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/cpumask.h:12,
                 from /usr/src/linux-headers-5.18.0-4mx-common/arch/x86/include/asm/cpumask.h:5,
                 from /usr/src/linux-headers-5.18.0-4mx-common/arch/x86/include/asm/msr.h:11,
                 from /usr/src/linux-headers-5.18.0-4mx-common/arch/x86/include/asm/processor.h:22,
                 from /usr/src/linux-headers-5.18.0-4mx-common/arch/x86/include/asm/timex.h:5,
                 from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/timex.h:67,
                 from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/time32.h:13,
                 from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/time.h:60,
                 from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/stat.h:19,
                 from /usr/src/linux-headers-5.18.0-4mx-common/include/linux/module.h:13,
                 from /usr/lib/oss/build/osscore_lnk.c:15:
/usr/lib/oss/build/osscore_lnk.c: At top level:
/usr/src/linux-headers-5.18.0-4mx-common/include/linux/fortify-string.h:358:42: error: expected identifier or ‘(’ before ‘{’ token
  358 |         p_size_field, q_size_field, op) ({  \
      |                                          ^
/usr/src/linux-headers-5.18.0-4mx-common/include/linux/fortify-string.h:373:27: note: in expansion of macro ‘__fortify_memcpy_chk’
  373 | #define memmove(p, q, s)  __fortify_memcpy_chk(p, q, s,   \
      |                           ^~~~~~~~~~~~~~~~~~~~
/usr/lib/oss/build/osscore_lnk.c:141:7: note: in expansion of macro ‘memmove’
  141 | void *memmove(void *dest, const void *src, size_t n)
      |       ^~~~~~~
make[2]: *** [/usr/src/linux-headers-5.18.0-4mx-common/scripts/Makefile.build:294: /usr/lib/oss/build/osscore_lnk.o] Error 1
make[1]: *** [/usr/src/linux-headers-5.18.0-4mx-common/Makefile:1862: /usr/lib/oss/build] Virhe 2
make[1]: Leaving directory ”/usr/src/linux-headers-5.18.0-4mx-amd64”
make: *** [Makefile:21: default] Error 2

osscore.c @@ -92,7 +92,7 @@ oss_get_time (void)

Code: Select all

return ktime_get_real_seconds;

Should it be

Code: Select all

return ktime_get_real_seconds();
Last edited by Nexus on Sun Feb 05, 2023 8:02 pm, edited 1 time in total.

seawright
Known Member
Posts: 118
Joined: Sat Jan 06, 2007 9:10 pm
Location: Hampshire UK

Re: Linux kernel 5.18 breaks OSS

Postby seawright » Thu Dec 29, 2022 12:25 pm

If only it was that simple.

It is all part of the year 2038 problem (see https://en.wikipedia.org/wiki/Year_2038_problem ).
Unlike the millennium bug where software developers were busy in 1999 racing to find a fix they are trying to tackle this bug early.
This is causing all sorts of problems as there is, as yet, no agreed solution.
They all know what needs to happen but are taking slightly different approaches.

The error causing, "Failed to compile OSS" is due to how "memmove" is defined. At the moment the time problem is only a warning but may become
an error in the future. It is due to different approaches taken by GlibC and the Linux kernel developers and the way OSS is compiled outside
the kernel but linked using Kmod.
Ironically if nothing had been done it would never have been a problem for x86_64 architecture PCs as I doubt that the human race will be around
in a billion years time let alone 64 bit computers.

The return value of the ktime_get_real_seconds function shouldn't matter to a sound driver as despite its name it is only being used to obtain
the date to check that the software license is still valid.
This is not a problem for GPL'ed software but is required, as 4Front use the same codebase (with nonfree additions) to build their
proprietary sound drivers.
regards

Clive

seawright
Known Member
Posts: 118
Joined: Sat Jan 06, 2007 9:10 pm
Location: Hampshire UK

Re: Linux kernel 5.18 breaks OSS

Postby seawright » Sun Feb 26, 2023 8:28 pm

It won't solve the year 2038 problem but casting ktime_get_real_seconds to unsigned long will stop the compiler complaining.

Code: Select all

return (unsigned long) ktime_get_real_seconds;
regards

Clive


Return to “Linux”

Who is online

Users browsing this forum: Google [Bot] and 8 guests