This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix i386 memmove issue [BZ #22644]
- From: Andreas Schwab <schwab at suse dot de>
- To: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>, max at quendi dot de
- Date: Mon, 19 Feb 2018 11:13:45 +0100
- Subject: Re: [PATCH] Fix i386 memmove issue [BZ #22644]
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3s5b2a6o_CMS0cJ35oE3SuJUHssqLAUY94LSZhEEtG71A@mail.gmail.com>
On Feb 19 2018, Andrew Senkevich <andrew.n.senkevich@gmail.com> wrote:
> diff --git a/string/test-memmove.c b/string/test-memmove.c
> index edc7a4c..8dc152b
> --- a/string/test-memmove.c
> +++ b/string/test-memmove.c
> @@ -245,6 +245,49 @@ do_random_tests (void)
> }
> }
>
> +#if __SIZEOF_POINTER__ == 4
> +static void
> +do_test2 (void)
> +{
> + uint32_t i;
> + uint32_t num = 0x20000000;
> + uint32_t * large_buf = mmap (0, sizeof(uint32_t) * num, PROT_READ |
> PROT_WRITE,
> + MAP_PRIVATE | MAP_ANON, -1, 0);
> + if (large_buf == MAP_FAILED)
> + error (EXIT_FAILURE, errno, "large mmap failed");
> +
> + if (!((uint32_t)(large_buf) < (0x80000000 - 128) && (0x80000000 +
> 128) < (uint32_t)(&large_buf[num])))
> + {
> + error (0, 0,"allocated large memory doesn't cross 0x80000000 boundary");
> + ret = 1;
> + return;
Please properly fold long lines, and remove the redundant parens. Also,
there is no guarantee that the address range is unallocated.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."