* [PATCH] proc: fixup map_files test on arm
@ 2018-11-10 18:49 Alexey Dobriyan
2018-11-11 2:48 ` Rafael David Tinoco
0 siblings, 1 reply; 7+ messages in thread
From: Alexey Dobriyan @ 2018-11-10 18:49 UTC (permalink / raw)
To: akpm; +Cc: rafael.tinoco, linux-kernel, gorcunov
https://bugs.linaro.org/show_bug.cgi?id=3782
Turns out arm doesn't allow to map address 0, so try minimum virtual
address instead.
Reported-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
tools/testing/selftests/proc/proc-self-map-files-002.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/tools/testing/selftests/proc/proc-self-map-files-002.c
+++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
@@ -13,7 +13,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* 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 <sys/types.h>
#include <sys/stat.h>
@@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b)
int main(void)
{
const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
+#ifdef __arm__
+ unsigned long va = 2 * PAGE_SIZE;
+#else
+ unsigned long va = 0;
+#endif
void *p;
int fd;
unsigned long a, b;
@@ -55,7 +60,7 @@ int main(void)
if (fd == -1)
return 1;
- p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
+ p = mmap(va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
if (p == MAP_FAILED) {
if (errno == EPERM)
return 2;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: fixup map_files test on arm
2018-11-10 18:49 [PATCH] proc: fixup map_files test on arm Alexey Dobriyan
@ 2018-11-11 2:48 ` Rafael David Tinoco
2018-11-12 14:14 ` Alexey Dobriyan
0 siblings, 1 reply; 7+ messages in thread
From: Rafael David Tinoco @ 2018-11-11 2:48 UTC (permalink / raw)
To: Alexey Dobriyan, akpm; +Cc: linux-kernel, gorcunov, linux-kselftest, shuah
Including Shuah and kselftest list...
On Sat, Nov 10, 2018, at 4:49 PM, Alexey Dobriyan wrote:
> https://bugs.linaro.org/show_bug.cgi?id=3782
>
> Turns out arm doesn't allow to map address 0, so try minimum virtual
> address instead.
>
> Reported-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
>
> tools/testing/selftests/proc/proc-self-map-files-002.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> --- a/tools/testing/selftests/proc/proc-self-map-files-002.c
> +++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
> @@ -13,7 +13,7 @@
> * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
> OF
> * 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 <sys/types.h>
> #include <sys/stat.h>
> @@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a,
> unsigned long b)
> int main(void)
> {
> const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
> +#ifdef __arm__
> + unsigned long va = 2 * PAGE_SIZE;
> +#else
> + unsigned long va = 0;
> +#endif
> void *p;
> int fd;
> unsigned long a, b;
> @@ -55,7 +60,7 @@ int main(void)
> if (fd == -1)
> return 1;
>
> - p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> + p = mmap(va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> if (p == MAP_FAILED) {
> if (errno == EPERM)
> return 2;
I have sent a patch removing proc-self-map-files-002 AND making 001 to use as a
HINT for mmap (MAP_FIXED) *at least* *(2 * PAGE_SIZE), which would, likely,
attend all architectures, avoiding trying to make the test specific to one,
and, still, test the symlinks for issues (like bad chars, spaces, so on).
Both tests (001 and 002) have pretty much the same code, while they could have 2
tests in a single code, using kselftest framework. Is NULL hint + MAP_FIXED
something imperative for this test ? Why not to have all in a single test ? Are
you keeping the NULL hint just to test mmap, apart" from the core of this test ?
Sorry to insist.. If you want to keep it like this, I can create a similar test
in LTP - for the symlinks only, which seem important - and blacklist this one in
our function tests kselftest list (https://lkft.linaro.org/), then no change is
needed on your side.
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: fixup map_files test on arm
2018-11-11 2:48 ` Rafael David Tinoco
@ 2018-11-12 14:14 ` Alexey Dobriyan
2018-11-12 15:55 ` Cyrill Gorcunov
0 siblings, 1 reply; 7+ messages in thread
From: Alexey Dobriyan @ 2018-11-12 14:14 UTC (permalink / raw)
To: Rafael David Tinoco; +Cc: akpm, linux-kernel, gorcunov, linux-kselftest, shuah
On Sun, Nov 11, 2018 at 12:48:47AM -0200, Rafael David Tinoco wrote:
> Including Shuah and kselftest list...
>
> On Sat, Nov 10, 2018, at 4:49 PM, Alexey Dobriyan wrote:
> > https://bugs.linaro.org/show_bug.cgi?id=3782
> >
> > Turns out arm doesn't allow to map address 0, so try minimum virtual
> > address instead.
> >
> > Reported-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> > ---
> >
> > tools/testing/selftests/proc/proc-self-map-files-002.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > --- a/tools/testing/selftests/proc/proc-self-map-files-002.c
> > +++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
> > @@ -13,7 +13,7 @@
> > * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
> > OF
> > * 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 <sys/types.h>
> > #include <sys/stat.h>
> > @@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a,
> > unsigned long b)
> > int main(void)
> > {
> > const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
> > +#ifdef __arm__
> > + unsigned long va = 2 * PAGE_SIZE;
> > +#else
> > + unsigned long va = 0;
> > +#endif
> > void *p;
> > int fd;
> > unsigned long a, b;
> > @@ -55,7 +60,7 @@ int main(void)
> > if (fd == -1)
> > return 1;
> >
> > - p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> > + p = mmap(va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> > if (p == MAP_FAILED) {
> > if (errno == EPERM)
> > return 2;
>
> I have sent a patch removing proc-self-map-files-002 AND making 001 to use as a
> HINT for mmap (MAP_FIXED) *at least* *(2 * PAGE_SIZE), which would, likely,
> attend all architectures, avoiding trying to make the test specific to one,
> and, still, test the symlinks for issues (like bad chars, spaces, so on).
If the goal is to test the lowest address then going for 2*PAGE_SIZE is
a mistake.
Which BTW hints to add a test for the highest address.
> Both tests (001 and 002) have pretty much the same code, while they could have 2
> tests in a single code, using kselftest framework. Is NULL hint + MAP_FIXED
> something imperative for this test ? Why not to have all in a single test ?
I dislike tests which lump everything together into one process.
> Are you keeping the NULL hint just to test mmap, apart" from the core of
> this test ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: fixup map_files test on arm
2018-11-12 14:14 ` Alexey Dobriyan
@ 2018-11-12 15:55 ` Cyrill Gorcunov
2018-11-12 16:35 ` Rafael David Tinoco
0 siblings, 1 reply; 7+ messages in thread
From: Cyrill Gorcunov @ 2018-11-12 15:55 UTC (permalink / raw)
To: Alexey Dobriyan, Rafael David Tinoco
Cc: akpm, linux-kernel, linux-kselftest, shuah
On Mon, Nov 12, 2018 at 05:14:57PM +0300, Alexey Dobriyan wrote:
...
> > > int main(void)
> > > {
> > > const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
> > > +#ifdef __arm__
> > > + unsigned long va = 2 * PAGE_SIZE;
> > > +#else
> > > + unsigned long va = 0;
> > > +#endif
...
> >
> > I have sent a patch removing proc-self-map-files-002 AND making 001 to use as a
> > HINT for mmap (MAP_FIXED) *at least* *(2 * PAGE_SIZE), which would, likely,
> > attend all architectures, avoiding trying to make the test specific to one,
> > and, still, test the symlinks for issues (like bad chars, spaces, so on).
>
> If the goal is to test the lowest address then going for 2*PAGE_SIZE is
> a mistake.
>
> Which BTW hints to add a test for the highest address.
>
> > Both tests (001 and 002) have pretty much the same code, while they could have 2
> > tests in a single code, using kselftest framework. Is NULL hint + MAP_FIXED
> > something imperative for this test ? Why not to have all in a single test ?
>
> I dislike tests which lump everything together into one process.
>
> > Are you keeping the NULL hint just to test mmap, apart" from the core of
> > this test ?
Guys, lets simply stick with Alexey's patch. I personnally think that
testing mappings should be a separate test in vm/, but seriously this
took too long already :) If Alexey's patch fixes the problem with arm
I think we're fine.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: fixup map_files test on arm
2018-11-12 15:55 ` Cyrill Gorcunov
@ 2018-11-12 16:35 ` Rafael David Tinoco
2018-11-13 16:54 ` [PATCH v2] " Alexey Dobriyan
0 siblings, 1 reply; 7+ messages in thread
From: Rafael David Tinoco @ 2018-11-12 16:35 UTC (permalink / raw)
To: Cyrill Gorcunov, Alexey Dobriyan
Cc: rafael.tinoco, akpm, linux-kernel, linux-kselftest, shuah
On 11/12/18 1:55 PM, Cyrill Gorcunov wrote:
> On Mon, Nov 12, 2018 at 05:14:57PM +0300, Alexey Dobriyan wrote:
> ...
>>>> int main(void)
>>>> {
>>>> const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
>>>> +#ifdef __arm__
>>>> + unsigned long va = 2 * PAGE_SIZE;
>>>> +#else
>>>> + unsigned long va = 0;
>>>> +#endif
> ...
>>>
>>> I have sent a patch removing proc-self-map-files-002 AND making 001 to use as a
>>> HINT for mmap (MAP_FIXED) *at least* *(2 * PAGE_SIZE), which would, likely,
>>> attend all architectures, avoiding trying to make the test specific to one,
>>> and, still, test the symlinks for issues (like bad chars, spaces, so on).
>>
>> If the goal is to test the lowest address then going for 2*PAGE_SIZE is
>> a mistake.
>>
>> Which BTW hints to add a test for the highest address.
>>
>>> Both tests (001 and 002) have pretty much the same code, while they could have 2
>>> tests in a single code, using kselftest framework. Is NULL hint + MAP_FIXED
>>> something imperative for this test ? Why not to have all in a single test ?
>>
>> I dislike tests which lump everything together into one process.
>>
>>> Are you keeping the NULL hint just to test mmap, apart" from the core of
>>> this test ?
>
> Guys, lets simply stick with Alexey's patch. I personnally think that
> testing mappings should be a separate test in vm/, but seriously this
> took too long already :) If Alexey's patch fixes the problem with arm
> I think we're fine.
>
Fine for me. It works in armhf.
Tested-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Note: Maybe you should amend the patch and cast "va" in mmap() to avoid:
In file included from proc-self-map-files-002.c:7:
/usr/include/arm-linux-gnueabihf/sys/mman.h:57:14: note: expected ‘void
*’ but argument is of type ‘long unsigned int’
extern void *mmap (void *__addr, size_t __len, int __prot,
--
Rafael D. Tinoco
Linaro Kernel Validation
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] proc: fixup map_files test on arm
2018-11-12 16:35 ` Rafael David Tinoco
@ 2018-11-13 16:54 ` Alexey Dobriyan
2018-11-13 17:01 ` Cyrill Gorcunov
0 siblings, 1 reply; 7+ messages in thread
From: Alexey Dobriyan @ 2018-11-13 16:54 UTC (permalink / raw)
To: akpm
Cc: Cyrill Gorcunov, linux-kernel, linux-kselftest, shuah,
Rafael David Tinoco
https://bugs.linaro.org/show_bug.cgi?id=3782
Turns out arm doesn't allow to map address 0, so try minimum virtual
address instead.
Reported-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Tested-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
tools/testing/selftests/proc/proc-self-map-files-002.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/tools/testing/selftests/proc/proc-self-map-files-002.c
+++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
@@ -13,7 +13,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* 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 <sys/types.h>
#include <sys/stat.h>
@@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b)
int main(void)
{
const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
+#ifdef __arm__
+ unsigned long va = 2 * PAGE_SIZE;
+#else
+ unsigned long va = 0;
+#endif
void *p;
int fd;
unsigned long a, b;
@@ -55,7 +60,7 @@ int main(void)
if (fd == -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 (errno == EPERM)
return 2;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] proc: fixup map_files test on arm
2018-11-13 16:54 ` [PATCH v2] " Alexey Dobriyan
@ 2018-11-13 17:01 ` Cyrill Gorcunov
0 siblings, 0 replies; 7+ messages in thread
From: Cyrill Gorcunov @ 2018-11-13 17:01 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: akpm, linux-kernel, linux-kselftest, shuah, Rafael David Tinoco
On Tue, Nov 13, 2018 at 07:54:46PM +0300, Alexey Dobriyan wrote:
> https://bugs.linaro.org/show_bug.cgi?id=3782
>
> Turns out arm doesn't allow to map address 0, so try minimum virtual
> address instead.
>
> Reported-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
> Tested-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Thank you!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-11-13 17:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-10 18:49 [PATCH] proc: fixup map_files test on arm Alexey Dobriyan
2018-11-11 2:48 ` Rafael David Tinoco
2018-11-12 14:14 ` Alexey Dobriyan
2018-11-12 15:55 ` Cyrill Gorcunov
2018-11-12 16:35 ` Rafael David Tinoco
2018-11-13 16:54 ` [PATCH v2] " Alexey Dobriyan
2018-11-13 17:01 ` Cyrill Gorcunov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).