11f5207b7SJohn Levon /*
21f5207b7SJohn Levon * Copyright (C) 2011 Dan Carpenter.
31f5207b7SJohn Levon *
41f5207b7SJohn Levon * This program is free software; you can redistribute it and/or
51f5207b7SJohn Levon * modify it under the terms of the GNU General Public License
61f5207b7SJohn Levon * as published by the Free Software Foundation; either version 2
71f5207b7SJohn Levon * of the License, or (at your option) any later version.
81f5207b7SJohn Levon *
91f5207b7SJohn Levon * This program is distributed in the hope that it will be useful,
101f5207b7SJohn Levon * but WITHOUT ANY WARRANTY; without even the implied warranty of
111f5207b7SJohn Levon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
121f5207b7SJohn Levon * GNU General Public License for more details.
131f5207b7SJohn Levon *
141f5207b7SJohn Levon * You should have received a copy of the GNU General Public License
151f5207b7SJohn Levon * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
161f5207b7SJohn Levon */
171f5207b7SJohn Levon
181f5207b7SJohn Levon /* Does a search for Dan Rosenberg style info leaks */
191f5207b7SJohn Levon
201f5207b7SJohn Levon /* fixme: struct includes a struct with a hole in it */
211f5207b7SJohn Levon /* function is called that clears the struct */
221f5207b7SJohn Levon
231f5207b7SJohn Levon #include "scope.h"
241f5207b7SJohn Levon #include "smatch.h"
251f5207b7SJohn Levon #include "smatch_function_hashtable.h"
261f5207b7SJohn Levon #include "smatch_slist.h"
271f5207b7SJohn Levon #include "smatch_extra.h"
281f5207b7SJohn Levon
291f5207b7SJohn Levon static int my_whole_id;
301f5207b7SJohn Levon static int my_member_id;
31*c85f09ccSJohn Levon static int skb_put_id;
321f5207b7SJohn Levon
331f5207b7SJohn Levon STATE(cleared);
341f5207b7SJohn Levon
extra_mod_hook(const char * name,struct symbol * sym,struct expression * expr,struct smatch_state * state)351f5207b7SJohn Levon static void extra_mod_hook(const char *name, struct symbol *sym, struct expression *expr, struct smatch_state *state)
361f5207b7SJohn Levon {
371f5207b7SJohn Levon struct symbol *type;
381f5207b7SJohn Levon
391f5207b7SJohn Levon type = get_real_base_type(sym);
401f5207b7SJohn Levon if (!type || type->type != SYM_STRUCT)
411f5207b7SJohn Levon return;
421f5207b7SJohn Levon
431f5207b7SJohn Levon set_state(my_member_id, name, sym, state);
441f5207b7SJohn Levon }
451f5207b7SJohn Levon
print_holey_warning(struct expression * data,const char * member)461f5207b7SJohn Levon static void print_holey_warning(struct expression *data, const char *member)
471f5207b7SJohn Levon {
481f5207b7SJohn Levon char *name;
491f5207b7SJohn Levon
501f5207b7SJohn Levon name = expr_to_str(data);
511f5207b7SJohn Levon if (member) {
521f5207b7SJohn Levon sm_warning("check that '%s' doesn't leak information (struct has a hole after '%s')",
531f5207b7SJohn Levon name, member);
541f5207b7SJohn Levon } else {
551f5207b7SJohn Levon sm_warning("check that '%s' doesn't leak information (struct has holes)",
561f5207b7SJohn Levon name);
571f5207b7SJohn Levon }
581f5207b7SJohn Levon free_string(name);
591f5207b7SJohn Levon }
601f5207b7SJohn Levon
check_struct(struct expression * expr,struct symbol * type)611f5207b7SJohn Levon static int check_struct(struct expression *expr, struct symbol *type)
621f5207b7SJohn Levon {
631f5207b7SJohn Levon struct symbol *tmp, *base_type;
641f5207b7SJohn Levon const char *prev = NULL;
651f5207b7SJohn Levon int align;
661f5207b7SJohn Levon
671f5207b7SJohn Levon if (type->ctype.alignment == 1)
681f5207b7SJohn Levon return 0;
691f5207b7SJohn Levon
701f5207b7SJohn Levon align = 0;
711f5207b7SJohn Levon FOR_EACH_PTR(type->symbol_list, tmp) {
721f5207b7SJohn Levon base_type = get_real_base_type(tmp);
731f5207b7SJohn Levon if (base_type && base_type->type == SYM_STRUCT) {
741f5207b7SJohn Levon if (check_struct(expr, base_type))
751f5207b7SJohn Levon return 1;
761f5207b7SJohn Levon }
771f5207b7SJohn Levon
781f5207b7SJohn Levon if (!tmp->ctype.alignment) {
791f5207b7SJohn Levon sm_perror("cannot determine the alignment here");
801f5207b7SJohn Levon } else if (align % tmp->ctype.alignment) {
811f5207b7SJohn Levon print_holey_warning(expr, prev);
821f5207b7SJohn Levon return 1;
831f5207b7SJohn Levon }
841f5207b7SJohn Levon
851f5207b7SJohn Levon if (base_type == &bool_ctype)
861f5207b7SJohn Levon align += 1;
871f5207b7SJohn Levon else if (type_bits(tmp) <= 0)
881f5207b7SJohn Levon align = 0;
891f5207b7SJohn Levon else
901f5207b7SJohn Levon align += type_bytes(tmp);
911f5207b7SJohn Levon
921f5207b7SJohn Levon if (tmp->ident)
931f5207b7SJohn Levon prev = tmp->ident->name;
941f5207b7SJohn Levon else
951f5207b7SJohn Levon prev = NULL;
961f5207b7SJohn Levon } END_FOR_EACH_PTR(tmp);
971f5207b7SJohn Levon
981f5207b7SJohn Levon if (align % type->ctype.alignment) {
991f5207b7SJohn Levon print_holey_warning(expr, prev);
1001f5207b7SJohn Levon return 1;
1011f5207b7SJohn Levon }
1021f5207b7SJohn Levon
1031f5207b7SJohn Levon return 0;
1041f5207b7SJohn Levon }
1051f5207b7SJohn Levon
warn_on_holey_struct(struct expression * expr)1061f5207b7SJohn Levon static int warn_on_holey_struct(struct expression *expr)
1071f5207b7SJohn Levon {
1081f5207b7SJohn Levon struct symbol *type;
1091f5207b7SJohn Levon type = get_type(expr);
1101f5207b7SJohn Levon if (!type || type->type != SYM_STRUCT)
1111f5207b7SJohn Levon return 0;
1121f5207b7SJohn Levon
1131f5207b7SJohn Levon return check_struct(expr, type);
1141f5207b7SJohn Levon }
1151f5207b7SJohn Levon
has_global_scope(struct expression * expr)1161f5207b7SJohn Levon static int has_global_scope(struct expression *expr)
1171f5207b7SJohn Levon {
1181f5207b7SJohn Levon struct symbol *sym;
1191f5207b7SJohn Levon
1201f5207b7SJohn Levon if (expr->type != EXPR_SYMBOL)
1211f5207b7SJohn Levon return FALSE;
1221f5207b7SJohn Levon sym = expr->symbol;
1231f5207b7SJohn Levon if (!sym)
1241f5207b7SJohn Levon return FALSE;
1251f5207b7SJohn Levon return toplevel(sym->scope);
1261f5207b7SJohn Levon }
1271f5207b7SJohn Levon
match_clear(const char * fn,struct expression * expr,void * _arg_no)1281f5207b7SJohn Levon static void match_clear(const char *fn, struct expression *expr, void *_arg_no)
1291f5207b7SJohn Levon {
1301f5207b7SJohn Levon struct expression *ptr;
1311f5207b7SJohn Levon int arg_no = PTR_INT(_arg_no);
1321f5207b7SJohn Levon
1331f5207b7SJohn Levon ptr = get_argument_from_call_expr(expr->args, arg_no);
1341f5207b7SJohn Levon if (!ptr)
1351f5207b7SJohn Levon return;
1361f5207b7SJohn Levon ptr = strip_expr(ptr);
1371f5207b7SJohn Levon if (ptr->type != EXPR_PREOP || ptr->op != '&')
1381f5207b7SJohn Levon return;
1391f5207b7SJohn Levon ptr = strip_expr(ptr->unop);
1401f5207b7SJohn Levon set_state_expr(my_whole_id, ptr, &cleared);
1411f5207b7SJohn Levon }
1421f5207b7SJohn Levon
was_memset(struct expression * expr)1431f5207b7SJohn Levon static int was_memset(struct expression *expr)
1441f5207b7SJohn Levon {
1451f5207b7SJohn Levon if (get_state_expr(my_whole_id, expr) == &cleared)
1461f5207b7SJohn Levon return 1;
1471f5207b7SJohn Levon return 0;
1481f5207b7SJohn Levon }
1491f5207b7SJohn Levon
member_initialized(char * name,struct symbol * outer,struct symbol * member,int pointer)1501f5207b7SJohn Levon static int member_initialized(char *name, struct symbol *outer, struct symbol *member, int pointer)
1511f5207b7SJohn Levon {
1521f5207b7SJohn Levon char buf[256];
1531f5207b7SJohn Levon struct symbol *base;
1541f5207b7SJohn Levon
1551f5207b7SJohn Levon base = get_base_type(member);
1561f5207b7SJohn Levon if (!base || base->type != SYM_BASETYPE || !member->ident)
1571f5207b7SJohn Levon return FALSE;
1581f5207b7SJohn Levon
1591f5207b7SJohn Levon if (pointer)
1601f5207b7SJohn Levon snprintf(buf, 256, "%s->%s", name, member->ident->name);
1611f5207b7SJohn Levon else
1621f5207b7SJohn Levon snprintf(buf, 256, "%s.%s", name, member->ident->name);
1631f5207b7SJohn Levon
1641f5207b7SJohn Levon if (get_state(my_member_id, buf, outer))
1651f5207b7SJohn Levon return TRUE;
1661f5207b7SJohn Levon
1671f5207b7SJohn Levon return FALSE;
1681f5207b7SJohn Levon }
1691f5207b7SJohn Levon
member_uninitialized(char * name,struct symbol * outer,struct symbol * member,int pointer)1701f5207b7SJohn Levon static int member_uninitialized(char *name, struct symbol *outer, struct symbol *member, int pointer)
1711f5207b7SJohn Levon {
1721f5207b7SJohn Levon char buf[256];
1731f5207b7SJohn Levon struct symbol *base;
1741f5207b7SJohn Levon struct sm_state *sm;
1751f5207b7SJohn Levon
1761f5207b7SJohn Levon base = get_base_type(member);
1771f5207b7SJohn Levon if (!base || base->type != SYM_BASETYPE || !member->ident)
1781f5207b7SJohn Levon return FALSE;
1791f5207b7SJohn Levon
1801f5207b7SJohn Levon if (pointer)
1811f5207b7SJohn Levon snprintf(buf, 256, "%s->%s", name, member->ident->name);
1821f5207b7SJohn Levon else
1831f5207b7SJohn Levon snprintf(buf, 256, "%s.%s", name, member->ident->name);
1841f5207b7SJohn Levon
1851f5207b7SJohn Levon sm = get_sm_state(my_member_id, buf, outer);
1861f5207b7SJohn Levon if (sm && !slist_has_state(sm->possible, &undefined))
1871f5207b7SJohn Levon return FALSE;
1881f5207b7SJohn Levon
1891f5207b7SJohn Levon sm_warning("check that '%s' doesn't leak information", buf);
1901f5207b7SJohn Levon return TRUE;
1911f5207b7SJohn Levon }
1921f5207b7SJohn Levon
check_members_initialized(struct expression * expr)1931f5207b7SJohn Levon static int check_members_initialized(struct expression *expr)
1941f5207b7SJohn Levon {
1951f5207b7SJohn Levon char *name;
1961f5207b7SJohn Levon struct symbol *outer;
1971f5207b7SJohn Levon struct symbol *sym;
1981f5207b7SJohn Levon struct symbol *tmp;
1991f5207b7SJohn Levon int pointer = 0;
2001f5207b7SJohn Levon int printed = 0;
2011f5207b7SJohn Levon
2021f5207b7SJohn Levon sym = get_type(expr);
2031f5207b7SJohn Levon if (sym && sym->type == SYM_PTR) {
2041f5207b7SJohn Levon pointer = 1;
2051f5207b7SJohn Levon sym = get_real_base_type(sym);
2061f5207b7SJohn Levon }
2071f5207b7SJohn Levon if (!sym)
2081f5207b7SJohn Levon return 0;
2091f5207b7SJohn Levon if (sym->type != SYM_STRUCT)
2101f5207b7SJohn Levon return 0;
2111f5207b7SJohn Levon
2121f5207b7SJohn Levon name = expr_to_var_sym(expr, &outer);
2131f5207b7SJohn Levon
2141f5207b7SJohn Levon /*
2151f5207b7SJohn Levon * check that at least one member was set. If all of them were not set
2161f5207b7SJohn Levon * it's more likely a problem in the check than a problem in the kernel
2171f5207b7SJohn Levon * code.
2181f5207b7SJohn Levon */
2191f5207b7SJohn Levon FOR_EACH_PTR(sym->symbol_list, tmp) {
2201f5207b7SJohn Levon if (member_initialized(name, outer, tmp, pointer))
2211f5207b7SJohn Levon goto check;
2221f5207b7SJohn Levon } END_FOR_EACH_PTR(tmp);
2231f5207b7SJohn Levon goto out;
2241f5207b7SJohn Levon
2251f5207b7SJohn Levon check:
2261f5207b7SJohn Levon FOR_EACH_PTR(sym->symbol_list, tmp) {
2271f5207b7SJohn Levon if (member_uninitialized(name, outer, tmp, pointer)) {
2281f5207b7SJohn Levon printed = 1;
2291f5207b7SJohn Levon goto out;
2301f5207b7SJohn Levon }
2311f5207b7SJohn Levon } END_FOR_EACH_PTR(tmp);
2321f5207b7SJohn Levon out:
2331f5207b7SJohn Levon free_string(name);
2341f5207b7SJohn Levon return printed;
2351f5207b7SJohn Levon }
2361f5207b7SJohn Levon
check_was_initialized(struct expression * data)2371f5207b7SJohn Levon static void check_was_initialized(struct expression *data)
2381f5207b7SJohn Levon {
2391f5207b7SJohn Levon data = strip_expr(data);
2401f5207b7SJohn Levon if (!data)
2411f5207b7SJohn Levon return;
2421f5207b7SJohn Levon if (data->type == EXPR_PREOP && data->op == '&')
2431f5207b7SJohn Levon data = strip_expr(data->unop);
2441f5207b7SJohn Levon if (data->type != EXPR_SYMBOL)
2451f5207b7SJohn Levon return;
2461f5207b7SJohn Levon
2471f5207b7SJohn Levon if (has_global_scope(data))
2481f5207b7SJohn Levon return;
249*c85f09ccSJohn Levon if (was_memset(data))
2501f5207b7SJohn Levon return;
251*c85f09ccSJohn Levon if (warn_on_holey_struct(data))
252*c85f09ccSJohn Levon return;
253*c85f09ccSJohn Levon check_members_initialized(data);
254*c85f09ccSJohn Levon }
255*c85f09ccSJohn Levon
check_skb_put(struct expression * data)256*c85f09ccSJohn Levon static void check_skb_put(struct expression *data)
257*c85f09ccSJohn Levon {
258*c85f09ccSJohn Levon data = strip_expr(data);
259*c85f09ccSJohn Levon if (!data)
260*c85f09ccSJohn Levon return;
261*c85f09ccSJohn Levon if (data->type == EXPR_PREOP && data->op == '&')
262*c85f09ccSJohn Levon data = strip_expr(data->unop);
263*c85f09ccSJohn Levon
2641f5207b7SJohn Levon if (was_memset(data))
2651f5207b7SJohn Levon return;
2661f5207b7SJohn Levon if (warn_on_holey_struct(data))
2671f5207b7SJohn Levon return;
2681f5207b7SJohn Levon check_members_initialized(data);
2691f5207b7SJohn Levon }
2701f5207b7SJohn Levon
match_copy_to_user(const char * fn,struct expression * expr,void * _arg)2711f5207b7SJohn Levon static void match_copy_to_user(const char *fn, struct expression *expr, void *_arg)
2721f5207b7SJohn Levon {
2731f5207b7SJohn Levon int arg = PTR_INT(_arg);
2741f5207b7SJohn Levon struct expression *data;
2751f5207b7SJohn Levon
2761f5207b7SJohn Levon data = get_argument_from_call_expr(expr->args, arg);
2771f5207b7SJohn Levon data = strip_expr(data);
2781f5207b7SJohn Levon if (!data)
2791f5207b7SJohn Levon return;
2801f5207b7SJohn Levon if (data->type != EXPR_PREOP || data->op != '&')
2811f5207b7SJohn Levon return;
2821f5207b7SJohn Levon check_was_initialized(data);
2831f5207b7SJohn Levon }
2841f5207b7SJohn Levon
db_param_cleared(struct expression * expr,int param,char * key,char * value)2851f5207b7SJohn Levon static void db_param_cleared(struct expression *expr, int param, char *key, char *value)
2861f5207b7SJohn Levon {
2871f5207b7SJohn Levon while (expr->type == EXPR_ASSIGNMENT)
2881f5207b7SJohn Levon expr = strip_expr(expr->right);
2891f5207b7SJohn Levon if (expr->type != EXPR_CALL)
2901f5207b7SJohn Levon return;
2911f5207b7SJohn Levon
2921f5207b7SJohn Levon match_clear(NULL, expr, INT_PTR(param));
2931f5207b7SJohn Levon }
2941f5207b7SJohn Levon
alloc_expr_state(struct expression * expr)295*c85f09ccSJohn Levon static struct smatch_state *alloc_expr_state(struct expression *expr)
296*c85f09ccSJohn Levon {
297*c85f09ccSJohn Levon struct smatch_state *state;
298*c85f09ccSJohn Levon char *name;
299*c85f09ccSJohn Levon
300*c85f09ccSJohn Levon name = expr_to_str(expr);
301*c85f09ccSJohn Levon if (!name)
302*c85f09ccSJohn Levon return NULL;
303*c85f09ccSJohn Levon
304*c85f09ccSJohn Levon state = __alloc_smatch_state(0);
305*c85f09ccSJohn Levon expr = strip_expr(expr);
306*c85f09ccSJohn Levon state->name = alloc_sname(name);
307*c85f09ccSJohn Levon free_string(name);
308*c85f09ccSJohn Levon state->data = expr;
309*c85f09ccSJohn Levon return state;
310*c85f09ccSJohn Levon }
311*c85f09ccSJohn Levon
match_skb_put(const char * fn,struct expression * expr,void * unused)312*c85f09ccSJohn Levon static void match_skb_put(const char *fn, struct expression *expr, void *unused)
3131f5207b7SJohn Levon {
3141f5207b7SJohn Levon struct symbol *type;
315*c85f09ccSJohn Levon struct smatch_state *state;
3161f5207b7SJohn Levon
3171f5207b7SJohn Levon type = get_type(expr->left);
318*c85f09ccSJohn Levon type = get_real_base_type(type);
3191f5207b7SJohn Levon if (!type || type->type != SYM_STRUCT)
3201f5207b7SJohn Levon return;
321*c85f09ccSJohn Levon state = alloc_expr_state(expr->left);
322*c85f09ccSJohn Levon set_state_expr(skb_put_id, expr->left, state);
323*c85f09ccSJohn Levon }
324*c85f09ccSJohn Levon
match_return_skb_put(struct expression * expr)325*c85f09ccSJohn Levon static void match_return_skb_put(struct expression *expr)
326*c85f09ccSJohn Levon {
327*c85f09ccSJohn Levon struct sm_state *sm;
328*c85f09ccSJohn Levon struct stree *stree;
329*c85f09ccSJohn Levon
330*c85f09ccSJohn Levon if (is_error_return(expr))
331*c85f09ccSJohn Levon return;
332*c85f09ccSJohn Levon
333*c85f09ccSJohn Levon stree = __get_cur_stree();
334*c85f09ccSJohn Levon
335*c85f09ccSJohn Levon FOR_EACH_MY_SM(skb_put_id, stree, sm) {
336*c85f09ccSJohn Levon check_skb_put(sm->state->data);
337*c85f09ccSJohn Levon } END_FOR_EACH_SM(sm);
3381f5207b7SJohn Levon }
3391f5207b7SJohn Levon
register_clears_argument(void)3401f5207b7SJohn Levon static void register_clears_argument(void)
3411f5207b7SJohn Levon {
3421f5207b7SJohn Levon struct token *token;
3431f5207b7SJohn Levon const char *func;
3441f5207b7SJohn Levon int arg;
3451f5207b7SJohn Levon
3461f5207b7SJohn Levon token = get_tokens_file("kernel.clears_argument");
3471f5207b7SJohn Levon if (!token)
3481f5207b7SJohn Levon return;
3491f5207b7SJohn Levon if (token_type(token) != TOKEN_STREAMBEGIN)
3501f5207b7SJohn Levon return;
3511f5207b7SJohn Levon token = token->next;
3521f5207b7SJohn Levon while (token_type(token) != TOKEN_STREAMEND) {
3531f5207b7SJohn Levon if (token_type(token) != TOKEN_IDENT)
3541f5207b7SJohn Levon return;
3551f5207b7SJohn Levon func = show_ident(token->ident);
3561f5207b7SJohn Levon token = token->next;
3571f5207b7SJohn Levon if (token_type(token) != TOKEN_NUMBER)
3581f5207b7SJohn Levon return;
3591f5207b7SJohn Levon arg = atoi(token->number);
3601f5207b7SJohn Levon
3611f5207b7SJohn Levon add_function_hook(func, &match_clear, INT_PTR(arg));
3621f5207b7SJohn Levon token = token->next;
3631f5207b7SJohn Levon }
3641f5207b7SJohn Levon clear_token_alloc();
3651f5207b7SJohn Levon }
3661f5207b7SJohn Levon
register_copy_funcs_from_file(void)3671f5207b7SJohn Levon static void register_copy_funcs_from_file(void)
3681f5207b7SJohn Levon {
3691f5207b7SJohn Levon struct token *token;
3701f5207b7SJohn Levon const char *func;
3711f5207b7SJohn Levon int arg;
3721f5207b7SJohn Levon
3731f5207b7SJohn Levon token = get_tokens_file("kernel.rosenberg_funcs");
3741f5207b7SJohn Levon if (!token)
3751f5207b7SJohn Levon return;
3761f5207b7SJohn Levon if (token_type(token) != TOKEN_STREAMBEGIN)
3771f5207b7SJohn Levon return;
3781f5207b7SJohn Levon token = token->next;
3791f5207b7SJohn Levon while (token_type(token) != TOKEN_STREAMEND) {
3801f5207b7SJohn Levon if (token_type(token) != TOKEN_IDENT)
3811f5207b7SJohn Levon return;
3821f5207b7SJohn Levon func = show_ident(token->ident);
3831f5207b7SJohn Levon token = token->next;
3841f5207b7SJohn Levon if (token_type(token) != TOKEN_NUMBER)
3851f5207b7SJohn Levon return;
3861f5207b7SJohn Levon arg = atoi(token->number);
3871f5207b7SJohn Levon add_function_hook(func, &match_copy_to_user, INT_PTR(arg));
3881f5207b7SJohn Levon token = token->next;
3891f5207b7SJohn Levon }
3901f5207b7SJohn Levon clear_token_alloc();
3911f5207b7SJohn Levon }
3921f5207b7SJohn Levon
check_rosenberg(int id)3931f5207b7SJohn Levon void check_rosenberg(int id)
3941f5207b7SJohn Levon {
3951f5207b7SJohn Levon if (option_project != PROJ_KERNEL)
3961f5207b7SJohn Levon return;
3971f5207b7SJohn Levon my_whole_id = id;
3981f5207b7SJohn Levon
3991f5207b7SJohn Levon add_function_hook("memset", &match_clear, INT_PTR(0));
4001f5207b7SJohn Levon add_function_hook("memcpy", &match_clear, INT_PTR(0));
4011f5207b7SJohn Levon add_function_hook("memzero", &match_clear, INT_PTR(0));
4021f5207b7SJohn Levon add_function_hook("__memset", &match_clear, INT_PTR(0));
4031f5207b7SJohn Levon add_function_hook("__memcpy", &match_clear, INT_PTR(0));
4041f5207b7SJohn Levon add_function_hook("__memzero", &match_clear, INT_PTR(0));
4051f5207b7SJohn Levon add_function_hook("__builtin_memset", &match_clear, INT_PTR(0));
4061f5207b7SJohn Levon add_function_hook("__builtin_memcpy", &match_clear, INT_PTR(0));
4071f5207b7SJohn Levon
4081f5207b7SJohn Levon register_clears_argument();
4091f5207b7SJohn Levon select_return_states_hook(PARAM_CLEARED, &db_param_cleared);
4101f5207b7SJohn Levon
4111f5207b7SJohn Levon register_copy_funcs_from_file();
4121f5207b7SJohn Levon }
4131f5207b7SJohn Levon
check_rosenberg2(int id)4141f5207b7SJohn Levon void check_rosenberg2(int id)
4151f5207b7SJohn Levon {
4161f5207b7SJohn Levon if (option_project != PROJ_KERNEL)
4171f5207b7SJohn Levon return;
4181f5207b7SJohn Levon
4191f5207b7SJohn Levon my_member_id = id;
420efe51d0cSJohn Levon set_dynamic_states(my_member_id);
4211f5207b7SJohn Levon add_extra_mod_hook(&extra_mod_hook);
4221f5207b7SJohn Levon }
4231f5207b7SJohn Levon
check_rosenberg3(int id)424*c85f09ccSJohn Levon void check_rosenberg3(int id)
425*c85f09ccSJohn Levon {
426*c85f09ccSJohn Levon if (option_project != PROJ_KERNEL)
427*c85f09ccSJohn Levon return;
428*c85f09ccSJohn Levon
429*c85f09ccSJohn Levon skb_put_id = id;
430*c85f09ccSJohn Levon set_dynamic_states(skb_put_id);
431*c85f09ccSJohn Levon add_function_assign_hook("skb_put", &match_skb_put, NULL);
432*c85f09ccSJohn Levon add_hook(&match_return_skb_put, RETURN_HOOK);
433*c85f09ccSJohn Levon }
434*c85f09ccSJohn Levon
435