<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/arch/x86/um/shared, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/arch/x86/um/shared?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/arch/x86/um/shared?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-09-19T19:58:53Z</updated>
<entry>
<title>um: Cleanup syscall_handler_t cast in syscalls_32.h</title>
<updated>2022-09-19T19:58:53Z</updated>
<author>
<name>Lukas Straub</name>
<email>lukasstraub2@web.de</email>
</author>
<published>2022-08-26T15:29:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=61670b4d270c71219def1fbc9441debc2ac2e6e9'/>
<id>urn:sha1:61670b4d270c71219def1fbc9441debc2ac2e6e9</id>
<content type='text'>
Like in f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9
"um: Cleanup syscall_handler_t definition/cast, fix warning",
remove the cast to to fix the compiler warning.

Signed-off-by: Lukas Straub &lt;lukasstraub2@web.de&gt;
Acked-by: Randy Dunlap &lt;rdunlap@infradead.org&gt; # build-tested
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: include linux/stddef.h for __always_inline</title>
<updated>2022-07-17T21:40:09Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-07-13T10:54:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=7ac73fbb54d99486755910eaeccb070735908907'/>
<id>urn:sha1:7ac73fbb54d99486755910eaeccb070735908907</id>
<content type='text'>
When compiling against musl, their shipped &lt;stddef.h&gt; doesn't have
__always_inline. So instead explicitly include the kernel uapi header,
&lt;linux/stddef.h&gt;, which does.

This prevents the following build error:

In file included from arch/x86/um/shared/sysdep/stub.h:11,
                 from arch/um/kernel/skas/clone.c:14:
arch/x86/um/shared/sysdep/stub_64.h:111:23: error: expected ‘;’ before ‘void’
  111 | static __always_inline void *get_stub_page(void)
      |                       ^~~~~
      |                       ;
make[4]: *** [scripts/Makefile.build:249: arch/um/kernel/skas/clone.o] Error 1

Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: Cleanup syscall_handler_t definition/cast, fix warning</title>
<updated>2022-03-11T09:48:03Z</updated>
<author>
<name>David Gow</name>
<email>davidgow@google.com</email>
</author>
<published>2022-02-10T03:43:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9'/>
<id>urn:sha1:f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9</id>
<content type='text'>
The syscall_handler_t type for x86_64 was defined as 'long (*)(void)',
but always cast to 'long (*)(long, long, long, long, long, long)' before
use. This now triggers a warning (see below).

Define syscall_handler_t as the latter instead, and remove the cast.
This simplifies the code, and fixes the warning.

Warning:
In file included from ../arch/um/include/asm/processor-generic.h:13
                 from ../arch/x86/um/asm/processor.h:41
                 from ../include/linux/rcupdate.h:30
                 from ../include/linux/rculist.h:11
                 from ../include/linux/pid.h:5
                 from ../include/linux/sched.h:14
                 from ../include/linux/ptrace.h:6
                 from ../arch/um/kernel/skas/syscall.c:7:
../arch/um/kernel/skas/syscall.c: In function ‘handle_syscall’:
../arch/x86/um/shared/sysdep/syscalls_64.h:18:11: warning: cast between incompatible function types from ‘long int (*)(void)’ to ‘long int (*)(long int,  long int,  long int,  long int,  long int,  long int)’ [
-Wcast-function-type]
   18 |         (((long (*)(long, long, long, long, long, long)) \
      |           ^
../arch/x86/um/asm/ptrace.h:36:62: note: in definition of macro ‘PT_REGS_SET_SYSCALL_RETURN’
   36 | #define PT_REGS_SET_SYSCALL_RETURN(r, res) (PT_REGS_AX(r) = (res))
      |                                                              ^~~
../arch/um/kernel/skas/syscall.c:46:33: note: in expansion of macro ‘EXECUTE_SYSCALL’
   46 |                                 EXECUTE_SYSCALL(syscall, regs));
      |                                 ^~~~~~~~~~~~~~~

Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: move amd64 variant of mmap(2) to arch/x86/um/syscalls_64.c</title>
<updated>2021-12-21T20:30:44Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-09-20T21:32:48Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=577ade59b99e3473b2f1342b1eb9e496eed39b68'/>
<id>urn:sha1:577ade59b99e3473b2f1342b1eb9e496eed39b68</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: fix stub location calculation</title>
<updated>2021-08-26T20:28:03Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2021-07-13T21:47:10Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=adf9ae0d159d3dc94f58d788fc4757c8749ac0df'/>
<id>urn:sha1:adf9ae0d159d3dc94f58d788fc4757c8749ac0df</id>
<content type='text'>
In commit 9f0b4807a44f ("um: rework userspace stubs to not hard-code
stub location") I changed stub_segv_handler() to do a calculation with
a pointer to a stack variable to find the data page that we're using
for the stack and the rest of the data. This same commit was meant to
do it as well for stub_clone_handler(), but the change inadvertently
went into commit 84b2789d6115 ("um: separate child and parent errors
in clone stub") instead.

This was reported to not be compiled correctly by gcc 5, causing the
code to crash here. I'm not sure why, perhaps it's UB because the var
isn't initialized? In any case, this trick always seemed bad, so just
create a new inline function that does the calculation in assembly.

Reported-by: subashab@codeaurora.org
Fixes: 9f0b4807a44f ("um: rework userspace stubs to not hard-code stub location")
Fixes: 84b2789d6115 ("um: separate child and parent errors in clone stub")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: Fix tag order in stub_32.h</title>
<updated>2021-04-15T21:06:37Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2021-02-23T09:44:08Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=dc01a3b9db43abf95b801c9694980777a329e303'/>
<id>urn:sha1:dc01a3b9db43abf95b801c9694980777a329e303</id>
<content type='text'>
"static void inline" is the wrong way around, fix that.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Fixes: 9f0b4807a44f ("um: rework userspace stubs to not hard-code stub location")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: rework userspace stubs to not hard-code stub location</title>
<updated>2021-02-12T20:35:02Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2021-01-13T21:09:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=9f0b4807a44ff81cf59421c8a86641efec586610'/>
<id>urn:sha1:9f0b4807a44ff81cf59421c8a86641efec586610</id>
<content type='text'>
The userspace stacks mostly have a stack (and in the case of the
syscall stub we can just set their stack pointer) that points to
the location of the stub data page already.

Rework the stubs to use the stack pointer to derive the start of
the data page, rather than requiring it to be hard-coded.

In the clone stub, also integrate the int3 into the stack remap,
since we really must not use the stack while we remap it.

This prepares for putting the stub at a variable location that's
not part of the normal address space of the userspace processes
running inside the UML machine.

Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: separate child and parent errors in clone stub</title>
<updated>2021-02-12T20:34:33Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2021-01-13T21:09:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=84b2789d61156db0224724806b20110c0d34b07c'/>
<id>urn:sha1:84b2789d61156db0224724806b20110c0d34b07c</id>
<content type='text'>
If the two are mixed up, then it looks as though the parent
returned an error if the child failed (before) the mmap(),
and then the resulting process never gets killed. Fix this
by splitting the child and parent errors, reporting and
using them appropriately.

Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: Remove update_debugregs()</title>
<updated>2018-10-29T21:23:11Z</updated>
<author>
<name>Richard Weinberger</name>
<email>richard@nod.at</email>
</author>
<published>2018-06-15T14:42:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3033998bb8cd5a109c3171f4cde62665e3f5ce63'/>
<id>urn:sha1:3033998bb8cd5a109c3171f4cde62665e3f5ce63</id>
<content type='text'>
This function is nowhere used, let's get rid of it.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>um: Drop own definition of PTRACE_SYSEMU/_SINGLESTEP</title>
<updated>2018-10-29T21:23:10Z</updated>
<author>
<name>Richard Weinberger</name>
<email>richard@nod.at</email>
</author>
<published>2018-06-15T14:42:54Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0676b957c24bfb6e495449ba7b7e72c5b5d79233'/>
<id>urn:sha1:0676b957c24bfb6e495449ba7b7e72c5b5d79233</id>
<content type='text'>
32bit UML used to define PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP
own its own because many years ago not all libcs had these request codes
in their UAPI.
These days PTRACE_SYSEMU/_SINGLESTEP is well known and part of glibc
and our own define becomes problematic.

With change c48831d0eebf ("linux/x86: sync sys/ptrace.h with Linux 4.14
[BZ #22433]") glibc turned PTRACE_SYSEMU/_SINGLESTEP into a enum and
UML failed to build.

Let's drop our define and rely on the fact that every libc has
PTRACE_SYSEMU/_SINGLESTEP.

Cc: &lt;stable@vger.kernel.org&gt;
Cc: Ritesh Raj Sarraf &lt;rrs@researchut.com&gt;
Reported-and-tested-by: Ritesh Raj Sarraf &lt;rrs@researchut.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
</feed>
