On Fri, Feb 26, 2021 at 11:57:43AM +0100, Peter Zijlstra wrote: > +static bool objtool_create_backup(const char *_objname) > +{ > + int len = strlen(_objname); > + char *buf, *base, *name = malloc(len+3); > + int s, d, l, t; > + > + if (!name) { > + WARN("failed backup name malloc"); > + return false; > + } > + > + strcpy(name, _objname); > + strcpy(name + len, "bj"); > + > + d = open(name, O_CREAT|O_WRONLY|O_TRUNC);
Yah, as mentioned on IRC and let me paste it here too, you need to supply mode with O_CREAT: d = open(name, O_CREAT|O_RDWR|O_TRUNC,S_IRUSR); or so. Also you could add perror("open") to those error paths so that it can say why it failed creating the backup file. With that, thanks for doing those! Acked-by: Borislav Petkov <b...@suse.de> -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette