Re: [PATCH 2/3] tty: Serialise racing tiocspgrp() callers

From: kernel test robot
Date: Thu Sep 28 2023 - 17:00:54 EST


Hi Earl,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next tty/tty-linus linus/master v6.6-rc3 next-20230928]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Earl-Chew/tty-Serialise-racing-tiocspgrp-callers/20230929-010844
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link: https://lore.kernel.org/r/20230901015030.2469062-3-earl.chew%40yahoo.ca
patch subject: [PATCH 2/3] tty: Serialise racing tiocspgrp() callers
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230929/202309290422.8TLHGj3t-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230929/202309290422.8TLHGj3t-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309290422.8TLHGj3t-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/tty/tty_jobctrl.c:35: warning: Function parameter or member 'ctrl_lock' not described in '__tty_check_change_locked'
>> drivers/tty/tty_jobctrl.c:35: warning: expecting prototype for __tty_check_change(). Prototype was for __tty_check_change_locked() instead


vim +35 drivers/tty/tty_jobctrl.c

a1235b3eb10086 Nicolas Pitre 2017-04-12 21
a1235b3eb10086 Nicolas Pitre 2017-04-12 22 /**
6ef6785d781e9c Lee Jones 2021-05-20 23 * __tty_check_change - check for POSIX terminal changes
a1235b3eb10086 Nicolas Pitre 2017-04-12 24 * @tty: tty to check
bc38fe241bc320 Lee Jones 2020-11-04 25 * @sig: signal to send
a1235b3eb10086 Nicolas Pitre 2017-04-12 26 *
a1235b3eb10086 Nicolas Pitre 2017-04-12 27 * If we try to write to, or set the state of, a terminal and we're
a1235b3eb10086 Nicolas Pitre 2017-04-12 28 * not in the foreground, send a SIGTTOU. If the signal is blocked or
a1235b3eb10086 Nicolas Pitre 2017-04-12 29 * ignored, go ahead and perform the operation. (POSIX 7.2)
a1235b3eb10086 Nicolas Pitre 2017-04-12 30 *
64d608db38ffc0 Jiri Slaby 2021-05-05 31 * Locking: ctrl.lock
a1235b3eb10086 Nicolas Pitre 2017-04-12 32 */
99d6f12e388e7a Earl Chew 2023-08-31 33 static int __tty_check_change_locked(struct tty_struct *tty, int sig,
99d6f12e388e7a Earl Chew 2023-08-31 34 spinlock_t *ctrl_lock)
a1235b3eb10086 Nicolas Pitre 2017-04-12 @35 {
a1235b3eb10086 Nicolas Pitre 2017-04-12 36 unsigned long flags;
a1235b3eb10086 Nicolas Pitre 2017-04-12 37 struct pid *pgrp, *tty_pgrp;
a1235b3eb10086 Nicolas Pitre 2017-04-12 38 int ret = 0;
a1235b3eb10086 Nicolas Pitre 2017-04-12 39
99d6f12e388e7a Earl Chew 2023-08-31 40 BUG_ON(ctrl_lock && (
99d6f12e388e7a Earl Chew 2023-08-31 41 ctrl_lock != &tty->ctrl.lock || !spin_is_locked(ctrl_lock)));
99d6f12e388e7a Earl Chew 2023-08-31 42
a1235b3eb10086 Nicolas Pitre 2017-04-12 43 if (current->signal->tty != tty)
a1235b3eb10086 Nicolas Pitre 2017-04-12 44 return 0;
a1235b3eb10086 Nicolas Pitre 2017-04-12 45
a1235b3eb10086 Nicolas Pitre 2017-04-12 46 rcu_read_lock();
a1235b3eb10086 Nicolas Pitre 2017-04-12 47 pgrp = task_pgrp(current);
a1235b3eb10086 Nicolas Pitre 2017-04-12 48
99d6f12e388e7a Earl Chew 2023-08-31 49 if (!ctrl_lock)
64d608db38ffc0 Jiri Slaby 2021-05-05 50 spin_lock_irqsave(&tty->ctrl.lock, flags);
64d608db38ffc0 Jiri Slaby 2021-05-05 51 tty_pgrp = tty->ctrl.pgrp;
a1235b3eb10086 Nicolas Pitre 2017-04-12 52
cf90c06f811501 David Emett 2019-03-10 53 if (tty_pgrp && pgrp != tty_pgrp) {
a1235b3eb10086 Nicolas Pitre 2017-04-12 54 if (is_ignored(sig)) {
a1235b3eb10086 Nicolas Pitre 2017-04-12 55 if (sig == SIGTTIN)
a1235b3eb10086 Nicolas Pitre 2017-04-12 56 ret = -EIO;
a1235b3eb10086 Nicolas Pitre 2017-04-12 57 } else if (is_current_pgrp_orphaned())
a1235b3eb10086 Nicolas Pitre 2017-04-12 58 ret = -EIO;
a1235b3eb10086 Nicolas Pitre 2017-04-12 59 else {
a1235b3eb10086 Nicolas Pitre 2017-04-12 60 kill_pgrp(pgrp, sig, 1);
a1235b3eb10086 Nicolas Pitre 2017-04-12 61 set_thread_flag(TIF_SIGPENDING);
a1235b3eb10086 Nicolas Pitre 2017-04-12 62 ret = -ERESTARTSYS;
a1235b3eb10086 Nicolas Pitre 2017-04-12 63 }
a1235b3eb10086 Nicolas Pitre 2017-04-12 64 }
99d6f12e388e7a Earl Chew 2023-08-31 65 if (!ctrl_lock)
95d3590fbe7aed Earl Chew 2023-08-31 66 spin_unlock_irqrestore(&tty->ctrl.lock, flags);
a1235b3eb10086 Nicolas Pitre 2017-04-12 67 rcu_read_unlock();
a1235b3eb10086 Nicolas Pitre 2017-04-12 68
a1235b3eb10086 Nicolas Pitre 2017-04-12 69 if (!tty_pgrp)
a1235b3eb10086 Nicolas Pitre 2017-04-12 70 tty_warn(tty, "sig=%d, tty->pgrp == NULL!\n", sig);
a1235b3eb10086 Nicolas Pitre 2017-04-12 71
a1235b3eb10086 Nicolas Pitre 2017-04-12 72 return ret;
a1235b3eb10086 Nicolas Pitre 2017-04-12 73 }
a1235b3eb10086 Nicolas Pitre 2017-04-12 74

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki