On 2020/06/24 23:26, Alexei Starovoitov wrote: > On Wed, Jun 24, 2020 at 5:17 AM Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote: >> >> Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> writes: >> >>> On Tue, Jun 23, 2020 at 01:53:48PM -0500, Eric W. Biederman wrote: >> >>> There is no refcnt bug. It was a user error on tomoyo side. >>> fork_blob() works as expected. >> >> Nope. I have independently confirmed it myself. > > I guess you've tried Tetsuo's fork_blob("#!/bin/true") kernel module ? > yes. that fails. It never meant to be used for this. > With elf blob it works, but breaks if there are rejections > in things like security_bprm_creds_for_exec(). > In my mind that path was 'must succeed or kernel module is toast'. > Like passing NULL into a function that doesn't check for it. > Working on a fix for that since Tetsuo cares. > What is unhappy for pathname based LSMs is that fork_usermode_blob() creates a file with empty filename. I can imagine that somebody would start abusing fork_usermode_blob() as an interface for starting programs like modprobe, hotplug, udevd and sshd. When such situation happened, how fork_usermode_blob() provides information for identifying the intent of such execve() requests? fork_usermode_blob() might also be an unhappy behavior for inode based LSMs (like SELinux and Smack) because it seems that fork_usermode_blob() can't have a chance to associate appropriate security labels based on the content of the byte array because files are created on-demand. Is fork_usermode_blob() friendly to inode based LSMs?