Re: Stacking LSM proof-of-concept

From: Greg KH (greg@private)
Date: Sat Jan 29 2005 - 09:19:27 PST


On Thu, Jan 27, 2005 at 11:20:03PM -0500, John Richard Moser wrote:
> diff -urNp linux-2.6.10/drivers/pci/proc.c linux-2.6.10-grs/drivers/pci/proc.c
> --- linux-2.6.10/drivers/pci/proc.c	2004-12-24 16:34:58.000000000 -0500
> +++ linux-2.6.10-grs/drivers/pci/proc.c	2005-01-25 21:01:26.312458000 -0500
> @@ -12,6 +12,9 @@
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/smp_lock.h>
> +#ifdef CONFIG_GRSECURITY
> +# include <linux/grsecurity.h>
> +#endif

Don't put ifdefs in .c files.

>  #include <asm/uaccess.h>
>  #include <asm/byteorder.h>
> @@ -565,7 +568,19 @@ static struct file_operations proc_pci_o
>  
>  static void legacy_proc_init(void)
>  {
> -	struct proc_dir_entry * entry = create_proc_entry("pci", 0, NULL);
> +	struct proc_dir_entry * entry = NULL;
> +#ifdef CONFIG_GRSECURITY
> +	int error;
> +	error = gr_proc_pci_legacy_init(&entry);
> +	/*
> +	 * If this returns 0, we generate the entry as normal.
> +	 * If it returns non-zero, we assume entry was or will not be
> +	 * generated
> +	 */
> +	if (!error)
> +#else
> +	entry = create_proc_entry("pci", 0, NULL);
> +#endif

So, no pci proc entry if your option is enabled?  That's broken.

Again, no #ifdefs in .c files please.

thanks,

greg k-h



This archive was generated by hypermail 2.1.3 : Sat Jan 29 2005 - 09:20:19 PST