aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/tst-dl_mseal-mutable-mod.c
blob: fb7cf03925ba8fde7c058a53753129c166af0f4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Check if PT_OPENBSD_MUTABLE is correctly applied.
   Copyright (C) 2025 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <https://www.gnu.org/licenses/>.  */

#include <elf.h>
#include "tst-dl_mseal-mutable-mod.h"

static unsigned char mutable_array1[128]
  __attribute__ ((section (GNU_MUTABLE_SECTION_NAME)))
     = { 0 };
static unsigned char mutable_array2[256]
  __attribute__ ((section (GNU_MUTABLE_SECTION_NAME)))
     = { 0 };

static unsigned char immutable_array[256];

struct array_t
get_mutable_array1 (void)
{
  return (struct array_t) { mutable_array1, sizeof (mutable_array1) };
}

struct array_t
get_mutable_array2 (void)
{
  return (struct array_t) { mutable_array2, sizeof (mutable_array2) };
}

struct array_t
get_immutable_array (void)
{
  return (struct array_t) { immutable_array, sizeof (immutable_array) };
}