Re: Pre-Fix for rename hole


From: Stanislav Ievlev <inger@altlinux.ru>
Subject: Re: Pre-Fix for rename hole
Date: Mon, 04 Jun 2001 10:47:25 +0400

Next Article (by Date): Re: Better syscall handling Amon Ott
Previous Article (by Date): Re: to developers: flags Arkady A Drovosekov
Top of Thread: Pre-Fix for rename hole Amon Ott
Next in Thread: Re: Pre-Fix for rename hole Amon Ott
Articles sorted by: [Date] [Author] [Subject]


--------------070505020406040503040206
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hello!

Amon Ott wrote:

>On Fre, 01 Jun 2001 Amon Ott wrote:
>
>>Hello again!
>>
>>Attached is a pre version of a fix for the rename hole. It contains
>>DELETE request, attribute setting and secure delete call for ext2. Everything
>>else will only be in 1.1.2-pre5.
>>
>>The patch is against kernel 2.4.4-rsbac-v1.1.2-pre4, but should also be working
>>with other 2.4 kernel versions and rsbac 1.1.1.
>>
>
>Ups, something went wrong with the atttachment. Sorry.
>
>Amon.
>
>
>------------------------------------------------------------------------
>
>--- linux-2.4.3-rsbac-1.1.2/fs/namei.c	Fri Apr 20 17:36:34 2001
>+++ linux-2.4.4-rsbac-1.1.2/fs/namei.c	Thu May 31 13:39:33 2001
>@@ -2489,7 +2489,9 @@
>         #ifdef CONFIG_RSBAC
>         enum  rsbac_target_t          rsbac_target;
>         union rsbac_target_id_t       rsbac_target_id;
>+        union rsbac_target_id_t       rsbac_new_target_id;
>         union rsbac_attribute_value_t rsbac_attribute_value;
>+        boolean target_exists = FALSE;
>         #endif
> 
> 	if (path_init(oldname, LOOKUP_PARENT, &oldnd))
>@@ -2534,6 +2536,10 @@
> 		if (newnd.last.name[newnd.last.len])
> 			goto exit4;
> 	}
>+	new_dentry = lookup_hash(&newnd.last, new_dir);
>+	error = PTR_ERR(new_dentry);
>+	if (IS_ERR(new_dentry))
>+		goto exit4;
> 
>         /* RSBAC */
>         #ifdef CONFIG_RSBAC
>@@ -2559,6 +2565,7 @@
>                                rsbac_attribute_value))
>           {
>             error = -EPERM;
>+            dput(new_dentry);
>             goto exit4;
>           }
>         if (rsbac_debug_aef)
>@@ -2576,19 +2583,64 @@
>                                rsbac_attribute_value))
>           {
>             error = -EPERM;
>+            dput(new_dentry);
>             goto exit4;
>           }
>+        if(new_dentry->d_inode)
>+          {
>+            target_exists = TRUE;
>+            if (rsbac_debug_aef)
>+              printk(KERN_DEBUG
>+                     "do_rename() [sys_rename()]: calling ADF for DELETE on existing target\n");
>+            rsbac_target = T_FILE;
>+            if (S_ISDIR(new_dentry->d_inode->i_mode))
>+              rsbac_target = T_DIR;
>+            else if (S_ISFIFO (new_dentry->d_inode->i_mode))
>+              rsbac_target = T_FIFO;
>+            else if (S_ISLNK (new_dentry->d_inode->i_mode))
>+              rsbac_target = T_SYMLINK;
>+            rsbac_target_id.file.device = new_dentry->d_inode->i_dev;
>+            rsbac_target_id.file.inode  = new_dentry->d_inode->i_ino;
>+            rsbac_target_id.file.dentry_p = new_dentry;
>+            rsbac_attribute_value.nlink = new_dentry->d_inode->i_nlink;
>+            if (!rsbac_adf_request(R_DELETE,
>+                                   current->pid,
>+                                   rsbac_target,
>+                                   rsbac_target_id,
>+                                   A_nlink,
>+                                   rsbac_attribute_value))
>+              {
>+                error = -EPERM;
>+                dput(new_dentry);
>+                goto exit4;
>+              }
>+          }
>         #endif /* CONFIG_RSBAC */
>
I think we need to check parent directory for R_WRITE if target doesn't 
exist.
--------------------
With best regards
Stanislav Ievlev.


