Jump to content 日本-日本語
日本HPホーム 製品とサービス サポートとドライバ ソリューション ご購入方法
≫ お問い合わせ
日本HPホーム
企業ユーザ向けサポート情報   >  HP-UX サポート  >  セキュリティ報告&パッチダイジェスト翻訳版

PHCO_34510 s700_800 11.23 ksh(1)累積パッチ

企業ユーザ向けサポート情報

HP-UX サポート
Tru64 サポート
OpenVMS サポート
セキュリティ報告&パッチダイジェスト翻訳版
技術情報ツリー
ソフトウェアアップデート情報
ITRC日本フォーラム

ITRC

パッチデータベース
技術情報ベースの検索
サポートケースマネージャ
ソフトウェア アップデート マネージャ (SUM)
ご利用の手順
日本HPサイトマップ
コンテンツに進む
パッチ名:   PHCO_34510

パッチ摘要: s700_800 11.23 ksh(1)累積パッチ

作成日:  07/03/27

公開日:  07/05/09

ハードウェアプラットフォームおよびOSリリース:

	s700: 11.23
	s800: 11.23

現象:

	PHCO_34510:

	1.(SR:8606420313 CR:JAGaf80143)
	関数内で"typeset -i"を使って整数型変数を定義すると、ksh(1)内でメモリリ
	ークが起きます。

	2.(SR:8606435240 CR:JAGaf93696)
	ksh(1)のマンページでの"typeset -f"機能に関する説明が不明確です。

	3.(SR:8606442247 CR:JAGag00047)
	サブシェルによるコマンドリストの実行中にリスト内のあるシェル組み込みコ
	マンドがエラーになると、シェルが終了してしまうため、リスト内の後続のコ
	マンドが実行されません。

	4.(SR:8606462549 CR:JAGag18411)
	未初期化または空の変数の算術比較が行われるため、算術式から不正な結果が
	返されることがあります。

問題点の説明:

	PHCO_34510:

	1.(SR:8606420313 CR:JAGaf80143)
	関数内で"typeset -i"を使って整数型変数を定義すると、ksh(1)内でメモリリ
	ークが起きていました。"ps -l"やglanceの出力によると、"typeset -i"を使
	用する関数が呼び出されるたびに、整数型変数のサイズと等価なメモリリーク
	が起きています。つまり、ksh(1)は、関数のリターン時に整数型変数用のメモ
	リを割り当て解除していませんでした。

	問題の再現手順:

	1) $cat ./script
	   #!/usr/bin/ksh

	   function  CallMe
	   {
	      typeset -i  var1=0
	   }

	   while  true
	   do
	            CallMe
	   done

	2) 上記のスクリプトをバックグラウンドで実行します。

	   $/usr/bin/ksh ./script &

	3) "ps -l"の出力の"SZ"フィールド(プロセスサイズ)を監視します。関数
	   (CallMe)を呼び出すたびに"SZ"フィールド値が増加していることがわかり
	   ます。

	解決方法:
	関数内で"typeset -i"を使って作成された整数型変数に割り当てたメモリを解
	放するようにksh(1)を修正しました。

	2.(SR:8606435240 CR:JAGaf93696)
	スクリプトからksh(1)を呼び出すと、"typeset -f"機能は関数本体を表示しま
	せん。これは設計上の制限事項です。ところが、このことがksh(1)のマンペー
	ジに記載されていませんでした。"typeset -f"は対話型専用に設計された機能
	です。関数の読み取り時にヒストリファイルが存在しないかnologオプション
	がONの場合、ksh(1)は関数定義を表示しません。

	問題の再現手順:

	1) $ cat x.sh
	   function f {
	   echo "This is function f"
	   }
	   typeset -f

	2) スクリプトを実行します。
	   $ ksh x.sh
	   function f

	"typeset -f"機能は、マンページどおりに、関数本体を表示できません。

	解決方法:
	"typeset -f"機能の正しい使用法を記載するようにksh(1)のマンページを修正
	しました。

	3.(SR:8606442247 CR:JAGag00047)
	ksh(1)サブシェルによるコマンドリストの実行中にリスト内のあるシェル組み
	込みコマンドがエラーになると、シェルが終了していたため、リスト内の後続
	のコマンドが実行されませんでした。

	解決方法:
	エラーが起きてもリスト内のすべてのコマンドを実行するようにksh(1)を修正
	しました。

	4.(SR:8606462549 CR:JAGag18411)
	算術式の計算時に、未初期化または空のローカル変数を使用することがありま
	した。そのため、算術式から不正な値が返されていました。

	解決方法:
	正しい結果を返すようにksh(1)を修正しました。

