Skip to content

Commit 72b16d2

Browse files
committed
Auto merge of #1041 - bachp:module-init, r=alexcrichton
Add MODULE_INIT_ constants These are flags required to implement the linux kernel loading mechanism. Specifically finit_module.
2 parents 5ac35c8 + 2365707 commit 72b16d2

File tree

8 files changed

+38
-25
lines changed

8 files changed

+38
-25
lines changed

ci/docker/aarch64-unknown-linux-musl/Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ FROM ubuntu:17.10
33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
55
gcc-aarch64-linux-gnu qemu-user
6-
RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | \
6+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
77
tar xzf - && \
8-
cd musl-1.1.16 && \
8+
cd musl-1.1.19 && \
99
CC=aarch64-linux-gnu-gcc \
1010
./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \
1111
make install -j4 && \
1212
cd .. && \
13-
rm -rf musl-1.1.16 && \
13+
rm -rf musl-1.1.19
1414
# Install linux kernel headers sanitized for use with musl
15-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
15+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
1616
tar xzf - && \
17-
cd kernel-headers-3.12.6-5 && \
17+
cd kernel-headers-3.12.6-6 && \
1818
make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \
1919
cd .. && \
20-
rm -rf kernel-headers-3.12.6-5
20+
rm -rf kernel-headers-3.12.6-6
2121

2222
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd?
2323
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \

ci/docker/arm-unknown-linux-musleabihf/Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
55
gcc-arm-linux-gnueabihf qemu-user
66

7-
RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | tar xzf -
8-
WORKDIR /musl-1.1.16
7+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | tar xzf -
8+
WORKDIR /musl-1.1.19
99
RUN CC=arm-linux-gnueabihf-gcc \
1010
CFLAGS="-march=armv6 -marm" \
1111
./configure --prefix=/musl-arm --enable-wrapper=yes
1212
RUN make install -j4
1313

1414
# Install linux kernel headers sanitized for use with musl
15-
RUN \
16-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
15+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
1716
tar xzf - && \
18-
cd kernel-headers-3.12.6-5 && \
17+
cd kernel-headers-3.12.6-6 && \
1918
make ARCH=arm prefix=/musl-arm install -j4 && \
2019
cd .. && \
21-
rm -rf kernel-headers-3.12.6-5
20+
rm -rf kernel-headers-3.12.6-6
21+
2222
ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
2323
CC_arm_unknown_linux_musleabihf=musl-gcc \
2424
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=musl-gcc \

ci/docker/i686-unknown-linux-musl/Dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ RUN apt-get install -y --no-install-recommends \
1212
# since otherwise the script will fail to find a compiler.
1313
# * We manually unset CROSS_COMPILE when running make; otherwise the makefile
1414
# will call the non-existent binary 'i686-ar'.
15-
RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
15+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
1616
tar xzf - && \
17-
cd musl-1.1.15 && \
17+
cd musl-1.1.19 && \
1818
CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
1919
make CROSS_COMPILE= install -j4 && \
2020
cd .. && \
21-
rm -rf musl-1.1.15 && \
21+
rm -rf musl-1.1.19
2222
# Install linux kernel headers sanitized for use with musl
23-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
23+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
2424
tar xzf - && \
25-
cd kernel-headers-3.12.6-5 && \
25+
cd kernel-headers-3.12.6-6 && \
2626
make ARCH=i386 prefix=/musl-i686 install -j4 && \
2727
cd .. && \
28-
rm -rf kernel-headers-3.12.6-5
28+
rm -rf kernel-headers-3.12.6-6
29+
2930
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
3031
CC_i686_unknown_linux_musl=musl-gcc

ci/docker/sparc64-unknown-linux-gnu/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
55
gcc libc6-dev \
66
gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \
77
qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \
8-
p7zip-full cpio
8+
p7zip-full cpio linux-libc-dev-sparc64-cross linux-headers-4.9.0-3-common
9+
10+
# Put linux/module.h into the right spot as it is not shipped by debian
11+
RUN cp /usr/src/linux-headers-4.9.0-3-common/include/uapi/linux/module.h /usr/sparc64-linux-gnu/include/linux/
912

1013
COPY linux-sparc64.sh /
1114
RUN bash /linux-sparc64.sh

ci/docker/x86_64-unknown-linux-musl/Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ FROM ubuntu:17.10
33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
55
gcc make libc6-dev git curl ca-certificates
6-
RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
6+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
77
tar xzf - && \
8-
cd musl-1.1.15 && \
8+
cd musl-1.1.19 && \
99
./configure --prefix=/musl-x86_64 && \
1010
make install -j4 && \
1111
cd .. && \
12-
rm -rf musl-1.1.15 && \
12+
rm -rf musl-1.1.19
1313
# Install linux kernel headers sanitized for use with musl
14-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
14+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
1515
tar xzf - && \
16-
cd kernel-headers-3.12.6-5 && \
16+
cd kernel-headers-3.12.6-6 && \
1717
make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \
1818
cd .. && \
19-
rm -rf kernel-headers-3.12.6-5
19+
rm -rf kernel-headers-3.12.6-6
2020
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ fn main() {
272272

273273
if linux || android {
274274
cfg.header("sys/fsuid.h");
275+
cfg.header("linux/module.h");
275276
cfg.header("linux/seccomp.h");
276277
cfg.header("linux/if_ether.h");
277278
cfg.header("linux/if_tun.h");

src/unix/notbsd/android/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,10 @@ pub const SIOCSRARP: ::c_ulong = 0x00008962;
14581458
pub const SIOCGIFMAP: ::c_ulong = 0x00008970;
14591459
pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
14601460

1461+
// linux/module.h
1462+
pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
1463+
pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
1464+
14611465
// Similarity to Linux it's not used but defined for compatibility.
14621466
pub const ENOATTR: ::c_int = ::ENODATA;
14631467

src/unix/notbsd/linux/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,10 @@ pub const ARPD_LOOKUP: ::c_ushort = 0x02;
14981498
pub const ARPD_FLUSH: ::c_ushort = 0x03;
14991499
pub const ATF_MAGIC: ::c_int = 0x80;
15001500

1501+
// linux/module.h
1502+
pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
1503+
pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
1504+
15011505
f! {
15021506
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
15031507
for slot in cpuset.bits.iter_mut() {

0 commit comments

Comments
 (0)