mcctrl: remove in-kernel calls to syscalls

Since 4.17.0, kernel cannot call syscalls directly because the calling
convention can be different on x86_64, as explained in this email:
https://lore.kernel.org/lkml/20180325162527.GA17492@light.dominikbrodowski.net

Use the ksys_* alternatives instead when possible, or for readlink use
do_readlinkat (and use readlinkat all the time to simplify ifdefs)

It might be possible to change some of these without ifdefs, but for
example ksys_unshare only got introduced in 4.17 so we need to keep some
syscall calling...

Change-Id: Ic47e184b29ef8b21731b2eae6193b0af2548b872
This commit is contained in:
Dominique Martinet
2018-11-19 17:27:26 +09:00
parent db4d19e419
commit 583cb94667
3 changed files with 25 additions and 9 deletions

View File

@@ -921,7 +921,7 @@ static int read_link(char *buf, size_t bufsize, char *fmt, ...)
old_fs = get_fs();
set_fs(KERNEL_DS);
ss = mcctrl_sys_readlink(filename, buf, bufsize);
ss = mcctrl_sys_readlinkat(AT_FDCWD, filename, buf, bufsize);
set_fs(old_fs);
if (ss < 0) {
error = ss;