-----------------------------------------------------------------------------
Patch Name: PHCO_34510

Patch Description: s700_800 11.23 ksh(1) cumulative patch

Creation Date: 07/03/27

Post Date: 07/05/09

Hardware Platforms - OS Releases: 
	s700: 11.23
	s800: 11.23

Products: N/A

Filesets: 
	OS-Core.CORE-ENG-A-MAN,fr=B.11.23,fa=HP-UX_B.11.23_IA/PA,v=HP
	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_IA,v=HP
	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_PA,v=HP

Automatic Reboot?: No

Status: General Release

Critical: 
	Yes
	PHCO_34510: MEMORY_LEAK
		Integer variables defined with 'typeset -i' inside
		a function results in memory leak on function
		return.
	PHCO_31552: MEMORY_LEAK

Category Tags: 
	defect_repair general_release critical memory_leak

Path Name: /hp-ux_patches/s700_800/11.X/PHCO_34510

Symptoms: 
	PHCO_34510:
	( SR:8606420313 CR:JAGaf80143 )
	ksh(1) leaks memory when typeset -i is used to define
	an integer variable in a function.

	( SR:8606435240 CR:JAGaf93696 )
	ksh(1) man page is not clear about the typeset -f
	functionality.

	( SR:8606442247 CR:JAGag00047 )
	In a subshell executing a list of commands, if one of the
	shell built-in command in the list encounters an error,
	the shell exits thereby not executing the subsequent
	commands in the list.

	( SR:8606462549 CR:JAGag18411 )
	The arithmetic comparisons of uninitialized or empty
	variables sometimes return incorrect results.

	PHCO_32856:
	( SR:8606388635 CR:JAGaf48784 )
	The shell variable - TMOUT, doesn't function as expected
	in sub-shells, under certain circumstances.

	PHCO_31552:
	( SR:8606350351 CR:JAGaf11171 )
	Large number of background jobs running on an
	interactive ksh shell terminates it.

	( SR:8606350366 CR:JAGaf11186 )
	The ksh shell displays wrong pid for the signalled child.

	( SR:8606369179 CR:JAGaf29723 )
	In ksh shell, "set -A" leaks memory.

	( SR:8606369780 CR:JAGaf30323 )
	In ksh(1), calling wait on an already completed process
	does not return the correct exit value.

