lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 26 Oct 2010 18:24:07 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Marco Stornelli <marco.stornelli@...il.com>
cc:	Linux Kernel <linux-kernel@...r.kernel.org>, x86@...nel.org,
	Tim Bird <tim.bird@...sony.com>, andi@...stfloor.org
Subject: Re: [PATCH] archs: add ioremap_change_write_prot

On Sun, 24 Oct 2010, Marco Stornelli wrote:

> From: Marco Stornelli <marco.stornelli@...il.com>
> 
> This patch adds a new function called ioremap_change_write_prot.
> Goal of this patch is to create a general function for all archs to be
> able to change a write protection of a memory mapped area. x86
> has already got a similar framework, so this function is only
> a wrapper. Next target will be arm and powerpc. This function
> will be used by Pramfs (see its latest review).

Sorry for the delay. I'm traveling.
 
> Signed-off-by: Marco Stornelli <marco.stornelli@...il.com>
> ---
> 
> diff -Nurp linux-2.6.36-orig/arch/x86/mm/ioremap.c linux-2.6.36/arch/x86/mm/ioremap.c
> --- linux-2.6.36-orig/arch/x86/mm/ioremap.c	2010-09-13 01:07:37.000000000 +0200
> +++ linux-2.6.36/arch/x86/mm/ioremap.c	2010-10-24 10:03:36.000000000 +0200
> @@ -50,6 +50,27 @@ int ioremap_change_attr(unsigned long va
>  	return err;
>  }
  
> +int ioremap_change_write_prot(unsigned long vaddr, unsigned long size,
> +			       unsigned int rw)
> +{
> +	unsigned long nrpages = size >> PAGE_SHIFT;
> +	int ret;
> +
> +	/* Page aligned */
> +	vaddr &= PAGE_MASK;
> +
> +	if (size & (PAGE_SIZE - 1))
> +		nrpages++;
> +
> +	if (rw)
> +		ret = set_memory_rw(vaddr, nrpages);
> +	else
> +		ret = set_memory_ro(vaddr, nrpages);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL(ioremap_change_write_prot);

Why inventing a new interface if we have one already ?

    set_memory_* which has a few more variants than ro/rw

Also this is not related to ioremap, these are functions which works on
almost anything when there are other restrictions in place.

So implementing set_memory_ro(), set_memory_rw() for those archs which
you need it for makes more sense than creating a misnomed and
misplaced wrapper.

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