Commit dbd4af54 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

proc: fixup map_files test on arm

https://bugs.linaro.org/show_bug.cgi?id=3782

Turns out arm doesn't permit mapping address 0, so try minimum virtual
address instead.

Link: http://lkml.kernel.org/r/20181113165446.GA28157@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Reported-by: default avatarRafael David Tinoco <rafael.tinoco@linaro.org>
Tested-by: default avatarRafael David Tinoco <rafael.tinoco@linaro.org>
Acked-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8de456cf
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* Test readlink /proc/self/map_files/... with address 0. */ /* Test readlink /proc/self/map_files/... with minimum address. */
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b) ...@@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b)
int main(void) int main(void)
{ {
const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE); const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
#ifdef __arm__
unsigned long va = 2 * PAGE_SIZE;
#else
unsigned long va = 0;
#endif
void *p; void *p;
int fd; int fd;
unsigned long a, b; unsigned long a, b;
...@@ -55,7 +60,7 @@ int main(void) ...@@ -55,7 +60,7 @@ int main(void)
if (fd == -1) if (fd == -1)
return 1; return 1;
p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
if (p == MAP_FAILED) { if (p == MAP_FAILED) {
if (errno == EPERM) if (errno == EPERM)
return 2; return 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment