Merge pull request #79 from ryncsn/ignore-non-exec-script

policyscript: ignore non-executable files when specifying a directory

Acked-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Neil Horman 2018-10-12 07:32:34 -04:00 committed by GitHub
commit b63b71bfac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -561,6 +561,11 @@ static void get_irq_user_policy(char *path, int irq, struct user_irq_policy *pol
if (stat(script, &sbuf))
continue;
if (S_ISREG(sbuf.st_mode)) {
if (!(sbuf.st_mode & S_IXUSR)) {
log(TO_CONSOLE, LOG_DEBUG, "Skipping script %s due to lack of executable permission\n", script);
continue;
}
memset(pol, -1, sizeof(struct user_irq_policy));
ret = run_script_for_policy(script, path, irq, pol);
if ((ret < 0) || (ret >= 2)) {

View file

@ -84,6 +84,8 @@ When specified, the referenced script or directory will execute once for each di
with the sysfs device path and IRQ number passed as arguments. Note that the
device path argument will point to the parent directory from which the IRQ
attributes directory may be directly opened.
Policy scripts specified need to be owned and executable by the user of irqbalance process,
if a directory is specified, non-executable files will be skipped.
The script may specify zero or more key=value pairs that will guide irqbalance in
the management of that IRQ. Key=value pairs are printed by the script on stdout
and will be captured and interpreted by irqbalance. Irqbalance expects a zero