Commit Graph

2346 Commits

Author SHA1 Message Date
c32edff2bb uti: rename x86-specific 'fs' to 'tls' + arm implem
Note: the original fujitsu implementation didn't rename the various
save_fs function/desc to save_tls for some reason, might as well go all
the way though...

Change-Id: Ic362c15c8b320c4d258d2ead8c5fd4eafd9d0ae9
Fujitsu: POSTK_DEBUG_ARCH_DEP_91
2019-03-22 16:38:29 +09:00
8356ef6c96 arm64: uti: Add arch-dependent helper for context switch
arm64 performs context-switch in kernel space instead of user space as in
x86_64.

Change-Id: Ib119b9ff014effb970183ee86cfac67fab773cba
Futjitsu: POSTK_DEBUG_ARCH_DEP_99
2019-03-22 06:52:21 +00:00
63d500515a mcexec: fix printf format warning
Some old commit before -Werror was enabled got merged,
blocking other builds. Quickly fix before anyone notices

Change-Id: I5a034cef6f79e3e99b381bb1a5d97088e33a6718
2019-03-22 05:25:34 +00:00
791e8c2114 Remove mcoverlayfs code
mcoverlayfs code is now unused (technically should work on top of the
soft emulation but not well tested, and untested unused code is bad).
Remove it.

Left the unshare/bind_mount_recursive code in mcexec in a new
MCEXEC_BIND_MOUNT ifdef (only in config.h.in directly to discourage use.
it disables the ioctl as well, but the main code is still compiled to
keep up to date with linux api changes... although it's using kallsyms
lookup so it does not validate much more than "the symbol still exists")

I honestly think this should go as well (people who would want to use it
are root and could do it manually), but will give up for now.

Change-Id: I832b6a8ab19e24ed67a1a5044b1c6c32381ae0aa
2019-03-22 05:18:43 +00:00
0bb612caea Fix test of getrusage fixes
* fix: Bug for getrusage return incorrect ru_maxrss
* fix: Bug for getrusage(RUSAGE_CHILDREN) return parent info
       (POSTK_DEBUG_TEIX_72)
* fix: Bug for getrusage often return incorrect ru_stime

Refs: #1032
Refs: #1033
Refs: #1034

Change-Id: Ifba95e4cb48ae551839819eb3abe26b37da4b196
2019-03-22 05:15:00 +00:00
5e992bc195 arm64: test: Add Makefile that was ignored commit.
Target commit:
  Test "Direct access to McKernel memory from Linux." on arm64
  Test "Scalable Vector Extension (SVE) support." on arm64

Change-Id: Ia9dc97c5cf0c4cf223423b4257745ea2101bee1d
2019-03-22 05:08:25 +00:00
08f817a654 page fault: clear writable bit for non-dirtying access to shared ranges
Change-Id: I3f3212b2aac79587f04450dfbdee9cb8a56bee04
Fujitsu: POSTK_DEBUG_ARCH_DEP_21
2019-03-22 05:03:03 +00:00
b87ac8b8c0 reproductible builds: remove most install paths in c code
In order to speed up test bot work it would be helpful to check for
identical build outputs and skip tests if required.

This removes most use of the install path in c code:
 - ql_mpi uses /proc/self/exe and looks for talker/server in same
directory as itself
 - mcexec looks for libihk.so in /proc/self/maps and use that path for
LD_PRELOAD prefix path
 - rootfsdir is not used right now but until a better fix happens just
hardcode it, someone who wants to change it can set it through cmake

There is one last occurence of the install directory, MCEXEC_PATH in
mcctrl's binfmt code, for which the build system will just overwrite it
to a constant string at build time instead of trying to remove it too
hard. It would be possible to pass it as a kernel parameter or look for
mcexec in PATH but this is too much work for now.

