lib/cobalt: Avoid making mmap offset argument unconditionally 64-bit
PATCH 1/1 lib/cobalt: Avoid making mmap offset argument unconditionally 64-bit
From: Jan Kiszka <[email protected]>
When _FILE_OFFSET_BITS is 64, mmap is handled by the mmap64 symbol of glibc. The original mmap continues to expect native off_t size, i.e. 32 bits on 32-bit archs.
While we require applications to be rebuilt with the same settings Xenomai was built with as well (either both _TIME_BITS and _FILE_OFFSET_BITS set to 64 or both left unset) which practically shadows this issue, it remains wrong to change the wrapped mmap function in a was that is incompatible with glibc.
--- lib/cobalt/Makefile.am | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
lib/cobalt/Makefile.am +15 -3
@@ -7,9 +7,12 @@ noinst_HEADERS = \ lib_LTLIBRARIES = libcobalt.la libmodechk.la +noinst_LTLIBRARIES = libcobaltext.la + libcobalt_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 2:0:0 -lpthread -lrt libcobalt_la_LIBADD = \ + libcobaltext.la arch/@XENO_TARGET_ARCH@/libarch.la \ ../boilerplate/libboilerplate.la
@@ -24,7 +27,6 @@ libcobalt_la_SOURCES = \ mutex.c \ parse_vdso.c \ printf.c \ - rtdm.c \ sched.c \ select.c \ semaphore.c \
@@ -35,14 +37,24 @@ libcobalt_la_SOURCES = \ timer.c \ timerfd.c \ trace.c \ - umm.c \ - wrappers.c + umm.c libcobalt_la_CPPFLAGS = \ @XENO_COBALT_CFLAGS@ \ -I$(top_srcdir)/include/cobalt \ -I$(top_srcdir)/include +# source files that require native off_t size +libcobaltext_la_SOURCES = \ + rtdm.c \ + wrappers.c + +libcobaltext_la_CPPFLAGS = \ + @XENO_COBALT_CFLAGS@ \ + -I$(top_srcdir)/include/cobalt \ + -I$(top_srcdir)/include \ + -U_TIME_BITS -U_FILE_OFFSET_BITS + libmodechk_la_LIBADD = libcobalt.la libmodechk_la_SOURCES = \
Signature · 1 line
2.51.0
Quoted 11 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
When
_FILE_OFFSET_BITSis 64, mmap is handled by the mmap64 symbol of glibc. The original mmap continues to expect nativeoff_tsize, i.e. 32 bits on 32-bit archs.While we require applications to be rebuilt with the same settings Xenomai was built with as well (either both
_TIME_BITSand_FILE_OFFSET_BITSset to 64 or both left unset) which practically shadows this issue, it remains wrong to change the wrapped mmap function in a was that is incompatible with glibc.
The main point here is that we want to serve both (__USE_FILE_OFFSET64 == 64 and __USE_FILE_OFFSET64 == 32) worlds within one libcobalt build.
That was indeed silently changed by the commit below as building with _FILE_OFFSET_BITS = 64 left no 32 bit variant alive.
Quoted 39 lines
Fixes fb2bd6e647a9 ("y2038: build: Introduce new build parameter --disable-y2038")Signed-off-by Jan Kiszka <[email protected]>--- lib/cobalt/Makefile.am | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)lib/cobalt/Makefile.am +4
-3@@ -7,9 +7,12 @@ noinst_HEADERS = \ lib_LTLIBRARIES = libcobalt.la libmodechk.la +noinst_LTLIBRARIES = libcobaltext.la + libcobalt_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 2:0:0 -lpthread -lrt libcobalt_la_LIBADD = \ + libcobaltext.la arch/@XENO_TARGET_ARCH@/libarch.la \ ../boilerplate/libboilerplate.la@@ -24,7 +27,6 @@ libcobalt_la_SOURCES = \ mutex.c \ parse_vdso.c \ printf.c \ - rtdm.c \ sched.c \ select.c \ semaphore.c \@@ -35,14 +37,24 @@ libcobalt_la_SOURCES = \ timer.c \ timerfd.c \ trace.c \ - umm.c \ - wrappers.c + umm.c
lib/cobalt/Makefile.am libcobalt_la_SOURCES = \ · line 50
Quoted 10 lines
lib/cobalt/Makefile.am +4
-0libcobalt_la_CPPFLAGS = \ @XENO_COBALT_CFLAGS@ \ -I$(top_srcdir)/include/cobalt \ -I$(top_srcdir)/include +# source files that require native off_t size +libcobaltext_la_SOURCES = \ + rtdm.c \ + wrappers.c
At least rtdm.c hosts some COBALT_IMPL_TIME64() wrappers. Needs double checking that we do not disable the time64 bit support for them while trying to fix behavior around __USE_FILE_OFFSET64.
Quoted 12 lines
lib/cobalt/Makefile.am +7
-0+ +libcobaltext_la_CPPFLAGS = \ + @XENO_COBALT_CFLAGS@ \ + -I$(top_srcdir)/include/cobalt \ + -I$(top_srcdir)/include \ + -U_TIME_BITS -U_FILE_OFFSET_BITS + libmodechk_la_LIBADD = libcobalt.la libmodechk_la_SOURCES = \Signature · 1 line
2.51.0