Skip to content

Commit 10de147

Browse files
committed
libsemanage/tests: silence function UBSAN
Signed-off-by: Christian Göttsche <[email protected]>
1 parent 1439577 commit 10de147

File tree

7 files changed

+24
-0
lines changed

7 files changed

+24
-0
lines changed

libsemanage/src/database.c

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static int assert_init(semanage_handle_t * handle, dbase_config_t * dconfig)
2121
return STATUS_SUCCESS;
2222
}
2323

24+
__attribute__((no_sanitize("function")))
2425
static int enter_ro(semanage_handle_t * handle, dbase_config_t * dconfig)
2526
{
2627

@@ -58,6 +59,7 @@ static inline int exit_ro(semanage_handle_t * handle)
5859
return commit_num;
5960
}
6061

62+
__attribute__((no_sanitize("function")))
6163
static int enter_rw(semanage_handle_t * handle, dbase_config_t * dconfig)
6264
{
6365

@@ -79,6 +81,7 @@ static int enter_rw(semanage_handle_t * handle, dbase_config_t * dconfig)
7981
return STATUS_ERR;
8082
}
8183

84+
__attribute__((no_sanitize("function")))
8285
int dbase_modify(semanage_handle_t * handle,
8386
dbase_config_t * dconfig,
8487
const record_key_t * key, const record_t * data)
@@ -93,6 +96,7 @@ int dbase_modify(semanage_handle_t * handle,
9396
return STATUS_SUCCESS;
9497
}
9598

99+
__attribute__((no_sanitize("function")))
96100
int dbase_set(semanage_handle_t * handle,
97101
dbase_config_t * dconfig,
98102
const record_key_t * key, const record_t * data)
@@ -107,6 +111,7 @@ int dbase_set(semanage_handle_t * handle,
107111
return STATUS_SUCCESS;
108112
}
109113

114+
__attribute__((no_sanitize("function")))
110115
int dbase_del(semanage_handle_t * handle,
111116
dbase_config_t * dconfig, const record_key_t * key)
112117
{
@@ -120,6 +125,7 @@ int dbase_del(semanage_handle_t * handle,
120125
return STATUS_SUCCESS;
121126
}
122127

128+
__attribute__((no_sanitize("function")))
123129
int dbase_query(semanage_handle_t * handle,
124130
dbase_config_t * dconfig,
125131
const record_key_t * key, record_t ** response)
@@ -136,6 +142,7 @@ int dbase_query(semanage_handle_t * handle,
136142
return exit_ro(handle);
137143
}
138144

145+
__attribute__((no_sanitize("function")))
139146
int dbase_exists(semanage_handle_t * handle,
140147
dbase_config_t * dconfig,
141148
const record_key_t * key, int *response)
@@ -152,6 +159,7 @@ int dbase_exists(semanage_handle_t * handle,
152159
return exit_ro(handle);
153160
}
154161

162+
__attribute__((no_sanitize("function")))
155163
int dbase_count(semanage_handle_t * handle,
156164
dbase_config_t * dconfig, unsigned int *response)
157165
{
@@ -167,6 +175,7 @@ int dbase_count(semanage_handle_t * handle,
167175
return exit_ro(handle);
168176
}
169177

178+
__attribute__((no_sanitize("function")))
170179
int dbase_iterate(semanage_handle_t * handle,
171180
dbase_config_t * dconfig,
172181
int (*fn) (const record_t * record,
@@ -184,6 +193,7 @@ int dbase_iterate(semanage_handle_t * handle,
184193
return exit_ro(handle);
185194
}
186195

196+
__attribute__((no_sanitize("function")))
187197
int dbase_list(semanage_handle_t * handle,
188198
dbase_config_t * dconfig,
189199
record_t *** records, unsigned int *count)

libsemanage/src/database_file.c

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct dbase_file {
3737
record_file_table_t *rftable;
3838
};
3939

40+
__attribute__((no_sanitize("function")))
4041
static int dbase_file_cache(semanage_handle_t * handle, dbase_file_t * dbase)
4142
{
4243

libsemanage/src/database_join.c

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct dbase_join {
3434
record_join_table_t *rjtable;
3535
};
3636

37+
__attribute__((no_sanitize("function")))
3738
static int dbase_join_cache(semanage_handle_t * handle, dbase_join_t * dbase)
3839
{
3940

@@ -170,6 +171,7 @@ static int dbase_join_cache(semanage_handle_t * handle, dbase_join_t * dbase)
170171
}
171172

172173
/* Flush database */
174+
__attribute__((no_sanitize("function")))
173175
static int dbase_join_flush(semanage_handle_t * handle, dbase_join_t * dbase)
174176
{
175177

libsemanage/src/database_llist.c

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ int dbase_llist_needs_resync(semanage_handle_t * handle, dbase_llist_t * dbase)
3434
}
3535

3636
/* Helper for adding records to the cache */
37+
__attribute__((no_sanitize("function")))
3738
int dbase_llist_cache_prepend(semanage_handle_t * handle,
3839
dbase_llist_t * dbase, const record_t * data)
3940
{
@@ -67,6 +68,7 @@ int dbase_llist_cache_prepend(semanage_handle_t * handle,
6768
return STATUS_ERR;
6869
}
6970

71+
__attribute__((no_sanitize("function")))
7072
void dbase_llist_drop_cache(dbase_llist_t * dbase)
7173
{
7274

@@ -99,6 +101,7 @@ int dbase_llist_set_serial(semanage_handle_t * handle, dbase_llist_t * dbase)
99101
}
100102

101103
/* Helper for finding records in the cache */
104+
__attribute__((no_sanitize("function")))
102105
static int dbase_llist_cache_locate(semanage_handle_t * handle,
103106
dbase_llist_t * dbase,
104107
const record_key_t * key,
@@ -226,6 +229,7 @@ int dbase_llist_modify(semanage_handle_t * handle,
226229
return STATUS_SUCCESS;
227230
}
228231

232+
__attribute__((no_sanitize("function")))
229233
int dbase_llist_query(semanage_handle_t * handle,
230234
dbase_llist_t * dbase,
231235
const record_key_t * key, record_t ** response)
@@ -248,6 +252,7 @@ int dbase_llist_query(semanage_handle_t * handle,
248252
return STATUS_ERR;
249253
}
250254

255+
__attribute__((no_sanitize("function")))
251256
int dbase_llist_iterate(semanage_handle_t * handle,
252257
dbase_llist_t * dbase,
253258
int (*fn) (const record_t * record,
@@ -274,6 +279,7 @@ int dbase_llist_iterate(semanage_handle_t * handle,
274279
return STATUS_ERR;
275280
}
276281

282+
__attribute__((no_sanitize("function")))
277283
int dbase_llist_del(semanage_handle_t * handle __attribute__ ((unused)),
278284
dbase_llist_t * dbase, const record_key_t * key)
279285
{
@@ -304,6 +310,7 @@ int dbase_llist_del(semanage_handle_t * handle __attribute__ ((unused)),
304310
return STATUS_SUCCESS;
305311
}
306312

313+
__attribute__((no_sanitize("function")))
307314
int dbase_llist_clear(semanage_handle_t * handle, dbase_llist_t * dbase)
308315
{
309316

@@ -331,6 +338,7 @@ int dbase_llist_clear(semanage_handle_t * handle, dbase_llist_t * dbase)
331338
return STATUS_SUCCESS;
332339
}
333340

341+
__attribute__((no_sanitize("function")))
334342
int dbase_llist_list(semanage_handle_t * handle,
335343
dbase_llist_t * dbase,
336344
record_t *** records, unsigned int *count)

libsemanage/src/database_policydb.c

+1
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ struct list_handler_arg {
382382
int pos;
383383
};
384384

385+
__attribute__((no_sanitize("function")))
385386
static int list_handler(const record_t * record, void *varg)
386387
{
387388

libsemanage/src/direct_api.c

+1
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,7 @@ static int copy_file_if_exists(const char *src, const char *dst, mode_t mode){
11411141
/* Commits all changes in sandbox to the actual kernel policy.
11421142
* Returns commit number on success, -1 on error.
11431143
*/
1144+
__attribute__((no_sanitize("function")))
11441145
static int semanage_direct_commit(semanage_handle_t * sh)
11451146
{
11461147
char **mod_filenames = NULL;

libsemanage/tests/test_handle.c

+1
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static void helper_select_store(const char *name, enum semanage_connect_type typ
317317
cleanup_handle(SH_HANDLE);
318318
}
319319

320+
__attribute__((no_sanitize("implicit-integer-sign-change")))
320321
static void test_select_store(void)
321322
{
322323
helper_select_store("asdf", SEMANAGE_CON_INVALID - 1, -1);

0 commit comments

Comments
 (0)