Skip to content

make read_config() more robust

Yann Droneaud linux-rdma 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 2 repliesIn review
  2. v13 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- rewrote the way files are accessed to use openat()
- made the ownership/permissions checking allow access to user owned files.
- reject symlinks

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11read_config(): ignore files beginning with '.'src/init.c+3 -00 replies
2/11read_config(): ignore directory entry with backup suffix (~)src/init.c+3 -00 replies
3/11read_config(): open configuration directory with open()src/init.c+11 -10 replies
4/11read_config(): move file type check in read_config_file()src/init.c+14 -110 replies
5/11read_config_file(): use the directory file descriptor to open configuration filesrc/init.c+26 -220 replies
6/11read_config_file(): check opened filesrc/init.c+9 -90 replies
7/11read_config(): check opened directorysrc/init.c+19 -20 replies
8/11read_config(): refuse to open IBV_CONFIG_DIR if it's not a directoryconfigure.ac src/init.c+7 -11 reply
9/11Check owner/permissions of config directory/filessrc/init.c+35 -00 replies
10/11read_config(): reject symlinkssrc/init.c+12 -00 replies
11/11read_config_file(): refuse to open configuration file if it's symlinkconfigure.ac src/init.c+7 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH libibverbs v2 00/11] make read_config() more robust

Hi,

Please find patches to protect libibverbs from using invalid, unsecure configuration files.

Thoses configurations files are usually located in /etc/libibverbs.d/ and contains the name of a shared library to dlopen().

Only legitimate shared libraries should be loaded by libibverbs, so it must be careful on the configuration files used.

Changes from v1:

- rewrote the way files are accessed to use openat()
- made the ownership/permissions checking allow access to user owned files.
- reject symlinks

Yann Droneaud (11):
read_config(): ignore files beginning with '.' read_config(): ignore directory entry with backup suffix (~) read_config(): open configuration directory with open() read_config(): move file type check in read_config_file() read_config_file(): use the directory file descriptor to open
configuration file
read_config_file(): check opened file
read_config(): check opened directory
read_config(): refuse to open IBV_CONFIG_DIR if it's not a directory Check owner/permissions of config directory/files read_config(): reject symlinks
read_config_file(): refuse to open configuration file if it's symlink

 configure.ac |  12 ++++++
 src/init.c   | 135 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 123 insertions(+), 24 deletions(-)
Signature · 5 lines
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html