Change-Id: I5d1352bc5748a1ea10dcae4be630f30a07609296
2019-03-22 05:01:32 +00:00
a48a2cd3e8 add definition of util_register_desc system call number
Change-Id: I2047d33b5667761ce8399bad78eff6ab668b6ce4
2019-03-22 04:58:24 +00:00
7c238c27c9 uti: Check syscall number definition in hook()
Change-Id: I24d226199d03d23a12710ff1cad9fef29a6feedd
2019-03-22 04:58:04 +00:00
de77d2b061 add syscall_intercept.c to the mck_syscall_intercept
Change-Id: Iff8cfd2868118b6a9db7e24e4f00537251d1346c
2019-03-22 04:55:18 +00:00
52f89cf8fa add system call execution for uti
Change-Id: Ide79726b79964e72596ed78c87ec61d1eaf7e1c7
2019-03-22 04:54:34 +00:00
c96dfb0c68 mcstop: add -k to kill processses using /dev/mcos* before shutdown
Use lsof to check for processes that still open /dev/mcosX at shutdown
time.
If lsof is not installed then the check is just not done (empty PROCS
result)

If -k is not passed, print a message listing pids of users and exit
(taking bets someone will use that and sed to kill out of mcstop+release
and rerun the stop script instead of passing -k at some point)

Change-Id: Idba7486fdede4990d9885d23f8077f33839daeed
2019-03-22 04:33:33 +00:00
21c9e57646 page fault: use cow for private device mappings
Private device mappings still need copy-on-write to work, even if
there is no page.

Change-Id: I96e3e1eea81104f6b09bb7fda1105d9eeb489155
Refs: #1254
2019-03-22 04:30:55 +00:00
312b6c171b README.md: update package names
Change-Id: Ie4d37d724e60e8e473cb60db8a77b5b3a9681f4e
2019-03-19 02:20:38 +00:00
2ce695b47b proc: resurrect /proc/PID/stat and fix a few fields
Change-Id: I8ffcfde4db78c66ea10845a0451ae2610261f832
2019-03-18 20:33:29 +09:00
e5c1fdf129 MCS lock: make implementation arch independent
Change-Id: Ie5b2182555bbe1a11a005988db069d4b38f85401
2019-03-18 09:53:30 +00:00
9e3dd53c58 arm64: sve: coredump bug fix in non-sve environment.
Change-Id: I4cba5580b6367c67bef457c0273e9b70ad4a0756
2019-03-18 08:12:37 +00:00
fe53c6e0a5 Test "Process swap (swapout)" on arm64
Change-Id: I1eecb046575480966febbcb55e5f4ade6313275b
2019-03-18 08:12:14 +00:00
e988bfaf50 test: uti: Elaborate descriptions of CT12-20
Change-Id: Idfaa5fc3bfc7b65e24873f0c5e15c31a9d129420
2019-03-18 16:59:07 +09:00
f6f48b1210 Test "Direct access to McKernel memory from Linux." on arm64
Change-Id: I6e862146c3b591e671c526302bb1aad787f6bb83
2019-03-18 06:26:43 +00:00
70b42fde5d arm64: cmake: Add -mgeneral-regs-only option.
Change-Id: I0cbdc65c4b95195831344f4006bfc85b1ea58139
2019-03-12 17:26:18 +09:00
ccb36a5849 cmake: change how warning flags are added
Setting CMAKE_C_FLAGS_DEBUG does not work as first expected:
 - set(... CACHE) didn't do anything because the variables were
initialized previously
 - We could set with FORCE but then users could not change the value
 - There is a way to only do that on initial cmake run but it has the
same problem

Thus, use a new regular cache variable directly instead

Change-Id: I20741fb385c171c6c1088bbd6c25666067e07288
2019-03-08 17:22:20 +09:00
ea7f517e3d arm64: ptrace: Fix overwriting 1st argument with return value
Since arm64 shares the return value with the area of
the first argument, rewriting the return value before
the system call execution completes destroys the first argument.

Change-Id: I959944879254d8dd3a29489a65d8f274d45338e6
Fujitsu: POSTK_DEBUG_ARCH_DEP_110
2019-03-08 08:06:19 +00:00
ac18a24a27 arm64: fix phys_to_virt() calculation to be the same as Linux.
Change-Id: Ibbe17d33fd80eacff990b053fa17d8d320c227f1
2019-03-07 16:51:18 +09:00
8880710fad README.md: few minor updates
Change-Id: I7207ab2cf6ca5b69b464e0c41d2dd0ce3e80b674
2019-03-07 13:12:39 +09:00
03a85825ed copy_user_pte: base memobj copy on range & VR_PRIVATE
Some memobjs (e.g. devobj) will not be considered 'in memobj' by
page_is_in_memobj.
Instead of trying to play whack-a-mole with the non-fileobj memobjs,
base the copy check on range's memobj and VR_PRIVATE (do not copy
MAP_SHARED mappings, so the fault handler will do the right thing™
when required)

