<feed xmlns='http://www.w3.org/2005/Atom'>
<title>yuzu/src/core/hle/kernel/k_thread.cpp, branch main</title>
<subtitle>Nintendo Switch emulator</subtitle>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/'/>
<entry>
<title>kernel: clear pinned waiter list on unpin</title>
<updated>2024-01-28T03:53:49+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2024-01-28T03:53:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=6c4eb2733d8282b347e4ac5c2c2b278e36f48c5f'/>
<id>6c4eb2733d8282b347e4ac5c2c2b278e36f48c5f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>KThread: Send termination interrupt to all cores a thread has affinity to</title>
<updated>2024-01-02T21:34:34+00:00</updated>
<author>
<name>Merry</name>
<email>git@mary.rs</email>
</author>
<published>2024-01-02T21:13:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=0f7fc9411129c110ef751d18f80e02f18b63c201'/>
<id>0f7fc9411129c110ef751d18f80e02f18b63c201</id>
<content type='text'>
KThread::RequestTerminate may run from a thread which is not the CurrentCore, and thus
masking this out is erroneous.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
KThread::RequestTerminate may run from a thread which is not the CurrentCore, and thus
masking this out is erroneous.
</pre>
</div>
</content>
</entry>
<entry>
<title>general: properly support multiple memory instances</title>
<updated>2023-12-23T02:52:49+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-12-18T01:46:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=31bf57a310f3b3417e96ec9e1cee6c1c817882d9'/>
<id>31bf57a310f3b3417e96ec9e1cee6c1c817882d9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>core: refactor emulated cpu core activation</title>
<updated>2023-12-04T15:37:16+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-11-28T19:30:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=45c87c7e6e841c11def43e5ab25160006dab6d77'/>
<id>45c87c7e6e841c11def43e5ab25160006dab6d77</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: signal thread on termination completed</title>
<updated>2023-10-22T00:03:41+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-10-21T23:18:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=dcfe674ed4eef3879f0ed8706507ea21d13aab24'/>
<id>dcfe674ed4eef3879f0ed8706507ea21d13aab24</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: add missing TLR clear</title>
<updated>2023-10-22T00:03:41+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-10-21T22:46:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=bb195c2c2bebdb62d349cf181479489a1a15b108'/>
<id>bb195c2c2bebdb62d349cf181479489a1a15b108</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: update KProcess</title>
<updated>2023-10-22T00:03:41+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-10-21T20:47:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=8c59543ee32c8bff575bab7ec1e70f76f8eda437'/>
<id>8c59543ee32c8bff575bab7ec1e70f76f8eda437</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #10990 from comex/ubsan</title>
<updated>2023-07-26T14:33:28+00:00</updated>
<author>
<name>liamwhite</name>
<email>liamwhite@users.noreply.github.com</email>
</author>
<published>2023-07-26T14:33:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=d3da1e6517fe27670b6c2d713d144872d55057d8'/>
<id>d3da1e6517fe27670b6c2d713d144872d55057d8</id>
<content type='text'>
Fixes and workarounds to make UBSan happier on macOS</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes and workarounds to make UBSan happier on macOS</pre>
</div>
</content>
</entry>
<entry>
<title>general: Silence -Wshadow{,-uncaptured-local} warnings</title>
<updated>2023-07-18T23:31:35+00:00</updated>
<author>
<name>lat9nq</name>
<email>22451773+lat9nq@users.noreply.github.com</email>
</author>
<published>2023-07-18T23:31:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=71b3b2a2f0f0ec5d0a0061d3d7ea42a1f63ae1de'/>
<id>71b3b2a2f0f0ec5d0a0061d3d7ea42a1f63ae1de</id>
<content type='text'>
These occur in the latest commits in LLVM Clang.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These occur in the latest commits in LLVM Clang.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixes and workarounds to make UBSan happier on macOS</title>
<updated>2023-07-15T19:00:28+00:00</updated>
<author>
<name>comex</name>
<email>comexk@gmail.com</email>
</author>
<published>2023-07-01T22:00:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=d7c532d8894ce806c9af13b8dd3eec975642b348'/>
<id>d7c532d8894ce806c9af13b8dd3eec975642b348</id>
<content type='text'>
There are still some other issues not addressed here, but it's a start.

Workarounds for false-positive reports:

- `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`,
  because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp)
  of how big it thinks objects can be, specifically when dealing with
  offset-to-top values used with multiple inheritance.  Hopefully this
  doesn't have a performance impact.

- `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks
  is UB even though it at least arguably isn't.  See the link in the
  comment for more information.

Fixes for correct reports:

- `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to
  avoid UB from pointer overflow (when pointer arithmetic wraps around
  the address space).

- `KScheduler::Reload`: `thread-&gt;GetOwnerProcess()` can be `nullptr`;
  avoid calling methods on it in this case.  (The existing code returns
  a garbage reference to a field, which is then passed into
  `LoadWatchpointArray`, and apparently it's never used, so it's
  harmless in practice but still triggers UBSan.)

- `KAutoObject::Close`: This function calls `this-&gt;Destroy()`, which
  overwrites the beginning of the object with junk (specifically a free
  list pointer).  Then it calls `this-&gt;UnregisterWithKernel()`.  UBSan
  complains about a type mismatch because the vtable has been
  overwritten, and I believe this is indeed UB.  `UnregisterWithKernel`
  also loads `m_kernel` from the 'freed' object, which seems to be
  technically safe (the overwriting doesn't extend as far as that
  field), but seems dubious.  Switch to a `static` method and load
  `m_kernel` in advance.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are still some other issues not addressed here, but it's a start.

Workarounds for false-positive reports:

- `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`,
  because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp)
  of how big it thinks objects can be, specifically when dealing with
  offset-to-top values used with multiple inheritance.  Hopefully this
  doesn't have a performance impact.

- `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks
  is UB even though it at least arguably isn't.  See the link in the
  comment for more information.

Fixes for correct reports:

- `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to
  avoid UB from pointer overflow (when pointer arithmetic wraps around
  the address space).

- `KScheduler::Reload`: `thread-&gt;GetOwnerProcess()` can be `nullptr`;
  avoid calling methods on it in this case.  (The existing code returns
  a garbage reference to a field, which is then passed into
  `LoadWatchpointArray`, and apparently it's never used, so it's
  harmless in practice but still triggers UBSan.)

- `KAutoObject::Close`: This function calls `this-&gt;Destroy()`, which
  overwrites the beginning of the object with junk (specifically a free
  list pointer).  Then it calls `this-&gt;UnregisterWithKernel()`.  UBSan
  complains about a type mismatch because the vtable has been
  overwritten, and I believe this is indeed UB.  `UnregisterWithKernel`
  also loads `m_kernel` from the 'freed' object, which seems to be
  technically safe (the overwriting doesn't extend as far as that
  field), but seems dubious.  Switch to a `static` method and load
  `m_kernel` in advance.
</pre>
</div>
</content>
</entry>
</feed>
