Further harden glibc malloc metadata against 1-byte overflows.
[glibc.git] / elf / tst-protected1moda.c
blobaca4fc82a81032ac27036cafbec84704a5d8793d
1 /* Copyright (C) 2015-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #include "tst-protected1mod.h"
20 int protected1 = 3;
21 static int expected_protected1 = 3;
22 int protected2 = 4;
23 static int expected_protected2 = 4;
24 int protected3 = 5;
25 static int expected_protected3 = 5;
27 asm (".protected protected1");
28 asm (".protected protected2");
29 asm (".protected protected3");
31 void
32 set_protected1a (int i)
34 protected1 = i;
35 set_expected_protected1 (i);
38 void
39 set_expected_protected1 (int i)
41 expected_protected1 = i;
44 int *
45 protected1a_p (void)
47 return &protected1;
50 int
51 check_protected1 (void)
53 return protected1 == expected_protected1;
56 void
57 set_protected2 (int i)
59 protected2 = i;
60 expected_protected2 = i;
63 int
64 check_protected2 (void)
66 return protected2 == expected_protected2;
69 void
70 set_expected_protected3a (int i)
72 expected_protected3 = i;
75 void
76 set_protected3a (int i)
78 protected3 = i;
79 set_expected_protected3a (i);
82 int
83 check_protected3a (void)
85 return protected3 == expected_protected3;
88 int *
89 protected3a_p (void)
91 return &protected3;