--------------070505020406040503040206
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<html><head></head><body>Hello!<br>
<br>
Amon Ott wrote:<br>
<blockquote type="cite" cite="mid:01060115275102.00940@marvin"><pre wrap="">On Fre, 01 Jun 2001 Amon Ott wrote:<br></pre>
  <blockquote type="cite"><pre wrap="">Hello again!<br><br>Attached is a pre version of a fix for the rename hole. It contains<br>DELETE request, attribute setting and secure delete call for ext2. Everything<br>else will only be in 1.1.2-pre5.<br><br>The patch is against kernel 2.4.4-rsbac-v1.1.2-pre4, but should also be working<br>with other 2.4 kernel versions and rsbac 1.1.1.<br></pre></blockquote>
    <pre wrap=""><!----><br>Ups, something went wrong with the atttachment. Sorry.<br><br>Amon.</pre>
    <pre wrap=""><br><hr width="90%" size="4"><br>--- linux-2.4.3-rsbac-1.1.2/fs/namei.c	Fri Apr 20 17:36:34 2001<br>+++ linux-2.4.4-rsbac-1.1.2/fs/namei.c	Thu May 31 13:39:33 2001<br>@@ -2489,7 +2489,9 @@<br>         #ifdef CONFIG_RSBAC<br>         enum  rsbac_target_t          rsbac_target;<br>         union rsbac_target_id_t       rsbac_target_id;<br>+        union rsbac_target_id_t       rsbac_new_target_id;<br>         union rsbac_attribute_value_t rsbac_attribute_value;<br>+        boolean target_exists = FALSE;<br>         #endif<br> <br> 	if (path_init(oldname, LOOKUP_PARENT, &amp;oldnd))<br>@@ -2534,6 +2536,10 @@<br> 		if (newnd.last.name[newnd.last.len])<br> 			goto exit4;<br> 	}<br>+	new_dentry = lookup_hash(&amp;newnd.last, new_dir);<br>+	error = PTR_ERR(new_dentry);<br>+	if (IS_ERR(new_dentry))<br>+		goto exit4;<br> <br>         /* RSBAC */<br>         #ifdef CONFIG_RSBAC<br>@@ -2559,6 +2565,7 @@<br>                                rsbac_attribute_value))<br>           {<br>             error = -EPERM;<br>+            dput(new_dentry);<br>             goto exit4;<br>           }<br>         if (rsbac_debug_aef)<br>@@ -2576,19 +2583,64 @@<br>                                rsbac_attribute_value))<br>           {<br>             error = -EPERM;<br>+            dput(new_dentry);<br>             goto exit4;<br>           }<br>+        if(new_dentry-&gt;d_inode)<br>+          {<br>+            target_exists = TRUE;<br>+            if (rsbac_debug_aef)<br>+              printk(KERN_DEBUG<br>+                     "do_rename() [sys_rename()]: calling ADF for DELETE on existing target\n");<br>+            rsbac_target = T_FILE;<br>+            if (S_ISDIR(new_dentry-&gt;d_inode-&gt;i_mode))<br>+              rsbac_target = T_DIR;<br>+            else if (S_ISFIFO (new_dentry-&gt;d_inode-&gt;i_mode))<br>+              rsbac_target = T_FIFO;<br>+            else if (S_ISLNK (new_dentry-&gt;d_inode-&gt;i_mode))<br>+              rsbac_target = T_SYMLINK;<br>+            rsbac_target_id.file.device = new_dentry-&gt;d_inode-&gt;i_dev;<br>+            rsbac_target_id.file.inode  = new_dentry-&gt;d_inode-&gt;i_ino;<br>+            rsbac_target_id.file.dentry_p = new_dentry;<br>+            rsbac_attribute_value.nlink = new_dentry-&gt;d_inode-&gt;i_nlink;<br>+            if (!rsbac_adf_request(R_DELETE,<br>+                                   current-&gt;pid,<br>+                                   rsbac_target,<br>+                                   rsbac_target_id,<br>+                                   A_nlink,<br>+                                   rsbac_attribute_value))<br>+              {<br>+                error = -EPERM;<br>+                dput(new_dentry);<br>+                goto exit4;<br>+              }<br>+          }<br>         #endif /* CONFIG_RSBAC */</pre>
    </blockquote>
I think we need to check parent directory for R_WRITE if target doesn't exist.<br>
--------------------<br>
With best regards<br>
Stanislav Ievlev.<br>
    <br>
    <blockquote type="cite" cite="mid:01060115275102.00940@marvin"></blockquote>
</body></html>
--------------070505020406040503040206--

-
To unsubscribe from the rsbac list, send a mail to
majordomo@rsbac.org with
unsubscribe rsbac
as single line in the body.

Next Article (by Date): Re: Better syscall handling Amon Ott
Previous Article (by Date): Re: to developers: flags Arkady A Drovosekov
Top of Thread: Pre-Fix for rename hole Amon Ott
Next in Thread: Re: Pre-Fix for rename hole Amon Ott
Articles sorted by: [Date] [Author] [Subject]


Go to Compuniverse LWGate Home Page.