#!/bin/sh
if [ $# -eq 3 ] && [ "$1" = "-q" ] && [ "$2" = "--" ] && [ "$3" = "binfmt-464c" ]; then
    # 464c are the second two bytes of the ELF magic.  This module
    # doesn't exist; being called for it indicates the in-kernel
    # binfmt_elf decided to return ENOEXEC for this ELF file for some
    # reason.
    exit 1
fi
(
    echo "Ignoring request from kernel: modprobe $*"
    stacks=$(grep -ls request_module /proc/*/stack)
    if [ "$stacks" ]; then
	ps -Lfwp $(for stack in $stacks; do
		proc="${stack%/stack}"
		echo "${proc#/proc/}";
	    done)
    fi
) | logger -p authpriv.info
false
