All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit
@ 2023-10-24  8:49 Petr Vorel
  2023-10-24  8:49 ` [LTP] [PATCH 2/2] stack_clash: Compile with -Wno-infinite-recursion Petr Vorel
  2023-10-25  9:29 ` [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit Cyril Hrubis
  0 siblings, 2 replies; 8+ messages in thread
From: Petr Vorel @ 2023-10-24  8:49 UTC (permalink / raw)
  To: ltp; +Cc: Rick Edgecombe, Pavel Boldin

To avoid "defined but not used" warnings when compiled on 32bit.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/cve/stack_clash.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/cve/stack_clash.c b/testcases/cve/stack_clash.c
index 3a99c49bb..56b970a1b 100644
--- a/testcases/cve/stack_clash.c
+++ b/testcases/cve/stack_clash.c
@@ -92,6 +92,7 @@ void segv_handler(int sig, siginfo_t *info, void *data LTP_ATTRIBUTE_UNUSED)
 		_exit(EXIT_SUCCESS);
 }
 
+#ifdef __x86_64__
 static void force_bottom_up(void)
 {
 	FILE *fh;
@@ -134,6 +135,7 @@ static void force_bottom_up(void)
 out:
 	SAFE_FCLOSE(fh);
 }
+#endif
 
 unsigned long read_stack_addr_from_proc(unsigned long *stack_size)
 {
@@ -187,6 +189,7 @@ void __attribute__((noinline)) preallocate_stack(unsigned long required)
 	garbage[0] = garbage[required - 1] = '\0';
 }
 
+#ifdef __x86_64__
 static void do_mmap_placement_test(unsigned long stack_addr, unsigned long gap)
 {
 	void *map_test_gap;
@@ -208,6 +211,7 @@ static void do_mmap_placement_test(unsigned long stack_addr, unsigned long gap)
 		SAFE_MUNMAP(map_test_gap, MAPPED_LEN);
 	}
 }
+#endif
 
 void do_child(void)
 {
-- 
2.42.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [LTP] [PATCH 2/2] stack_clash: Compile with -Wno-infinite-recursion
  2023-10-24  8:49 [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit Petr Vorel
@ 2023-10-24  8:49 ` Petr Vorel
  2023-10-25  9:30   ` Cyril Hrubis
  2023-10-25  9:29 ` [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit Cyril Hrubis
  1 sibling, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2023-10-24  8:49 UTC (permalink / raw)
  To: ltp; +Cc: Rick Edgecombe, Pavel Boldin

The algorithm is based on recursive calling of exhaust_stack_into_sigsegv(),
remove the warning.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/cve/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/cve/Makefile b/testcases/cve/Makefile
index c5308794d..01b9b9ccb 100644
--- a/testcases/cve/Makefile
+++ b/testcases/cve/Makefile
@@ -7,7 +7,7 @@ include $(top_srcdir)/include/mk/testcases.mk
 
 CFLAGS			+= -D_GNU_SOURCE
 
-stack_clash:	CFLAGS += -fno-optimize-sibling-calls
+stack_clash:	CFLAGS += -fno-optimize-sibling-calls -Wno-infinite-recursion
 
 cve-2016-7042:	LDLIBS += $(KEYUTILS_LIBS)
 
-- 
2.42.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit
  2023-10-24  8:49 [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit Petr Vorel
  2023-10-24  8:49 ` [LTP] [PATCH 2/2] stack_clash: Compile with -Wno-infinite-recursion Petr Vorel
@ 2023-10-25  9:29 ` Cyril Hrubis
  2023-10-25 23:14   ` Petr Vorel
  1 sibling, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2023-10-25  9:29 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Rick Edgecombe, Pavel Boldin, ltp

Hi!
> To avoid "defined but not used" warnings when compiled on 32bit.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/cve/stack_clash.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/testcases/cve/stack_clash.c b/testcases/cve/stack_clash.c
> index 3a99c49bb..56b970a1b 100644
> --- a/testcases/cve/stack_clash.c
> +++ b/testcases/cve/stack_clash.c
> @@ -92,6 +92,7 @@ void segv_handler(int sig, siginfo_t *info, void *data LTP_ATTRIBUTE_UNUSED)
>  		_exit(EXIT_SUCCESS);
>  }
>  
> +#ifdef __x86_64__
>  static void force_bottom_up(void)
>  {
>  	FILE *fh;
> @@ -134,6 +135,7 @@ static void force_bottom_up(void)
>  out:
>  	SAFE_FCLOSE(fh);
>  }
> +#endif

Maybe I'm blind but this function does not seem to be called from inside
of #ifdef __x86_64__.

>  unsigned long read_stack_addr_from_proc(unsigned long *stack_size)
>  {
> @@ -187,6 +189,7 @@ void __attribute__((noinline)) preallocate_stack(unsigned long required)
>  	garbage[0] = garbage[required - 1] = '\0';
>  }
>  
> +#ifdef __x86_64__
>  static void do_mmap_placement_test(unsigned long stack_addr, unsigned long gap)
>  {
>  	void *map_test_gap;
> @@ -208,6 +211,7 @@ static void do_mmap_placement_test(unsigned long stack_addr, unsigned long gap)
>  		SAFE_MUNMAP(map_test_gap, MAPPED_LEN);
>  	}
>  }
> +#endif

