Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd handling of signal raised if an illegal syscall is attempted on Android #91028

Closed
mr-nfamous mannequin opened this issue Feb 27, 2022 · 2 comments · Fixed by #116426
Closed

Odd handling of signal raised if an illegal syscall is attempted on Android #91028

mr-nfamous mannequin opened this issue Feb 27, 2022 · 2 comments · Fixed by #116426
Labels
OS-android topic-C-API type-bug An unexpected behavior, bug, or error

Comments

@mr-nfamous
Copy link
Mannequin

mr-nfamous mannequin commented Feb 27, 2022

BPO 46872
Nosy @mr-nfamous

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-02-27.11:26:00.251>
labels = ['expert-C-API', 'type-bug']
title = 'Odd handling of signal raised if an illegal syscall is attempted on Android'
updated_at = <Date 2022-02-27.11:26:00.251>
user = 'https://github.com/mr-nfamous'

bugs.python.org fields:

activity = <Date 2022-02-27.11:26:00.251>
actor = 'bup'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['C API']
creation = <Date 2022-02-27.11:26:00.251>
creator = 'bup'
dependencies = []
files = []
hgrepos = []
issue_num = 46872
keywords = []
message_count = 1.0
messages = ['414148']
nosy_count = 1.0
nosy_names = ['bup']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue46872'
versions = []

@mr-nfamous
Copy link
Mannequin Author

mr-nfamous mannequin commented Feb 27, 2022

On Android, the following calls generate a SIGSYS signal that is neither blocked by pthread_sigmask(SIG_BLOCK, {SIGSYS}) nor ignored after its handler is set to SIG_IGN:

(os.chroot(path))
os.setgid(rgid)
os.setuid(ruid) 
(os.setegid(gid))
os.setregid(rgid, egid)
os.setreuid(ruid, euid)
os.setresgid(rgid, egid, sgid)
time.clock_settime(clock, time)
time.clock_settime_ns(clock, time)
(socket.sethostname(name))

On the other hand, signal(SIGSYS, lambda s, p: None) will catch the signal, but based on frame it receives (None), I suspect this is a coincidence. Also, the functions with parenthesized names in that list raise the equivalent of OSError(0, "Error", "%s"%args[0]).

@mr-nfamous mr-nfamous mannequin added topic-C-API type-bug An unexpected behavior, bug, or error labels Feb 27, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@mhsmith
Copy link
Member

mhsmith commented Mar 6, 2024

Most of these functions have now been disabled at build time by #115955. The only missing one is socket.sethostname, which I didn't notice because it isn't available until API level 23, and we're building against level 21. I'll fix that in #116426.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-android topic-C-API type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants