new file mode 100644
@@ -0,0 +1,111 @@
+From b4df97b5199e3fe7563a6e83a36fae031ee4777d Mon Sep 17 00:00:00 2001
+From: Alexander Holler <holler@ahsoftware.de>
+Date: Mon, 2 Feb 2015 16:59:24 +0100
+Subject: [PATCH] WIP: Add option -s to rm to support unlinkat_s() (currently
+ x86_64 only)
+
+Signed-off-by: Alexander Holler <holler@ahsoftware.de>
+---
+ src/mv.c | 1 +
+ src/remove.c | 9 ++++++++-
+ src/remove.h | 3 +++
+ src/rm.c | 9 ++++++++-
+ 4 files changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/src/mv.c b/src/mv.c
+index 0bcc1bb..03d3417 100644
+--- a/src/mv.c
++++ b/src/mv.c
+@@ -76,6 +76,7 @@ rm_option_init (struct rm_options *x)
+ x->ignore_missing_files = false;
+ x->remove_empty_directories = true;
+ x->recursive = true;
++ x->secure = false;
+ x->one_file_system = false;
+
+ /* Should we prompt for removal, too? No. Prompting for the 'move'
+diff --git a/src/remove.c b/src/remove.c
+index db8f993..a97e72c 100644
+--- a/src/remove.c
++++ b/src/remove.c
+@@ -367,7 +367,14 @@ static enum RM_status
+ excise (FTS *fts, FTSENT *ent, struct rm_options const *x, bool is_dir)
+ {
+ int flag = is_dir ? AT_REMOVEDIR : 0;
+- if (unlinkat (fts->fts_cwd_fd, ent->fts_accpath, flag) == 0)
++ int rc;
++#ifdef __x86_64__
++ if (x->secure)
++ rc = syscall (322, fts->fts_cwd_fd, ent->fts_accpath, flag); // x86_64
++ else
++#endif
++ rc = unlinkat (fts->fts_cwd_fd, ent->fts_accpath, flag);
++ if (rc == 0)
+ {
+ if (x->verbose)
+ {
+diff --git a/src/remove.h b/src/remove.h
+index a450192..530b70b 100644
+--- a/src/remove.h
++++ b/src/remove.h
+@@ -49,6 +49,9 @@ struct rm_options
+ /* If true, recursively remove directories. */
+ bool recursive;
+
++ /* If true, use unlinkat_s(). */
++ bool secure;
++
+ /* If true, remove empty directories. */
+ bool remove_empty_directories;
+
+diff --git a/src/rm.c b/src/rm.c
+index c1a23d5..c061579 100644
+--- a/src/rm.c
++++ b/src/rm.c
+@@ -77,6 +77,7 @@ static struct option const long_opts[] =
+ {"-presume-input-tty", no_argument, NULL, PRESUME_INPUT_TTY_OPTION},
+
+ {"recursive", no_argument, NULL, 'r'},
++ {"secure", no_argument, NULL, 's'},
+ {"dir", no_argument, NULL, 'd'},
+ {"verbose", no_argument, NULL, 'v'},
+ {GETOPT_HELP_OPTION_DECL},
+@@ -155,6 +156,7 @@ Remove (unlink) the FILE(s).\n\
+ --no-preserve-root do not treat '/' specially\n\
+ --preserve-root do not remove '/' (default)\n\
+ -r, -R, --recursive remove directories and their contents recursively\n\
++ -s, --secure securely (use unlinkat_s)\n\
+ -d, --dir remove empty directories\n\
+ -v, --verbose explain what is being done\n\
+ "), stdout);
+@@ -193,6 +195,7 @@ rm_option_init (struct rm_options *x)
+ x->one_file_system = false;
+ x->remove_empty_directories = false;
+ x->recursive = false;
++ x->secure = false;
+ x->root_dev_ino = NULL;
+ x->stdin_tty = isatty (STDIN_FILENO);
+ x->verbose = false;
+@@ -223,7 +226,7 @@ main (int argc, char **argv)
+ /* Try to disable the ability to unlink a directory. */
+ priv_set_remove_linkdir ();
+
+- while ((c = getopt_long (argc, argv, "dfirvIR", long_opts, NULL)) != -1)
++ while ((c = getopt_long (argc, argv, "dfirsvIR", long_opts, NULL)) != -1)
+ {
+ switch (c)
+ {
+@@ -254,6 +257,10 @@ main (int argc, char **argv)
+ x.recursive = true;
+ break;
+
++ case 's':
++ x.secure = true;
++ break;
++
+ case INTERACTIVE_OPTION:
+ {
+ int i;
+--
+2.1.0
+
You have to build the new rm yourself Signed-off-by: Alexander Holler <holler@ahsoftware.de> --- ...ion-s-to-rm-to-support-unlinkat_s-current.patch | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 0001-WIP-Add-option-s-to-rm-to-support-unlinkat_s-current.patch