Defect Description: 
	PHCO_34510:
	( SR:8606420313 CR:JAGaf80143 )
	ksh(1) leaks memory when typeset -i is used to define an
	integer variable in a function. Output of 'ps -l' or glance
	shows memory-leak equivalent to size of integer variable
	every time the function using 'typeset -i' is called, ie
	ksh(1) is not de-allocating memory for integer variables on
	function return.

	Problem reproduction:

	1.$cat ./script
	  #!/usr/bin/ksh

	  function  CallMe
	  {
	     typeset -i  var1=0
	  }

	  while  true
	  do
	           CallMe
	  done

	2. Execute the above script in background
	   $/usr/bin/ksh ./script &

	3. Monitor the process size by looking at the 'SZ' field
	   of 'ps -l' output. 'SZ' field value keeps increasing
	   every time the function(CallMe) is called.

	Resolution:
	ksh(1) has been modified to free memory allocated to
	integer variables created using 'typeset -i' inside a
	function.

	( SR:8606435240 CR:JAGaf93696 )
	ksh(1) typeset -f feature does not list the function
	body when invoked through scripts. The problem is the
	design limitation, that was missed in ksh(1) man page
	documentation. The typeset -f is only for the
	interactive case, as per the design. ksh(1) will not
	display the function definitions if the history file
	is lost or nolog option was on when function was read.

	Steps For Problem Reproduction:
	1.
	$ cat x.sh
	function f {
	echo "This is function f"
	}
	typeset -f

	2. Execute the script.
	$ ksh x.sh
	function f

	The typeset -f feature fails to display the function body,
	as per the man page.

	Resolution:
	ksh(1) man page is corrected to document the proper use of
	"typeset -f" functionality.

	( SR:8606442247 CR:JAGag00047 )
	While executing a list of commands in ksh(1) subshell, if
	any one of the built-in command fails in the list, the shell
	exits thereby not executing the subsequent commands in the
	list.

	Resolution:
	ksh(1) will now execute all the commands in a list
	irrespective of the errors.

	( SR:8606462549 CR:JAGag18411 )
	There are instances wherein an uninitialized or empty local
	variable is used while calculating the arithmetic
	expression. Due to this, wrong values are returned from the
	arithmetic expressions.

	Resolution:
	ksh(1) has been modified to return the correct results.

	PHCO_32856:
	( SR:8606388635 CR:JAGaf48784 )
	When an interactive ksh imports a TMOUT value
	from its parent and its value is changed, the new
	value is not reflected in the shells behavior. It
	will still continue to exhibit the behavior of
	TMOUT it imported from the parent.

	The problem can be reproduced as follows :
	$ /usr/bin/ksh
	$ export TMOUT=10
	$ /usr/bin/ksh
	$ export TMOUT=0
	$ <Keep the shell inactive>
	shell time out in 60 seconds
	/usr/bin/ksh: timed out waiting for input

	The TMOUT variable indicates the timeout value for
	the shell. A value greater than 0 in TMOUT,
	terminates the shell, if no command is issued within
	the prescribed number of seconds after the PS1 prompt
	is printed.
	The default value for TMOUT is 0, which allows the
	shell to be inactive forever.

	Here, although TMOUT is set to 0 in the sub-shell,
	the shell exits if it remains in-active for 10 seconds.

	Resolution:
	Now ksh will exit with timeout based on the recent value
	set to TMOUT and not on the value it inherited from
	parent.

	PHCO_31552:
	( SR:8606350351 CR:JAGaf11171 )
	Large number of background jobs running on an
	interactive ksh shell terminates it.
	The problem can be reproduced as follows:
	$/usr/bin/ksh
	$set -o vi
	$for i in `perl -e '@a=(1..50); print "@a"'`
	>do
	>sleep 15 &
	>done.
	$
	Now wait for around 15 to 20 seconds without entering
	any input on the standard input. After 15 or 20
	seconds, the ksh shell will be terminated automatically.
	Root Cause:
	When the ksh shell fails to read from the standard
	input due to the interruption by SIGCHLD signals
	generated after the termination of each background
	job, it tries to read again for a fixed number of
	times. The shell exits if it doesn't succeed
	within the fixed number of tries.

	Resolution:
	Now the code is modified so that the shell will
	always try to read again from the standard input
	if it fails to read due to the SIGCHLD interruption.

	( SR:8606350366 CR:JAGaf11186 )
	The ksh shell prints line number instead of signal number
	when a signal is sent to it.
	The problem can be reproduced as follows :
	1. Create a test script - test.sh
	   $ cat test.sh
	   #!/usr/bin/ksh -p
	   # Lots of comments so
	   # that the lines below
	   # are after 10 just so
	   # the affect of the bug
	   # is easily seen.
	   # 8
	   # 9
	   # 10
	   print "mypid=$$"
	   ksh -c 'kill -9 $$'
	   ksh -c 'kill -9 $$'
	   ksh -c 'kill -9 $$'
	   ksh -c 'kill -9 $$'
	2. Run the script.
	   $ ./test.sh
	3. The output will be :
	mypid=25632
	test.sh[12]: 25612 Killed
	test.sh[13]: 25613 Killed
	test.sh[14]: 25614 Killed
	test.sh[15]: 25615 Killed
	This was due to the fact that, the shell would overwrite
	part of pid with the line number.

	Resolution:
	Now the code is modified so that the shell does not
	overwrite the pid value, and hence the correct value is
	printed as output.  Now, when the above mentioned test
	script is run, the correct output is displayed :
	mypid=25632
	test.sh[12]: 25633 Killed
	test.sh[13]: 25634 Killed
	test.sh[14]: 25635 Killed
	test.sh[15]: 25636 Killed

	( SR:8606369179 CR:JAGaf29723 )
	In ksh shell, "set -A" is used to assign an
	array variable. Before assigning the new values to
	the array variable, shell frees the memory
	associated with the existing array elements (if any)
	and allocates the memory for the new array elements.
	The code for freeing the memory of the existing array
	elements was returning without freeing the memory
	of the last element in the array and hence
	causing the memory leak.
	The problem can be reproduced as follows:
	1.
	$cat leak.sh
	#!/usr/bin/ksh
	typeset -i N=0
	while [[ $N -le $1 ]];do
	        set -A arr 1 2
	        (( N = N + 1 ))
	done
	UNIX95=1 ps -osz,comm -p$$; echo $1; exit
	$
	The above script will print the size of the shell.
	2. Run the above script with the argument let's say
	1 and 50000 and compare the size of the shell. E.g.
	$/usr/bin/ksh leak.sh 1
	 SZ COMMAND
	 55 sh.org
	1
	$/usr/bin/ksh leak.sh 50000
	 SZ COMMAND
	 402 sh.org
	50000
	$
	The 50000 iterations caused the shell to grow by
	347*4096 bytes.

	Resolution:
	Now the code for freeing the memory of the
	existing array elements is corrected such
	that it frees even the memory of the last
	array element.

	( SR:8606369780 CR:JAGaf30323 )
	The problem can be easily reproduced as follows :
	$ cat call.sh
	#invoke first child
	./wait_and_exit 3  &
	pid_1cld=$!
	#invoke second child
	./wait_and_exit 2 &
	pid_2cld=$!
	wait $pid_1cld
	echo $?
	wait $pid_2cld
	echo $?
	$ cat wait_and_exit.c
	#include <stdlib.h>
	#include <unistd.h>
	main(argc, argv)
	int argc;
	char **argv;
	{
	  int i;
	  i=atoi(*++argv);
	  sleep(i);
	  exit(i);
	}
	$ cc wait_and_exit.c -o wait_and_exit
	Run call.sh
	$ ./call.sh
	3
	127 <---- This is expected to be 2.
	ksh(1) does not maintain an exitlist for already
	completed processes. Hence, when wait is called
	on a completed process, it assumes that the given
	process id is invalid & hence returns 127.

	Resolution:
	Now an exitlist is maintained to remember the exit
	values of the background processes. Hence, the correct
	exit values will be returned.

Enhancement: 
	No

SR: 
	8606420313 8606435240 8606442247 8606462549 8606388635
	8606350351 8606350366 8606369179 8606369780

Patch Files: 
	
	OS-Core.CORE-ENG-A-MAN,fr=B.11.23,fa=HP-UX_B.11.23_IA/PA,
		v=HP:
	/usr/share/man/man1.Z/ksh.1
	/usr/share/man/man1.Z/rksh.1

	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_IA,v=HP:
	/usr/bin/ksh
	/usr/bin/rksh

	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_PA,v=HP:
	/usr/bin/ksh
	/usr/bin/rksh

what(1) Output: 
	
	OS-Core.CORE-ENG-A-MAN,fr=B.11.23,fa=HP-UX_B.11.23_IA/PA,
		v=HP:
	/usr/share/man/man1.Z/ksh.1:
		None
	/usr/share/man/man1.Z/rksh.1:
		None

	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_IA,v=HP:
	/usr/bin/ksh:
		$ B.11.23  Sep 17 2004 18:28:29 $
		Version 11/16/88
		error.c $Date: 2007/03/27 12:05:26 $Revision: r11.23
			/1 PATCH_11.23 (PHCO_34510)
		jobs.c $Date: 2005/09/02 00:07:48 $Revision: r11.23/
			2 PATCH_11.23 (PHCO_32856)
		adjust.c $Date: 2005/02/24 01:39:17 $Revision: r11.2
			3/1 PATCH_11.23 (PHCO_32856)
		streval.c $Date: 2007/03/27 12:07:12 $Revision: r11.
			23/1 PATCH_11.23 (PHCO_34510)
		unassign.c $Date: 2006/02/15 04:05:08 $Revision: r11
			.23/2 PATCH_11.23 (PHCO_34510)
		$Revision: @(#) ksh88 R11.23_BL2007_0327_2 PATCH_11.
			23 PHCO_34510
	/usr/bin/rksh:
		$ B.11.23  Sep 17 2004 18:28:29 $
		Version 11/16/88
		error.c $Date: 2007/03/27 12:05:26 $Revision: r11.23
			/1 PATCH_11.23 (PHCO_34510)
		jobs.c $Date: 2005/09/02 00:07:48 $Revision: r11.23/
			2 PATCH_11.23 (PHCO_32856)
		adjust.c $Date: 2005/02/24 01:39:17 $Revision: r11.2
			3/1 PATCH_11.23 (PHCO_32856)
		streval.c $Date: 2007/03/27 12:07:12 $Revision: r11.
			23/1 PATCH_11.23 (PHCO_34510)
		unassign.c $Date: 2006/02/15 04:05:08 $Revision: r11
			.23/2 PATCH_11.23 (PHCO_34510)
		$Revision: @(#) ksh88 R11.23_BL2007_0327_2 PATCH_11.
			23 PHCO_34510

	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_PA,v=HP:
	/usr/bin/ksh:
		$Revision: 92453-07 linker linker crt0.o B.11.16.01 
			030415 $
		error.c $Date: 2007/03/27 12:05:26 $Revision: r11.23
			/1 PATCH_11.23 (PHCO_34510)
		jobs.c $Date: 2005/09/02 00:07:48 $Revision: r11.23/
			2 PATCH_11.23 (PHCO_32856)
		$Revision: @(#) ksh88 R11.23_BL2007_0327_2 PATCH_11.
			23 PHCO_34510
		adjust.c $Date: 2005/02/24 01:39:17 $Revision: r11.2
			3/1 PATCH_11.23 (PHCO_32856)
		streval.c $Date: 2007/03/27 12:07:12 $Revision: r11.
			23/1 PATCH_11.23 (PHCO_34510)
		unassign.c $Date: 2006/02/15 04:05:08 $Revision: r11
			.23/2 PATCH_11.23 (PHCO_34510)
		$ B.11.23  Dec  2 2004 03:46:59 $
		Version 11/16/88
	/usr/bin/rksh:
		$Revision: 92453-07 linker linker crt0.o B.11.16.01 
			030415 $
		error.c $Date: 2007/03/27 12:05:26 $Revision: r11.23
			/1 PATCH_11.23 (PHCO_34510)
		jobs.c $Date: 2005/09/02 00:07:48 $Revision: r11.23/
			2 PATCH_11.23 (PHCO_32856)
		$Revision: @(#) ksh88 R11.23_BL2007_0327_2 PATCH_11.
			23 PHCO_34510
		adjust.c $Date: 2005/02/24 01:39:17 $Revision: r11.2
			3/1 PATCH_11.23 (PHCO_32856)
		streval.c $Date: 2007/03/27 12:07:12 $Revision: r11.
			23/1 PATCH_11.23 (PHCO_34510)
		unassign.c $Date: 2006/02/15 04:05:08 $Revision: r11
			.23/2 PATCH_11.23 (PHCO_34510)
		$ B.11.23  Dec  2 2004 03:46:59 $
		Version 11/16/88

cksum(1) Output: 
	
	OS-Core.CORE-ENG-A-MAN,fr=B.11.23,fa=HP-UX_B.11.23_IA/PA,
		v=HP:
	1436246302 42408 /usr/share/man/man1.Z/ksh.1
	1436246302 42408 /usr/share/man/man1.Z/rksh.1

	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_IA,v=HP:
	1281966804 447560 /usr/bin/ksh
	1281966804 447560 /usr/bin/rksh

	OS-Core.UX2-CORE,fr=B.11.23,fa=HP-UX_B.11.23_PA,v=HP:
	3510868961 237568 /usr/bin/ksh
	3510868961 237568 /usr/bin/rksh

Patch Conflicts: None

Patch Dependencies: None

Hardware Dependencies: None

Other Dependencies: None

Supersedes: 
	PHCO_31552 PHCO_32856

Equivalent Patches: None

Patch Package Size: 400 KBytes

Installation Instructions: 
	Please review all instructions and the Hewlett-Packard
	SupportLine User Guide or your Hewlett-Packard support terms
	and conditions for precautions, scope of license,
	restrictions, and, limitation of liability and warranties,
	before installing this patch.
	------------------------------------------------------------
	1. Back up your system before installing a patch.

	2. Login as root.

	3. Copy the patch to the /tmp directory.

	4. Move to the /tmp directory and unshar the patch:

		cd /tmp
		sh PHCO_34510

	5. Run swinstall to install the patch:

		swinstall -x autoreboot=true -x patch_match_target=true \
			  -s /tmp/PHCO_34510.depot

	By default swinstall will archive the original software in 
	/var/adm/sw/save/PHCO_34510.  If you do not wish to retain a
	copy of the original software, include the patch_save_files
	option in the swinstall command above:

		-x patch_save_files=false

	WARNING: If patch_save_files is false when a patch is installed,
		 the patch cannot be deinstalled.  Please be careful
		 when using this feature.

	For future reference, the contents of the PHCO_34510.text file is 
	available in the product readme:

		swlist -l product -a readme -d @ /tmp/PHCO_34510.depot

	To put this patch on a magnetic tape and install from the
	tape drive, use the command:

		dd if=/tmp/PHCO_34510.depot of=/dev/rmt/0m bs=2k

Special Installation Instructions: None

ページトップへ
セキュリティ報告&パッチダイジェスト翻訳版に戻る
プライバシー 本サイト利用時の合意事項 ウェブマスターに連絡
© 2008 Hewlett-Packard Development Company, L.P.