This part looks good.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 2/2] stack_clash: Compile with -Wno-infinite-recursion
  2023-10-24  8:49 ` [LTP] [PATCH 2/2] stack_clash: Compile with -Wno-infinite-recursion Petr Vorel
@ 2023-10-25  9:30   ` Cyril Hrubis
  2023-10-25 23:15     ` Petr Vorel
  0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2023-10-25  9:30 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Rick Edgecombe, Pavel Boldin, ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit
  2023-10-25  9:29 ` [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit Cyril Hrubis
@ 2023-10-25 23:14   ` Petr Vorel
  2023-10-26  8:43     ` Cyril Hrubis
  0 siblings, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2023-10-25 23:14 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Rick Edgecombe, Pavel Boldin, ltp

Hi Cyril,

> Hi!
> > To avoid "defined but not used" warnings when compiled on 32bit.

> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  testcases/cve/stack_clash.c | 4 ++++
> >  1 file changed, 4 insertions(+)

> > diff --git a/testcases/cve/stack_clash.c b/testcases/cve/stack_clash.c
Hi Cyril,

> > +#ifdef __x86_64__
> >  static void force_bottom_up(void)
> >  {
> >  	FILE *fh;
> > @@ -134,6 +135,7 @@ static void force_bottom_up(void)
> >  out:
> >  	SAFE_FCLOSE(fh);
> >  }
> > +#endif

> Maybe I'm blind but this function does not seem to be called from inside
> of #ifdef __x86_64__.

force_bottom_up() is called only inside do_mmap_placement_test(), which is also
wrapped with #ifdef __x86_64_.

I did not notice that, compiler pointed it out :).

Can I merge with your RBT?

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 2/2] stack_clash: Compile with -Wno-infinite-recursion
  2023-10-25  9:30   ` Cyril Hrubis
@ 2023-10-25 23:15     ` Petr Vorel
  0 siblings, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2023-10-25 23:15 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Rick Edgecombe, Pavel Boldin, ltp

Hi Cyril,

thanks, merged!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit
  2023-10-25 23:14   ` Petr Vorel
@ 2023-10-26  8:43     ` Cyril Hrubis
  2023-10-26  9:37       ` Petr Vorel
  0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2023-10-26  8:43 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Rick Edgecombe, Pavel Boldin, ltp

Hi!
> force_bottom_up() is called only inside do_mmap_placement_test(), which is also
> wrapped with #ifdef __x86_64_.
> 
> I did not notice that, compiler pointed it out :).

Ah I was blind yesterday, sorry.

> Can I merge with your RBT?

Of course.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit
  2023-10-26  8:43     ` Cyril Hrubis
@ 2023-10-26  9:37       ` Petr Vorel
  0 siblings, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2023-10-26  9:37 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Rick Edgecombe, Pavel Boldin, ltp

Hi Cyril,

> Hi!
> > force_bottom_up() is called only inside do_mmap_placement_test(), which is also
> > wrapped with #ifdef __x86_64_.

> > I did not notice that, compiler pointed it out :).

> Ah I was blind yesterday, sorry.

No problem, thanks for a review, merged.

Kind regards,
Petr

> > Can I merge with your RBT?

> Of course.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-26  9:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24  8:49 [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit Petr Vorel
2023-10-24  8:49 ` [LTP] [PATCH 2/2] stack_clash: Compile with -Wno-infinite-recursion Petr Vorel
2023-10-25  9:30   ` Cyril Hrubis
2023-10-25 23:15     ` Petr Vorel
2023-10-25  9:29 ` [LTP] [PATCH 1/2] stack_clash: Guard functions used only in 64bit Cyril Hrubis
2023-10-25 23:14   ` Petr Vorel
2023-10-26  8:43     ` Cyril Hrubis
2023-10-26  9:37       ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.