lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <ck3keiqat6rbjfuequgihgtiu62weitsaj37dzxvqogotzqyrz@gzkshhu3wdxg> Date: Tue, 10 Jun 2025 14:12:41 -0700 From: Josh Poimboeuf <jpoimboe@...nel.org> To: Alexandre Chartre <alexandre.chartre@...cle.com> Cc: linux-kernel@...r.kernel.org, mingo@...nel.org, peterz@...radead.org Subject: Re: [RFC 02/13] objtool: Create disassembly context On Fri, Jun 06, 2025 at 05:34:29PM +0200, Alexandre Chartre wrote: > +struct disas_context *disas_context_create(struct objtool_file *file) > +{ > + struct disas_context *dctx; > + > + dctx = malloc(sizeof(*dctx)); > + if (!dctx) { > + WARN("failed too allocate disassembly context\n"); > + return NULL; "too" -> "to". Also, no newline needed for objtool warnings/error strings. Also, might want to use WARN_GLIBC() here. > +void disas_context_destroy(struct disas_context *dctx) > +{ > + free(dctx); > +} In general we try to avoid freeing memory in objtool for performance reasons, though this is the error path so I suppose it's harmless. > -void disas_warned_funcs(struct objtool_file *file) > +void disas_warned_funcs(struct disas_context *dctx) > { > struct symbol *sym; > char *funcs = NULL, *tmp; > > - for_each_sym(file, sym) { > + if (!dctx) { > + ERROR("disassembly context is not defined"); > + return; This will have come from the error in disas_context_create(), no need to print an additional error. > +++ b/tools/objtool/include/objtool/objtool.h > @@ -47,6 +47,9 @@ int check(struct objtool_file *file); > int orc_dump(const char *objname); > int orc_create(struct objtool_file *file); > > -void disas_warned_funcs(struct objtool_file *file); > +struct disas_context; > +struct disas_context *disas_context_create(struct objtool_file *file); > +void disas_context_destroy(struct disas_context *dctx); > +void disas_warned_funcs(struct disas_context *dctx); Can these go in a new disas.h file? -- Josh
Powered by blists - more mailing lists