From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12333 Path: news.gmane.org!.POSTED!not-for-mail From: William Pitcock Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] track pthread stack guard sizes Date: Sat, 6 Jan 2018 04:44:43 +0000 Message-ID: <20180106044443.14260-1-nenolod@dereferenced.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1515213802 25117 195.159.176.226 (6 Jan 2018 04:43:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 6 Jan 2018 04:43:22 +0000 (UTC) Cc: William Pitcock To: musl@lists.openwall.com Original-X-From: musl-return-12349-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jan 06 05:43:18 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eXgK9-0005zw-23 for gllmg-musl@m.gmane.org; Sat, 06 Jan 2018 05:43:13 +0100 Original-Received: (qmail 9566 invoked by uid 550); 6 Jan 2018 04:45:12 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 9530 invoked from network); 6 Jan 2018 04:45:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dereferenced-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=1znKsxgP9M/S+Ej/b0VUMSspjI24oYuM1PO5pFB8kpE=; b=VIxlJOF7A8yNr+be0OL0/dhMuCkO8K7h3WjyjlB1l2qqaOoA3ZumwEy9hIqUOIsJDE nu3aVzRP7+P3bUtt8CzL1CRvsq34DuhBXMwqjTqozp5eHj3Z2brmLfHbJ1OEKF66Ihdn xemGvmQOzFSoBY6FPzCOpH5VvtgfmeDNrFFwNK7LE/653+IFXWaf0ESF1rSBtlM+sJig B2wQsDVcwKP0lEdEmHgPQ+aBBr1FVili/W5U262KPXBePPj2ydNkxcQXnB00dJmcskPL Lj6otCZTBkyAoOBzsS5q9XqJUb7mdWjSS7T5DVkjua4AGijU4yecm6zrSRNLOIxvbJgT 2W1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1znKsxgP9M/S+Ej/b0VUMSspjI24oYuM1PO5pFB8kpE=; b=krvHQVPyntx5IIyPexQXtn+ptmlZMziYOY8gog3Ds4ZTdP3AYbJWSBkIBZ+0PErBKr he8WX+K/Uf9sezWk1mWO0cjSQGnZy0uMLJWLVJFhuF+hGczhz6wu2bSJAgR9oHVkHT8x rD+wI0FTe+loB+H81MHLgiSFFnsIK1Ylj6iaj94l/fDzTsITCrf+S8M2SGwZ8Z1l6boh E/GqspmRY0o+ZEgrHr1MUBm6IUOMRGw8a0e2vgyYnSieD00YiTnOY49so7UAKGxFQMzX EOI+KaJBUmDvdWKxLwsIZF8I0lMQ4EKgdtJSMQzw0319t133weOHTIusspSqCUT0zJ9m vNFA== X-Gm-Message-State: AKGB3mJjYc9oOOdA3qoNOXfqK8IfMsl1oLlG5vLgw1nRtcNxUodFCpNb d4HarbMhibWTGgQocrxwv8C/6c0W X-Google-Smtp-Source: ACJfBovShVrrTTIdoR9PlgETWAvpBSJAWaHFDAXPjuXs6VQrmE9pAm0kkLfaEuq2JT1zt6yApC6umQ== X-Received: by 10.159.205.137 with SMTP id v9mr5337297plo.181.1515213899366; Fri, 05 Jan 2018 20:44:59 -0800 (PST) X-Mailer: git-send-email 2.15.0 Xref: news.gmane.org gmane.linux.lib.musl.general:12333 Archived-At: some applications (rustc) are dependent on pthread_getattr_np() providing the guard size. --- src/internal/pthread_impl.h | 1 + src/thread/pthread_create.c | 1 + src/thread/pthread_getattr_np.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h index 56e19348..c2cafeaa 100644 --- a/src/internal/pthread_impl.h +++ b/src/internal/pthread_impl.h @@ -48,6 +48,7 @@ struct pthread { void *stdio_locks; uintptr_t canary_at_end; void **dtv_copy; + size_t guard_size; }; struct __timer { diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 6cbf85b3..0faad765 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -265,6 +265,7 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att new->map_size = size; new->stack = stack; new->stack_size = stack - stack_limit; + new->guard_size = guard; new->start = entry; new->start_arg = arg; new->self = new; diff --git a/src/thread/pthread_getattr_np.c b/src/thread/pthread_getattr_np.c index ae26a5ab..29a209bd 100644 --- a/src/thread/pthread_getattr_np.c +++ b/src/thread/pthread_getattr_np.c @@ -7,6 +7,7 @@ int pthread_getattr_np(pthread_t t, pthread_attr_t *a) { *a = (pthread_attr_t){0}; a->_a_detach = !!t->detached; + a->_a_guardsize = t->guard_size; if (t->stack) { a->_a_stackaddr = (uintptr_t)t->stack; a->_a_stacksize = t->stack_size; -- 2.15.0