From 8ab4d809712bd2ff7c64a53c7f444005090ea595 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 15 Nov 2024 13:16:17 +0100 Subject: tools/syz-declextract: don't generate NLA_REJECT/TYPE_MAX attrs These are not accepted as inputs (NLA_REJECT is usually used in dump operation). --- tools/syz-declextract/syz-declextract.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/syz-declextract/syz-declextract.cpp b/tools/syz-declextract/syz-declextract.cpp index 370102ef4..14d444944 100644 --- a/tools/syz-declextract/syz-declextract.cpp +++ b/tools/syz-declextract/syz-declextract.cpp @@ -701,7 +701,7 @@ private: if (type == "BITFIELD32") { // TODO:Extract valued values from NLA_POLICY_BITFIELD32 macro. return "int32"; } - if (type == "UNSPEC" || type == "NESTED" || type == "NESTED_ARRAY" || type == "REJECT" || type == "TYPE_MAX") { + if (type == "UNSPEC" || type == "NESTED" || type == "NESTED_ARRAY") { return nlaArraySubtype(name, type, len, typeOfLen); } fprintf(stderr, "Unsupported netlink type %s\n", type.c_str()); @@ -804,6 +804,9 @@ private: Expr::EvalResult evalResult; fields[i][0]->EvaluateAsConstantExpr(evalResult, *context); // This contains the NLA Enum type const auto &nlaEnum = u8ToNlaEnum[evalResult.Val.getInt().getZExtValue()]; + if (nlaEnum == "REJECT") { + continue; + } auto [structDecl, len] = getNetlinkStruct(fields[i][2]->IgnoreCasts(), context); std::string netlinkStruct; if (!structDecl) { -- cgit mrf-deployment