public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pageexec at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/96503] attribute alloc_size effect lost after inlining
Date: Fri, 18 Nov 2022 23:57:08 +0000 [thread overview]
Message-ID: <bug-96503-4-4cB57LHwQB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96503-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96503
PaX Team <pageexec at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pageexec at gmail dot com
--- Comment #2 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> ---
(In reply to Kees Cook from comment #1)
> Created attachment 53643 [details]
> PoC showing unexpected __bdos results across inlines
>
> Fixing this is needed for the Linux kernel to do much useful with
> alloc_size. Most of the allocators are inline wrappers, for example.
For cases where the size doesn't really change across the inlines, it ought to
be sufficient to annotate the non-inlined implementation function, e.g. in case
of kvmalloc, annotate kvmalloc_node as __alloc_size(1).
For other cases it may be less trivial, e.g.:
/* Some padding the wrapper adds to the actual allocation. */
size_t metadata_size;
__attribute__ ((alloc_size (1))) void *alloc_wrapper (size_t sz)
{
return real_alloc (size + metadata_size);
}
extern void *real_alloc (size_t) __attribute__ ((alloc_size(1)));
here the compiler will end up seeing the padded size, which may not be correct.
To fix this we'll have to store the alloc_size info somewhere (ptr_info seems
to be aliasing-specific, so maybe a new member to tree_ssa_name) during
inlining and then teach the tree-object-size pass to access it.
next prev parent reply other threads:[~2022-11-18 23:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-06 15:51 [Bug ipa/96503] New: " msebor at gcc dot gnu.org
2022-09-30 1:54 ` [Bug ipa/96503] " kees at outflux dot net
2022-11-18 23:57 ` pageexec at gmail dot com [this message]
2023-10-25 5:46 ` muecker at gwdg dot de
2023-10-25 5:54 ` sjames at gcc dot gnu.org
2023-10-25 10:55 ` siddhesh at gcc dot gnu.org
2023-10-25 11:08 ` siddhesh at gcc dot gnu.org
2023-10-25 13:03 ` muecker at gwdg dot de
2023-10-25 13:40 ` siddhesh at gcc dot gnu.org
2023-11-03 19:04 ` uecker at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-96503-4-4cB57LHwQB@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).