All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: linux-modules@vger.kernel.org
Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Subject: [PATCH 6/6] testsuite: explain why overriding function may fail
Date: Wed,  3 Jan 2018 14:29:24 -0800	[thread overview]
Message-ID: <20180103222924.26347-7-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20180103222924.26347-1-lucas.demarchi@intel.com>

On my computer `testsuite/test-modprobe modprobe_install_cmd_loop` was
failing because when it forks off the shell the child process ends up
calling syscall() which are are supposed to wrap. Here's the backtrace:

	#0  0x00007ffff6fdb66b in raise () from /lib64/libc.so.6
	#1  0x00007ffff6fdd381 in abort () from /lib64/libc.so.6
	#2  0x00007ffff77bac97 in syscall (__sysno=<optimized out>)
	    at testsuite/init_module.c:362
	#3  0x00007fffef92d4e7 in hashmap_base_new.lto_priv () from /lib64/libnss_systemd.so.2
	#4  0x00007fffef953f50 in sd_bus_open_system () from /lib64/libnss_systemd.so.2
	#5  0x00007fffef943123 in _nss_systemd_getpwuid_r () from /lib64/libnss_systemd.so.2
	#6  0x00007ffff707eea5 in getpwuid_r@@GLIBC_2.2.5 () from /lib64/libc.so.6
	#7  0x00007ffff707e608 in getpwuid () from /lib64/libc.so.6
	#8  0x00005555555859e1 in get_current_user_info.part ()
	#9  0x00005555555a375a in initialize_shell_variables ()
	#10 0x0000555555580fde in shell_initialize ()
	#11 0x00005555555846ff in main ()<Paste>

The reason it fails on my system and not on, for e.g., a new one set up with
mkosi is that the call to getpwuid() depends on the contents
/etc/nsswitch.conf. The systemd module calls syscall() to implement gettid()
which we can't forward due to being a variadic function.

No fix is provided here, but at least it's explained why this happens.
---
 testsuite/init_module.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/testsuite/init_module.c b/testsuite/init_module.c
index b7d220b..199186b 100644
--- a/testsuite/init_module.c
+++ b/testsuite/init_module.c
@@ -356,9 +356,14 @@ TS_EXPORT long int syscall(long int __sysno, ...)
 	}
 
 	/*
-	 * FIXME: no way to call the libc function - let's hope there are no
-	 * other users.
+	 * FIXME: no way to call the libc function due since this is a
+	 * variadic argument function and we don't have a vsyscall() variant
+	 * this may fail if a library or process is trying to call syscall()
+	 * directly, for example to implement gettid().
 	 */
+	fprintf(stderr, "FIXME FIXME FIXME: could not wrap call to syscall(%ld), this should not happen\n",
+		__sysno);
+
 	abort();
 }
 
-- 
2.14.3


  parent reply	other threads:[~2018-01-03 22:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 22:29 [PATCH 0/6] prepare for release Lucas De Marchi
2018-01-03 22:29 ` [PATCH 1/6] build: add mkosi hooks Lucas De Marchi
2018-01-03 22:29 ` [PATCH 2/6] build: use tool from configure Lucas De Marchi
2018-01-03 22:29 ` [PATCH 3/6] testsuite: generalize mkosi support for other distros Lucas De Marchi
2018-01-03 22:29 ` [PATCH 4/6] testsuite: add Fedora's mkosi configuration Lucas De Marchi
2018-01-03 22:29 ` [PATCH 5/6] testsuite: add missing error handling Lucas De Marchi
2018-01-03 22:29 ` Lucas De Marchi [this message]
2018-01-08 21:33 ` [PATCH 0/6] prepare for release Lucas De Marchi

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=20180103222924.26347-7-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=yauheni.kaliuta@redhat.com \
    /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 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.