int main() {
setuid(404); // or any other random unassigned uid
printf("Current user ID: %d\n", getuid());
while (1) {
sleep(10);
}
return 0;
}
3. Try to launch btop
4. Ensure PROC box is enabled. If not, toggle with `4`
5. Segmentation fault.
**Expected behavior**
Should not segfault when proc box is displayed.
**Screenshots**
<img width="745" alt="Screenshot 2024-04-28 at 1 21 46 AM" src="https://github.com/aristocratos/btop/assets/25097841/6fe73cdc-8589-4441-ab1c-26ba64d49d6e">
**Info:**
- btop++ version: 1.3.2
- Binary: homebrew
- Architecture: arm64
- Platform: OsX
- OSX release version: 14.4.1 (23E224)
- Terminal used: iTerm2 (3.4.23)
- Font used: MesloLGS NF
**Additional context**
Contents of `~/.config/btop/btop.log`
cat ~/.config/btop/btop.log
2024/04/28 (01:21:36) | ===> btop++ v.1.3.2
2024/04/28 (01:21:36) | WARNING: Failed to set locale UTF-8 continuing anyway.
2024/04/28 (01:27:10) | ===> btop++ v.1.3.2
2024/04/28 (01:27:10) | WARNING: Failed to set locale UTF-8 continuing anyway.
2024/04/28 (01:27:25) | ===> btop++ v.1.3.2
2024/04/28 (01:27:25) | DEBUG: Running in DEBUG mode!
2024/04/28 (01:27:25) | INFO: Logger set to DEBUG
2024/04/28 (01:27:25) | WARNING: Failed to set locale UTF-8 continuing anyway.
2024/04/28 (01:27:25) | INFO: Running on /dev/ttys008
2024/04/28 (01:27:25) | DEBUG: get_sensors(): show_coretemp=1 check_temp=1
2024/04/28 (01:27:25) | DEBUG: checking intel
2024/04/28 (01:27:25) | DEBUG: no intel sensors found
**GDB Backtrace**
<img width="889" alt="Screenshot 2024-04-28 at 1 32 32 AM" src="https://github.com/aristocratos/btop/assets/25097841/1f16736f-165d-409b-aac4-e6411fdf1492">
<img width="709" alt="Screenshot 2024-04-28 at 1 33 04 AM" src="https://github.com/aristocratos/btop/assets/25097841/08eae45e-9a8d-4b1a-acc9-94705fb087c6">
**Example responsible process:**
(after changes in btop_collect.cpp to log problematic processes)
`WARNING: Could not retrieve user information for user ID:502 (pid:43105)`
Describe the bug
Segfault on m2 mac running Ventura if processes with UIDs having no associated user are running.
To Reproduce
int main() { setuid(404); // or any other random unassigned uid printf("Current user ID: %d\n", getuid()); while (1) { sleep(10); } return 0; }
2024/04/28 (01:27:10) | ===> btop++ v.1.3.2 2024/04/28 (01:27:10) | WARNING: Failed to set locale UTF-8 continuing anyway.
2024/04/28 (01:27:25) | ===> btop++ v.1.3.2 2024/04/28 (01:27:25) | DEBUG: Running in DEBUG mode! 2024/04/28 (01:27:25) | INFO: Logger set to DEBUG 2024/04/28 (01:27:25) | WARNING: Failed to set locale UTF-8 continuing anyway. 2024/04/28 (01:27:25) | INFO: Running on /dev/ttys008 2024/04/28 (01:27:25) | DEBUG: get_sensors(): show_coretemp=1 check_temp=1 2024/04/28 (01:27:25) | DEBUG: checking intel 2024/04/28 (01:27:25) | DEBUG: no intel sensors found
❯ ps -p 43105 -o uid,pid,user,args UID PID USER ARGS 502 43105 502 /usr/sbin/distnoted agent