public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH 01/15] debug: Adapt fortify tests to libsupport
Date: Thu, 21 Dec 2023 14:54:23 -0500	[thread overview]
Message-ID: <3d246e68-9f5a-4f4d-aee4-db08b61b37ad@gotplt.org> (raw)
In-Reply-To: <20231221185929.1307116-2-adhemerval.zanella@linaro.org>



On 2023-12-21 13:59, Adhemerval Zanella wrote:
> Checked on aarch64, armhf, x86_64, and i686.
> ---

LGTM.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

>   debug/test-stpcpy_chk.c  |  2 +-
>   debug/test-strcpy_chk.c  |  2 +-
>   debug/tst-fortify.c      | 55 +++++++++++++++++++++-------------------
>   debug/tst-longjmp_chk.c  |  8 +++---
>   debug/tst-longjmp_chk2.c |  6 ++---
>   debug/tst-longjmp_chk3.c |  6 ++---
>   6 files changed, 39 insertions(+), 40 deletions(-)
> 
> diff --git a/debug/test-stpcpy_chk.c b/debug/test-stpcpy_chk.c
> index 938f3c0ceb..0b9fed49cc 100644
> --- a/debug/test-stpcpy_chk.c
> +++ b/debug/test-stpcpy_chk.c
> @@ -19,7 +19,7 @@
>   #define STRCPY_RESULT(dst, len) ((dst) + (len))
>   #define TEST_MAIN
>   #define TEST_NAME "stpcpy_chk"
> -#include "../string/test-string.h"
> +#include <string/test-string.h>
>   
>   extern void __attribute__ ((noreturn)) __chk_fail (void);
>   char *simple_stpcpy_chk (char *, const char *, size_t);
> diff --git a/debug/test-strcpy_chk.c b/debug/test-strcpy_chk.c
> index 792e789e1e..684e0bdd9b 100644
> --- a/debug/test-strcpy_chk.c
> +++ b/debug/test-strcpy_chk.c
> @@ -20,7 +20,7 @@
>   # define STRCPY_RESULT(dst, len) dst
>   # define TEST_MAIN
>   # define TEST_NAME "strcpy_chk"
> -# include "../string/test-string.h"
> +# include <string/test-string.h>
>   
>   /* This test case implicitly tests the availability of the __chk_fail
>      symbol, which is part of the public ABI and may be used
> diff --git a/debug/tst-fortify.c b/debug/tst-fortify.c
> index 3744aadad4..20e926751a 100644
> --- a/debug/tst-fortify.c
> +++ b/debug/tst-fortify.c
> @@ -23,6 +23,7 @@
>   
>   #include <assert.h>
>   #include <fcntl.h>
> +#include <limits.h>
>   #include <locale.h>
>   #include <obstack.h>
>   #include <setjmp.h>
> @@ -36,6 +37,10 @@
>   #include <sys/select.h>
>   #include <sys/socket.h>
>   #include <sys/un.h>
> +#include <paths.h>
> +
> +#include <support/temp_file.h>
> +#include <support/support.h>
>   
>   #ifndef _GNU_SOURCE
>   # define MEMPCPY memcpy
> @@ -52,15 +57,10 @@
>   #define obstack_chunk_alloc malloc
>   #define obstack_chunk_free free
>   
> -char *temp_filename;
> -static void do_prepare (void);
> -static int do_test (void);
> -#define PREPARE(argc, argv) do_prepare ()
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +static char *temp_filename;
>   
>   static void
> -do_prepare (void)
> +do_prepare (int argc, char *argv[])
>   {
>     int temp_fd = create_temp_file ("tst-chk1.", &temp_filename);
>     if (temp_fd == -1)
> @@ -77,10 +77,11 @@ do_prepare (void)
>         exit (1);
>       }
>   }
> +#define PREPARE do_prepare
>   
> -volatile int chk_fail_ok;
> -volatile int ret;
> -jmp_buf chk_fail_buf;
> +static volatile int chk_fail_ok;
> +static volatile int ret;
> +static jmp_buf chk_fail_buf;
>   
>   static void
>   handler (int sig)
> @@ -102,22 +103,22 @@ wchar_t wbuf[10];
>   #define buf_size sizeof (buf)
>   #endif
>   
> -volatile size_t l0;
> -volatile char *p;
> -volatile wchar_t *wp;
> -const char *str1 = "JIHGFEDCBA";
> -const char *str2 = "F";
> -const char *str3 = "%s%n%s%n";
> -const char *str4 = "Hello, ";
> -const char *str5 = "World!\n";
> -const wchar_t *wstr1 = L"JIHGFEDCBA";
> -const wchar_t *wstr2 = L"F";
> -const wchar_t *wstr3 = L"%s%n%s%n";
> -const wchar_t *wstr4 = L"Hello, ";
> -const wchar_t *wstr5 = L"World!\n";
> -char buf2[10] = "%s";
> -int num1 = 67;
> -int num2 = 987654;
> +static volatile size_t l0;
> +static volatile char *p;
> +static volatile wchar_t *wp;
> +static const char *str1 = "JIHGFEDCBA";
> +static const char *str2 = "F";
> +static const char *str3 = "%s%n%s%n";
> +static const char *str4 = "Hello, ";
> +static const char *str5 = "World!\n";
> +static const wchar_t *wstr1 = L"JIHGFEDCBA";
> +static const wchar_t *wstr2 = L"F";
> +static const wchar_t *wstr3 = L"%s%n%s%n";
> +static const wchar_t *wstr4 = L"Hello, ";
> +static const wchar_t *wstr5 = L"World!\n";
> +static char buf2[10] = "%s";
> +static int num1 = 67;
> +static int num2 = 987654;
>   
>   #define FAIL() \
>     do { printf ("Failure on line %d\n", __LINE__); ret = 1; } while (0)
> @@ -1815,3 +1816,5 @@ do_test (void)
>   
>     return ret;
>   }
> +
> +#include <support/test-driver.c>
> diff --git a/debug/tst-longjmp_chk.c b/debug/tst-longjmp_chk.c
> index e4e93d2a36..37f858606b 100644
> --- a/debug/tst-longjmp_chk.c
> +++ b/debug/tst-longjmp_chk.c
> @@ -10,11 +10,7 @@
>   #include <stdlib.h>
>   #include <unistd.h>
>   
> -
> -static int do_test(void);
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> -
> +#include <support/support.h>
>   
>   static jmp_buf b;
>   
> @@ -76,3 +72,5 @@ do_test (void)
>     puts ("second longjmp returned");
>     return 1;
>   }
> +
> +#include <support/test-driver.c>
> diff --git a/debug/tst-longjmp_chk2.c b/debug/tst-longjmp_chk2.c
> index 1810ab44d7..7e1ee3edc5 100644
> --- a/debug/tst-longjmp_chk2.c
> +++ b/debug/tst-longjmp_chk2.c
> @@ -10,9 +10,7 @@
>   #include <sys/resource.h>
>   #include <unistd.h>
>   
> -static int do_test (void);
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/support.h>
>   
>   static jmp_buf mainloop;
>   static sigset_t mainsigset;
> @@ -126,3 +124,5 @@ do_test (void)
>   
>     return 0;
>   }
> +
> +#include <support/test-driver.c>
> diff --git a/debug/tst-longjmp_chk3.c b/debug/tst-longjmp_chk3.c
> index f1e576ad5b..3050806c44 100644
> --- a/debug/tst-longjmp_chk3.c
> +++ b/debug/tst-longjmp_chk3.c
> @@ -20,10 +20,6 @@
>   #include <signal.h>
>   #include <string.h>
>   
> -static int do_test (void);
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> -
>   static char buf[SIGSTKSZ * 4];
>   static jmp_buf jb;
>   
> @@ -83,3 +79,5 @@ do_test (void)
>     puts ("longjmp returned and shouldn't");
>     return 1;
>   }
> +
> +#include <support/test-driver.c>

  reply	other threads:[~2023-12-21 19:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 18:59 [PATCH 00/15] Improve fortify support with clang Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 01/15] debug: Adapt fortify tests to libsupport Adhemerval Zanella
2023-12-21 19:54   ` Siddhesh Poyarekar [this message]
2023-12-21 18:59 ` [PATCH 02/15] debug: Increase tst-fortify checks for compiler without __va_arg_pack support Adhemerval Zanella
2023-12-21 20:02   ` Siddhesh Poyarekar
2023-12-21 21:43     ` Joseph Myers
2023-12-22 12:29     ` Adhemerval Zanella Netto
2023-12-21 18:59 ` [PATCH 03/15] debug: Add fortify dprintf tests Adhemerval Zanella
2023-12-21 20:03   ` Siddhesh Poyarekar
2023-12-21 18:59 ` [PATCH 04/15] debug: Add fortify syslog tests Adhemerval Zanella
2023-12-21 20:06   ` Siddhesh Poyarekar
2023-12-21 18:59 ` [PATCH 05/15] debug: Add fortify wprintf tests Adhemerval Zanella
2023-12-21 20:08   ` Siddhesh Poyarekar
2023-12-29 13:56     ` Adhemerval Zanella Netto
2023-12-21 18:59 ` [PATCH 06/15] cdefs.h: Add clang fortify directives Adhemerval Zanella
2023-12-21 21:33   ` Joseph Myers
2023-12-22 12:36     ` Adhemerval Zanella Netto
2023-12-21 18:59 ` [PATCH 07/15] libio: Improve fortify with clang Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 08/15] string: " Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 09/15] stdlib: " Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 10/15] unistd: " Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 11/15] socket: " Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 12/15] syslog: " Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 13/15] wcsmbs: " Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 14/15] debug: Improve fcntl.h fortify warnings " Adhemerval Zanella
2023-12-21 18:59 ` [PATCH 15/15] debug: Improve mqueue.h " Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d246e68-9f5a-4f4d-aee4-db08b61b37ad@gotplt.org \
    --to=siddhesh@gotplt.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).