[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201010042231.EEG13079.OFSFtOMJHVFLQO@I-love.SAKURA.ne.jp>
Date: Mon, 4 Oct 2010 22:31:46 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: kosaki.motohiro@...fujitsu.com
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: Is it legal to return positive value when do_execve() succeeds?
KOSAKI Motohiro wrote:
> > fs/binfmt_elf.c:
> > 77 #define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
> Can do_brk() return BAD_ADDR() _and_ !IS_ERR_VALUE() value? when?
For example, arch/mips/include/asm/processor.h has below definitions
which is smaller than INT_MAX
47 #ifdef CONFIG_32BIT
(...snipped...)
52 #define TASK_SIZE 0x7fff8000UL
(...snipped...)
63 #endif
64
65 #ifdef CONFIG_64BIT
(...snipped...)
74 #define TASK_SIZE 0x10000000000UL
(...snipped...)
91 #endif
Also, several architectures define TASK_SIZE as
#define TASK_SIZE PAGE_OFFSET
and PAGE_OFFSET could be 0 if CONFIG_KERNEL_RAM_BASE_ADDRESS is not defined.
include/asm-generic/page.h
68 #ifdef CONFIG_KERNEL_RAM_BASE_ADDRESS
69 #define PAGE_OFFSET (CONFIG_KERNEL_RAM_BASE_ADDRESS)
70 #else
71 #define PAGE_OFFSET (0)
72 #endif
If TASK_SIZE == 0, BAD_ADDR(x) is always true and !IS_ERR_VALUE(x) can be true.
Although I don't know which combination makes such environment,
I think "BAD_ADDR() _and_ !IS_ERR_VALUE()" can happen.
--
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