Change-Id: Ic32cdc7766754f6559753b34845eb8c5cff6ed13
Refs: #1255
2019-03-06 17:44:11 +09:00
940eeca6f5 x86 spinlock trylock: make next initializer old-gcc friendly
old gcc versions are stupid with nested structs and need us
to initialize .tickets.head and .tickets.tail in one go

Change-Id: I0d4caf8236066e7edf4a12e3270114132ced9585
2019-03-06 06:30:30 +00:00
19b02cf4ed arm64_cpu_capabilities: flatten struct
The midr_* part of the struct was never used, and confuses older gcc
with partially uninitialized assignments that were not correct.
Just flatten the struct

Change-Id: I7a9cfe064ab97cdcd5ac50ce4fb713c4d7983bd3
2019-03-06 06:30:30 +00:00
76a0cc71fc warnings: fix broken -Wmaybe-uninitialized
These variables cannot be used uninitialized, and newer gcc versions
correctly do not bring the warning up, but this will shut up older ones

Change-Id: I2b2ea9b557196a3e7eea1e04dd1f160bd12d6e54
2019-03-06 06:30:30 +00:00
ab39798181 send_syscall: remove unused variables
Change-Id: I0a350b8c7dbf27960544dd3651941d3905f93fc6
2019-03-06 06:30:30 +00:00
0cc3496747 warnings: fix missing field in initializer
use generic struct zero initializer instead.
Older gcc used on arm also seem to have trouble with '{}',
so use '{ 0 }' instead

Change-Id: I83d43b05f8d1d44e1dd86502b48e28fe242e1db2
2019-03-06 06:30:30 +00:00
10cca81401 arm64 vdso warning: fix non-void function not returning
arch_setup_vdso() needs to return something even on panic to please gcc.
In theory, flagging panic() with __attribute__((noreturn)) should work
just the same and is a much better solution but for some reason on older
gcc versions setting the flag leads to the weak memset() symbol not
being found !?

Change-Id: Ifed100df5440ca24bb495817db9afc79f0ba6751
2019-03-06 06:30:30 +00:00
0c79de67b4 warnings: disable override-init for arm perfctr arrays
The arrays first init every fields to invalid op then override a few
fields, since this is not something we want to allow everywhere use
a GCC pragma to only ignore the warning there.

Change-Id: I498546fe60d60d4b000d711e22e04c8c360b5b83
2019-03-06 06:30:30 +00:00
3fbad79afb warnings: init pte in process.c functions
pte_make_fileoff() on arm does not always init the pte, so just
init it to PTE_NULL firsthand

Change-Id: If195c1aef5b1344f13f6c0c76bb431a5fa339265
2019-03-06 06:30:30 +00:00
1b76aaa7e1 unused function warnings: add inline to static function in header files
Change-Id: I5d9bb539712a2b3e51c3ab3433a04fbb0cb0b961
2019-03-06 06:30:30 +00:00
aa3c5e91db arm64: Direct access to Mckernel memory from Linux.
Change-Id: I1a096aa5232c56382ae19d8c4e4f41d4e3e9f660
2019-03-06 14:53:16 +09:00
20d5900c35 mcstat: fix ihklib.h location
ihklib.h moved since it is no longer a generated file

Change-Id: I1ad6ff4bb8ae8c536d9ad7ee3cbeaf670ebcd11c
2019-03-01 06:24:39 +00:00
414cffd95b tests: remove calls to ihk_os_create/destroy_pseudofs
Change-Id: I04910c6a258c841437463e098fb8e02116c4f711
2019-03-01 06:24:04 +00:00
9ec0aeeab5 debug.h: merge both instances into ihk/debug.h
We do not need two debug.h files.

Take Fujitsu's STATIC_ASSERT over BUILD_BUG_ON because it is more used

