From: Marc Reisner <reisner.marc@gmail.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Paul Moore <paul@paul-moore.com>,
Marc Reisner <reisner.marc@gmail.com>,
akpm@linux-foundation.org, david@redhat.com, linux-mm@kvack.org,
omosnace@redhat.com, peterz@infradead.org,
selinux@vger.kernel.org, Vlastimil Babka <vbabka@suse.cz>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: Re: [PATCH v3 3/4] selinux: use vma_is_initial_stack() and vma_is_initial_heap()
Date: Thu, 8 Aug 2024 15:03:43 +0000 [thread overview]
Message-ID: <ZrTeT8_pzD8fH-_P@marcreisner.com> (raw)
In-Reply-To: <4d2e1d4f-659a-428f-a167-faaaa4eca18a@huawei.com>
On Thu, Aug 08, 2024 at 09:12:59PM +0800, Kefeng Wang wrote:
>
> OK,revert patch is sent, but I am also curious about it.
>
> https://lore.kernel.org/all/20240808130909.1027860-1-wangkefeng.wang@huawei.com/
I am also curious. It seems like the "real" fix would be in mmap - my
understanding is that it should not intersect with heap, even when heap
is empty (start_brk == brk).
It looks like start_brk is fixed in place when the ELF is
loaded in fs/binfmt_elf.c:load_elf_binary (line 1288).
if ((current->flags & PF_RANDOMIZE) && (snapshot_randomize_va_space > 1)) {
/*
* For architectures with ELF randomization, when executing
* a loader directly (i.e. no interpreter listed in ELF
* headers), move the brk area out of the mmap region
* (since it grows up, and may collide early with the stack
* growing down), and into the unused ELF_ET_DYN_BASE region.
*/
if (IS_ENABLED(CONFIG_ARCH_HAS_ELF_RANDOMIZE) &&
elf_ex->e_type == ET_DYN && !interpreter) {
mm->brk = mm->start_brk = ELF_ET_DYN_BASE;
} else {
/* Otherwise leave a gap between .bss and brk. */
mm->brk = mm->start_brk = mm->brk + PAGE_SIZE;
}
mm->brk = mm->start_brk = arch_randomize_brk(mm);
#ifdef compat_brk_randomized
current->brk_randomized = 1;
#endif
}
next prev parent reply other threads:[~2024-08-08 15:03 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 5:00 [PATCH v3 0/4] mm: convert to vma_is_initial_heap/stack() Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` [PATCH v3 1/4] mm: factor out VMA stack and heap checks Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` [PATCH v3 2/4] drm/amdkfd: use vma_is_initial_stack() and vma_is_initial_heap() Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` [PATCH v3 3/4] selinux: " Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-31 14:26 ` Fwd: " Stephen Smalley
2023-07-31 16:19 ` Paul Moore
[not found] ` <CAEjxPJ6iFRZUetSvMgZvq_327U_JZ_w9s=gFccKgJhfCt8bqNg@mail.gmail.com>
[not found] ` <CAHC9VhRB1uVVWFUgnMZ1iwCD_A0mEX2Xhn79qTxuNKTzisWULg@mail.gmail.com>
2023-12-06 14:22 ` Ondrej Mosnacek
2023-12-06 20:47 ` Paul Moore
2023-12-07 4:50 ` Kefeng Wang
2023-12-07 8:37 ` Ondrej Mosnacek
2023-12-07 9:23 ` Kefeng Wang
2024-08-07 21:26 ` Marc Reisner
2024-08-08 1:10 ` Paul Moore
2024-08-08 6:43 ` Kefeng Wang
2024-08-08 11:09 ` Kefeng Wang
2024-08-08 11:41 ` Stephen Smalley
2024-08-08 13:12 ` Kefeng Wang
2024-08-08 15:03 ` Marc Reisner [this message]
2024-08-08 18:00 ` Liam R. Howlett
2024-08-08 19:35 ` Marc Reisner
2024-08-08 20:40 ` Paul Moore
2023-07-28 5:00 ` [PATCH v3 4/4] perf/core: " Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-28 5:00 ` Kefeng Wang
2023-07-31 13:47 ` [PATCH v3 0/4] mm: convert to vma_is_initial_heap/stack() Peter Zijlstra
2023-07-31 13:47 ` Peter Zijlstra
2023-07-31 13:47 ` Peter Zijlstra
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=ZrTeT8_pzD8fH-_P@marcreisner.com \
--to=reisner.marc@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=peterz@infradead.org \
--cc=selinux@vger.kernel.org \
--cc=vbabka@suse.cz \
--cc=wangkefeng.wang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.