Re: Security: Replace dac_mmap_min_addr to mmap_min_addr in cap_file_mmap()

From: wzt wzt
Date: Wed Apr 14 2010 - 01:50:51 EST


still not understand, if CONFIG_LSM_MMAP_MIN_ADDR is not set,
mmap_min_addr is equal dac_mmap_min_addr, right?
if not, mmap_min_addr is set as CONFIG_LSM_MMAP_MIN_ADDR. what's the
effect of mmap_min_addr? except round_hint_to_min() will use
mmap_min_addr, any other functions will call it?
Anyway, the comments need change mmap_min_addr as dac_mmap_min_addr,
right? If i'm wrong, please point it, thanks.
/*
* If the process is attempting to map memory below mmap_min_addr they need |{
* CAP_SYS_RAWIO.
*/

On Wed, Apr 14, 2010 at 11:02 AM, Eric Paris <eparis@xxxxxxxxxxxxxx> wrote:
> NAK NAK NAK
>
> go back and reread the whole purpose for the separation.
>
> -Eric
>
> On Tue, Apr 13, 2010 at 10:48 PM, Â<wzt.wzt@xxxxxxxxx> wrote:
>> cap_file_mmap() comments said "If the process is attempting to map
>> memory below mmap_min_addr", if CONFIG_LSM_MMAP_MIN_ADDR is set,
>> dac_mmap_min_addr is not equal mmap_min_addr, so replace dac_mmap_min_addr
>> to mmap_min_addr seems to be better.
>>
>> Signed-off-by: Zhitong Wang <zhitong.wangzt@xxxxxxxxxxxxxxx>
>>
>> ---
>> Âinclude/linux/security.h | Â Â1 +
>> Âsecurity/commoncap.c   |  Â2 +-
>> Â2 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/linux/security.h b/include/linux/security.h
>> index 233d20b..61fd9e7 100644
>> --- a/include/linux/security.h
>> +++ b/include/linux/security.h
>> @@ -101,6 +101,7 @@ void reset_security_ops(void);
>> Âextern unsigned long mmap_min_addr;
>> Âextern unsigned long dac_mmap_min_addr;
>> Â#else
>> +#define mmap_min_addr     Â0UL
>> Â#define dac_mmap_min_addr   Â0UL
>> Â#endif
>>
>> diff --git a/security/commoncap.c b/security/commoncap.c
>> index 6166973..878cf89 100644
>> --- a/security/commoncap.c
>> +++ b/security/commoncap.c
>> @@ -942,7 +942,7 @@ int cap_file_mmap(struct file *file, unsigned long reqprot,
>> Â{
>> Â Â Â Âint ret = 0;
>>
>> - Â Â Â if (addr < dac_mmap_min_addr) {
>> + Â Â Â if (addr < mmap_min_addr) {
>> Â Â Â Â Â Â Â Âret = cap_capable(current, current_cred(), CAP_SYS_RAWIO,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂSECURITY_CAP_AUDIT);
>> Â Â Â Â Â Â Â Â/* set PF_SUPERPRIV if it turns out we allow the low mmap */
>> --
>> 1.6.5.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/