Change-Id: If04c17fbb7406ab15fe86267fed8d6da460cec62
Fujitsu: POSTK_DEBUG_ARCH_DEP_9
2019-03-01 05:10:35 +00:00
06e96005a6 mcexec: restore --enable-vdso/disable-vdso for x86
Fujitsu added this ifdef together with ifndef __arch64__ and thus disabled
the option for both archs in practice; it probably does not hurt to restore...

I'm not sure I see the point of disabling the option at mcexec level though,
but who am I to care.

Change-Id: I0d4bffb6ed325edac8ae577773e19c0fff6ca2ed
Fujitsu: POSTK_DEBUG_ARCH_DEP_53
2019-03-01 05:08:45 +00:00
4606714c07 process stack: use PAGE_SIZE in aux vector
Don't ask me why this shares POSTK_DEBUG_ARCH_DEP_50 with the ksym lookups...

Change-Id: Ic3db2cd77ca88be361cefec85d8ed9deb21ffcd8
Fujitsu: POSTK_DEBUG_ARCH_DEP_50
2019-03-01 05:08:16 +00:00
a5d5baf8a8 rus_vm_fault: always use a packet on the stack
There are valid use cases where a remote page fault has no available
thread data/packet available to use, e.g. when device driver threads
need to access the data (BXI).

Do the per thread data lookup to use the right channel/tid if available,
and use mcctrl_ikc_send_wait with a new message number directly.

The fault is no longer handled in mckernel syscall forwarding code but
in the ikc handler directly in irq, this should be ok because page
faults are interrupts anyway so the code should be irq-safe.

Change-Id: Ie60f413cdaee6c1a824b4a2c93637899cb9bf9c9
2019-03-01 05:08:03 +00:00
8074445d59 README: fix background link in toc
Change-Id: Ief448fd99fddc310ea7f311798c94d0423ebf93a
2019-03-01 05:00:47 +00:00
6a456f11aa cmake: remove unused build-time symbol lookup
Everything already uses kallsyms_lookup_name or similar, this
was leftover from when the build system was ported ages ago

Change-Id: I09dd0249845df90ab2e0adc28d0eb285c0ebb64b
Fujitsu: POSTK_DEBUG_ARCH_DEP_50
2019-03-01 13:49:01 +09:00
81e665cb48 init_process: add missing initializations to proc struct
Change-Id: I4ea386ba3a8745202745bd8e35cab00c38262f65
Fujitsu: POSTK_DEBUG_ARCH_DEP_63
2019-03-01 04:39:59 +00:00
e0b9c5deec nanosleep: add cpu_pause() in spinwait loop
Probably some energy consumption saving?

Change-Id: I888f50568db8f08751abd0a002137c3b475362dc
Fujitsu: POSTK_DEBUG_ARCH_DEP_43
2019-03-01 04:38:51 +00:00
62772c8a24 gencore: Allocate ELF header to heap instead of stack
coredump() proceeds as follows:

1. coredump() calls gencore()
2. gencore() allocates ELF header to stack
3. gencore() prepares the core table and record the address of the ELF
   header to the table and return to coredump()
4. coredump() offloads __NR_coredump with the address of the core
   table

This fix prevents the ELF header from getting destroyed in the 3rd
step.

Change-Id: I770418c1658a6fdb640bb491fc076a31dfd41c22
Fujitsu: POSTK_TEMP_FIX_39
2019-03-01 04:38:28 +00:00
63d15f7dfc CMake Kbuild: fail at cmake time if KERNEL_DIR is missing
Change-Id: I66660718841d05003b87995d68bec728aa0db9ba
2019-03-01 04:38:05 +00:00
fb3f1c58a8 rpm: ignore CMakeCache.txt in dist and relax BuildRequires on cross build
CPack takes the source dir as is, so if it was used to build something
it will incorrectly grab the temporary CMakeCache file and cmake will
complain during rpmbuild later on.

The BuildRequires should be a separate patch but logic behind the change
is that the dependencies need to be installed in the sysroot, and
rpmbuild cannot test this, so just move them all to only enforce
BuildRequires for native build.

And while we are here, also add a new kernel_dir specfile option.

Change-Id: Ie67932798f632e6d307f8ead93bdbe043e6e8898
2019-03-01 04:37:46 +00:00