[patch 2/7] Change how we do nosegneg

Roland McGrath roland at redhat.com
Thu Jul 24 00:41:13 UTC 2008


> We should really only install ld.so.conf files from packages
> that actually have CONFIG_XEN enabled, but it would be
> slightly messy to have only kernel-PAE.i686 and kernel.x86_64
> include it.

It wouldn't really be so hard to conditionalize it at least for the arch's
that ever need it.  (The kernelcap trick might well be used for other
things in the future.)

I think the right direction to head is that upstream kernels supply a .conf
file to match the vDSO they build in.  This will probably always be just a
constant file in the source, but in general can be said to be generated by
the kernel build.  The contents have to match the magic bits in the vDSO
images built into the kernel, so it really should not be a distro/packaging
responsibility to populate the file.

So let's structure things around that: the kernel build for an arch that
uses vdso might include a kernelcap.conf file (or might not).  

For simplicity and consistency in the .spec file, we'll install a file for
all variants even when it's an empty placeholder.  For the magic, the diff
below probably covers it (wholly untested).  Then it's up to BuildKernel
just to add/remove ldconfig-kernelcap.conf as part of the build (perhaps
eventually done by the upstream makefiles).

The .conf files have to not conflict (reuse same bit with different name)
across all installed kernels (or else ldconfig will complain).  So a single
kernel-%{KVERREL}.conf file would be fine.  But instead I made it
kernel-%{KVERREL}.variant.conf just to stay consistent with all existing
names like /lib/module/FOO and the fact that no two kernel rpms conflict on
the same file name (even if identical).


Thanks,
Roland


--- kernel.spec	23 Jul 2008 19:51:09 -0000	1.791
+++ kernel.spec	24 Jul 2008 00:21:24 -0000
@@ -1509,21 +1513,13 @@ BuildKernel vmlinux vmlinux kdump vmlinu
 
 cd linux-%{kversion}.%{_target_cpu}
 
-%if %{includexen}
-%if %{with_xen}
-mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
-rm -f $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf
-cat > $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf <<\EOF
-# This directive teaches ldconfig to search in nosegneg subdirectories
-# and cache the DSOs there with extra bit 0 set in their hwcap match
-# fields.  In Xen guest kernels, the vDSO tells the dynamic linker to
-# search in nosegneg subdirectories and to match this extra hwcap bit
-# in the ld.so.cache file.
-hwcap 0 nosegneg
-EOF
-chmod 444 $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf
-%endif
-%endif
+if [ ! -s ldconfig-kernelcap.conf ]; then
+  echo > ldconfig-kernelcap.conf "\
+# Placeholder file, no vDSO hwcap entries used in this kernel."
+fi
+
+%{__install} -D -m 444 ldconfig-kernelcap.conf \
+	     $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-%{KVERREL}.conf
 
 %if %{with_doc}
 mkdir -p $RPM_BUILD_ROOT/usr/share/doc/kernel-doc-%{kversion}/Documentation
@@ -1728,6 +1724,7 @@ fi
 /lib/modules/%{KVERREL}%{?2:.%{2}}/weak-updates\
 %ifarch %{vdso_arches}\
 /lib/modules/%{KVERREL}%{?2:.%{2}}/vdso\
+/etc/ld.so.conf.d/kernelcap-%{KVERREL}%{?2:.%{2}}.conf\
 %endif\
 /lib/modules/%{KVERREL}%{?2:.%{2}}/modules.block\
 /lib/modules/%{KVERREL}%{?2:.%{2}}/modules.networking\




More information about the kernel mailing list