Skip to contentSkip to conversation

Jan Kiszka : Add regression test for mprotect on pinned memory

Xenomai-core Gilles Chanteperdrix 2 participants 2 messages Apr 2, 2012 – Apr 3, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 31 lines · GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 410e90d085d21dc913f8724efafe6ae75bd3c952
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=410e90d085d21dc913f8724efafe6ae75bd3c952
Author: Jan Kiszka <[email protected]>
Date:   Fri Mar 30 18:06:27 2012 +0200

Add regression test for mprotect on pinned memory

This tests both the original issue of mprotect reintroducing COW pages to Xenomai processes as well as the recently fixed zero page corruption.

(quoted diff) +16 -0
+static void check_inner(const char *fn, int line, const char *msg,
+			int status, int expected)
+{
+	if (status == expected)
+		return;
+
+	rt_task_set_mode(T_WARNSW, 0, NULL);
+	rt_print_flush_buffers();
(...)
+static void check_value_inner(const char *fn, int line, const char *msg,
+			      int value, int expected)
+{
+	if (value == expected)
+		return;
+
+	rt_task_set_mode(T_WARNSW, 0, NULL);
+	rt_print_flush_buffers();

Review

Quoted 10 lines
(quoted diff) +8 -0
(...)
+void sigdebug_handler(int sig, siginfo_t *si, void *context)
+{
+	unsigned int reason = si->si_value.sival_int;
+
+	rt_print_flush_buffers();
(...)
+
+	rt_task_set_mode(T_WARNSW, 0, NULL);
+	rt_print_flush_buffers();

Maybe you could use posix skin's printf instead of putting calls to rt_print_flush_buffers all over the place? I did not mean for this call to be exported, I only added it for internal use by the posix skin.

Signature · 1 line
					    Gilles.
#2 lore raw
Quoted 38 lines · Gilles Chanteperdrix
Quoted 37 lines · GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 410e90d085d21dc913f8724efafe6ae75bd3c952
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=410e90d085d21dc913f8724efafe6ae75bd3c952
Author: Jan Kiszka <[email protected]>
Date:   Fri Mar 30 18:06:27 2012 +0200

Add regression test for mprotect on pinned memory

This tests both the original issue of mprotect reintroducing COW pages to Xenomai processes as well as the recently fixed zero page corruption.

(quoted diff) +21 -0
+static void check_inner(const char *fn, int line, const char *msg,
+			int status, int expected)
+{
+	if (status == expected)
+		return;
+
+	rt_task_set_mode(T_WARNSW, 0, NULL);
+	rt_print_flush_buffers();
(...)
+static void check_value_inner(const char *fn, int line, const char *msg,
+			      int value, int expected)
+{
+	if (value == expected)
+		return;
+
+	rt_task_set_mode(T_WARNSW, 0, NULL);
+	rt_print_flush_buffers();
(...)
+void sigdebug_handler(int sig, siginfo_t *si, void *context)
+{
+	unsigned int reason = si->si_value.sival_int;
+
+	rt_print_flush_buffers();
Quoted 9 lines

Review

Quoted 4 lines

(...)

(quoted diff) +3 -0
+
+	rt_task_set_mode(T_WARNSW, 0, NULL);
+	rt_print_flush_buffers();

Maybe you could use posix skin's printf instead of putting calls to rt_print_flush_buffers all over the place? I did not mean for this call to be exported, I only added it for internal use by the posix skin.

Could be done, likely together with a complete switch to posix.

I could also start to use the check_* wrappers that I just discovered. BTW, the native version lacks that flush unless it's used in native+posix context. I will write a fix.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux