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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yzbt3D0Wji9DGW0A@nuc>
Date:   Fri, 30 Sep 2022 15:23:40 +0200
From:   Günther Noack <gnoack3000@...il.com>
To:     Mickaël Salaün <mic@...ikod.net>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        linux-security-module@...r.kernel.org,
        Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
        John Johansen <john.johansen@...onical.com>
Subject: Re: [mic:next 4/9] fs/open.c:191: undefined reference to
 `security_file_truncate'

On Fri, Sep 30, 2022 at 11:02:00AM +0200, Mickaël Salaün wrote:
> This build error arises when CONFIG_SECURITY_PATH is disabled. Indeed,
> security_file_truncate() is only defined in security/security.c for such
> option.
>
> I have pushed the (rebased) fix in my next branch. FYI, you can keep the
> current Acked-by.

Thank you, I'll merge that fix into v7 of the truncate patch set. I'll
try to send v7 to the list soon, so that you can have a look at the
newest version of the patch set.

> 
> Original patch:
> https://lore.kernel.org/all/20220908195805.128252-2-gnoack3000@gmail.com/
> 
> 
> On 30/09/2022 04:57, kernel test robot wrote:
> > tree:   git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux.git next
> > head:   054fdc359167ae7c17a5fb47c0edbf5cb4b737b0
> > commit: 0052f28b7cba97cefa48623ef087d1c1cc06078f [4/9] security: create file_truncate hook from path_truncate hook
> > config: x86_64-rhel-8.3-func
> > compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> > reproduce (this is a W=1 build):
> >          # https://git.kernel.org/pub/scm/linux/kernel/git/mic/linux.git/commit/?id=0052f28b7cba97cefa48623ef087d1c1cc06078f
> >          git remote add mic git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux.git
> >          git fetch --no-tags mic next
> >          git checkout 0052f28b7cba97cefa48623ef087d1c1cc06078f
> >          # save the config file
> >          mkdir build_dir && cp config build_dir/.config
> >          make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > 
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp@...el.com>
> > 
> > All errors (new ones prefixed by >>):
> > 
> >     ld: fs/open.o: in function `do_sys_ftruncate':
> > > > fs/open.c:191: undefined reference to `security_file_truncate'
> >     ld: fs/namei.o: in function `handle_truncate':
> > > > fs/namei.c:3214: undefined reference to `security_file_truncate'
> > 
> > 
> > vim +191 fs/open.c
> > 
> >     155	
> >     156	long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
> >     157	{
> >     158		struct inode *inode;
> >     159		struct dentry *dentry;
> >     160		struct fd f;
> >     161		int error;
> >     162	
> >     163		error = -EINVAL;
> >     164		if (length < 0)
> >     165			goto out;
> >     166		error = -EBADF;
> >     167		f = fdget(fd);
> >     168		if (!f.file)
> >     169			goto out;
> >     170	
> >     171		/* explicitly opened as large or we are on 64-bit box */
> >     172		if (f.file->f_flags & O_LARGEFILE)
> >     173			small = 0;
> >     174	
> >     175		dentry = f.file->f_path.dentry;
> >     176		inode = dentry->d_inode;
> >     177		error = -EINVAL;
> >     178		if (!S_ISREG(inode->i_mode) || !(f.file->f_mode & FMODE_WRITE))
> >     179			goto out_putf;
> >     180	
> >     181		error = -EINVAL;
> >     182		/* Cannot ftruncate over 2^31 bytes without large file support */
> >     183		if (small && length > MAX_NON_LFS)
> >     184			goto out_putf;
> >     185	
> >     186		error = -EPERM;
> >     187		/* Check IS_APPEND on real upper inode */
> >     188		if (IS_APPEND(file_inode(f.file)))
> >     189			goto out_putf;
> >     190		sb_start_write(inode->i_sb);
> >   > 191		error = security_file_truncate(f.file);
> >     192		if (!error)
> >     193			error = do_truncate(file_mnt_user_ns(f.file), dentry, length,
> >     194					    ATTR_MTIME | ATTR_CTIME, f.file);
> >     195		sb_end_write(inode->i_sb);
> >     196	out_putf:
> >     197		fdput(f);
> >     198	out:
> >     199		return error;
> >     200	}
> >     201	
> > 

-- 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