On 12 January 2018 at 08:37, Greg Rose <[email protected]> wrote:
> A bug in RHEL 7.2 has been found in which a customer who installed
> a RHEL 7.2 openvswitch kernel module rpm with a slightly different
> minor build number than the running kernel found that the kernel
> modules were installed to the wrong directory.
>
> After the installation the new openvswitch kernel modules were
> installed to:
> /lib/modules/3.10.0-327.22.2.el7.x86_64/extra/openvswitch
>
> But the running kernel was 3.10.0-327.el7.x86_64 and after the
> installation was complete the kernel modules in the installed
> directory were not linked to the "weak-updates" directory in
> the running kernel. So a critical bug was encountered in
> which the in-tree openvswitch kernel module was loaded instead
> of the one the customer explicitly installed with the rpm.
>
> This patch replicates ./extra/openvswitch directory with kernel
> modules, if for the currently running kernel there is neither
> a ./extra/openvswitch nor ./weak-update/openvswitch directory.
>
> Signed-off-by: Greg Rose <[email protected]>
>
> ---
>
> V2 - Incorporate feedback from V1
> ---
> rhel/openvswitch.spec.in | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
> index e510d35..b5b5122 100644
> --- a/rhel/openvswitch.spec.in
> +++ b/rhel/openvswitch.spec.in
> @@ -169,6 +169,32 @@ fi
> /sbin/chkconfig --add openvswitch
> /sbin/chkconfig openvswitch on
>
> +# In some cases a kernel module rpm will have a different minor build
> +# version than the currently running kernel. In this case the kernel
> +# modules will be installed but not to the kernel modules directory
> +# of the currently running kernel. Check and copy modules if
> +# necessary.
> +# This is a bug that has only been found to occur on RHEL 7.2.
> +if [[ ! -d /lib/modules/$(uname -r)/extra/openvswitch && \
> + ! -d /lib/modules/$(uname -r)/weak-updates/openvswitch ]]; then
>
This check may not be good enough. If we are doing a upgrade of OVS on the
system (say from 2.7 to 2.9) and previously we had something in
/lib/modules/$(uname -r)/weak-updates/openvswitch then we are no longer
going to add the newer version there.
> + found="false"
> + for i in `ls -t /lib/modules`
> + do
> + if [ -d /lib/modules/$i/extra/openvswitch ]; then
>
This will not help either. There is a possibility of multiple kernels
installed and it looks like we will choose one randomly. We should only
look at the path where the current rpm actually installed our files.
> + mkdir -p /lib/modules/$(uname -r)/extra
> + cp -r --preserve "/lib/modules/$i/extra/openvswitch" \
> + /lib/modules/$(uname -r)/extra
> + found="true"
> + break
> + fi
> + done
> + if [ "$found" != "true" ]; then
> + echo "Error in openvswitch kernel modules installation"
> + else
> + /usr/sbin/depmod -a
> + fi
> +fi
> +
> %post selinux-policy
> /usr/sbin/semodule -i
> %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
> &> /dev/null || :
>
> --
> 1.8.3.1
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev